This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @brief javaScriptHandler::javaScriptHandler - generic consctructor for | |
| * the javaScriptHandler class | |
| */ | |
| javaScriptHandler::javaScriptHandler(){ | |
| userActionList = new Generate(); | |
| QString javaScript = "function clickHandler(e){"; | |
| javaScript += "var alertString, elem, evt = e ? e:event;"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void MainWindow::on_webView_loadProgress(int progress){ | |
| ui->urlLineEdit->setVisible(false); | |
| ui->progressBar->setValue(progress); | |
| if(progress == 100){ | |
| ui->urlLineEdit->setVisible(true); | |
| ui->urlLineEdit->setText(ui->webView->url().toString()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void MainWindow::on_refreshButton_released(){ | |
| on_urlLineEdit_returnPressed(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <QWebFrame> | |
| #include <QString> | |
| class javaScriptHandler { | |
| public: | |
| javaScriptHandler(); | |
| void injectJavaScript(QWebFrame *); | |
| private: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @brief javaScriptHandler::javaScriptHandler - generic consctructor for | |
| * the javaScriptHandler class | |
| */ | |
| javaScriptHandler::javaScriptHandler(){ | |
| QString javaScript = "function clickHandler(e){"; | |
| javaScript += "var alertString, elem, evt = e ? e:event;"; | |
| javaScript += "if (evt.srcElement) {"; | |
| javaScript += "elem = evt.srcElement;"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void MainWindow::on_webView_loadProgress(int progress){ | |
| ui->urlLineEdit->setVisible(false); | |
| ui->progressBar->setValue(progress); | |
| if(progress == 100){ | |
| api->injectJavaScript(ui->webView->page()->mainFrame()); | |
| ui->urlLineEdit->setVisible(true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| maxDistance = 270 | |
| # Optimal Gas Stoppages | |
| def minimizeStoppingTime(gasStations): | |
| # Base Case | |
| optimalPathCost = [0] | |
| previousStation = [0] | |
| for i in range(1, len(gasStations)): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Sorts Pancakes | |
| def sortPancakes(stack): | |
| sorted_index = 10 | |
| for i in reversed(range(len(stack))): | |
| stack = flip(stack, findLargestPancake(stack, i)) | |
| print("Flip Up", stack) | |
| stack = flip(stack, i) | |
| print("Flip Down", stack) | |
| return stack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Slide spatula under pancake at index and flip to top | |
| def flip(stack, index): | |
| newStack = stack[:(index + 1)] | |
| newStack.reverse() | |
| newStack += stack[(index + 1):] | |
| return newStack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #------------------------------------------------- | |
| # | |
| # Project created by QtCreator 2014-06-06T17:51:40 | |
| # | |
| #------------------------------------------------- | |
| QT += core gui | |
| QT += webkitwidgets | |
| greaterThan(QT_MAJOR_VERSION, 4): QT += widgets |