Showing the changes to interface/src/Application.cpp (1 of 72 files). Show all
Unified · Split
| @@ -134,7 +134,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 133 unmodified lines | |||
| 134 | _nodeThread(new QThread(this)), | 134 | _nodeThread(new QThread(this)), |
| 135 | _datagramProcessor(), | 135 | _datagramProcessor(), |
| 136 | _frameCount(0), | 136 | _frameCount(0), |
| 137 | _fps(120.0f), | 137 | _fps(60.0f), |
| 138 | _justStarted(true), | 138 | _justStarted(true), |
| 139 | _voxelImporter(NULL), | 139 | _voxelImporter(NULL), |
| 140 | _importSucceded(false), | 140 | _importSucceded(false), |
| @@ -167,7 +167,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 26 unmodified lines | |||
| 167 | _nodeBoundsDisplay(this), | 167 | _nodeBoundsDisplay(this), |
| 168 | _previousScriptLocation(), | 168 | _previousScriptLocation(), |
| 169 | _applicationOverlay(), | 169 | _applicationOverlay(), |
| 170 | _runningScriptsWidget(new RunningScriptsWidget(_window)), | 170 | _runningScriptsWidget(NULL), |
| 171 | _runningScriptsWidgetWasVisible(false), | 171 | _runningScriptsWidgetWasVisible(false), |
| 172 | _trayIcon(new QSystemTrayIcon(_window)), | 172 | _trayIcon(new QSystemTrayIcon(_window)), |
| 173 | _lastNackTime(usecTimestampNow()) | 173 | _lastNackTime(usecTimestampNow()) |
| @@ -201,6 +201,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 27 unmodified lines | |||
| 201 | // call Menu getInstance static method to set up the menu | 201 | // call Menu getInstance static method to set up the menu |
| 202 | _window->setMenuBar(Menu::getInstance()); | 202 | _window->setMenuBar(Menu::getInstance()); |
| 203 | 203 | ||
| 204 | _runningScriptsWidget = new RunningScriptsWidget(_window); | ||
| 205 | |||
| 204 | unsigned int listenPort = 0; // bind to an ephemeral port by default | 206 | unsigned int listenPort = 0; // bind to an ephemeral port by default |
| 205 | const char** constArgv = const_cast<const char**>(argv); | 207 | const char** constArgv = const_cast<const char**>(argv); |
| 206 | const char* portStr = getCmdOption(argc, constArgv, "--listenPort"); | 208 | const char* portStr = getCmdOption(argc, constArgv, "--listenPort"); |
| @@ -551,7 +553,7 @@ void Application::initializeGL() { · 344 unmodified lines | |||
| 551 | } | 553 | } |
| 552 | 554 | ||
| 553 | // update before the first render | 555 | // update before the first render |
| 554 | update(0.0f); | 556 | update(1.f / _fps); |
| 555 | 557 | ||
| 556 | InfoView::showFirstTime(); | 558 | InfoView::showFirstTime(); |
| 557 | } | 559 | } |
| @@ -3533,10 +3535,12 @@ void Application::saveScripts() { · 2975 unmodified lines | |||
| 3533 | _settings->endArray(); | 3535 | _settings->endArray(); |
| 3534 | } | 3536 | } |
| 3535 | 3537 | ||
| 3536 | ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScriptFromEditor) { | 3538 | ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScriptFromEditor, bool activateMainWindow) { |
| 3537 | QUrl scriptUrl(scriptName); | 3539 | QUrl scriptUrl(scriptName); |
| 3538 | const QString& scriptURLString = scriptUrl.toString(); | 3540 | const QString& scriptURLString = scriptUrl.toString(); |
| 3539 | if(loadScriptFromEditor && _scriptEnginesHash.contains(scriptURLString) && !_scriptEnginesHash[scriptURLString]->isFinished()){ | 3541 | if (_scriptEnginesHash.contains(scriptURLString) && loadScriptFromEditor |
| 3542 | && !_scriptEnginesHash[scriptURLString]->isFinished()) { | ||
| 3543 | |||
| 3540 | return _scriptEnginesHash[scriptURLString]; | 3544 | return _scriptEnginesHash[scriptURLString]; |
| 3541 | } | 3545 | } |
| 3542 | 3546 | ||
| @@ -3549,10 +3553,11 @@ ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScript · 6 unmodified lines | |||
| 3549 | 3553 | ||
| 3550 | if (!scriptEngine->hasScript()) { | 3554 | if (!scriptEngine->hasScript()) { |
| 3551 | qDebug() << "Application::loadScript(), script failed to load..."; | 3555 | qDebug() << "Application::loadScript(), script failed to load..."; |
| 3556 | QMessageBox::warning(getWindow(), "Error Loading Script", scriptURLString + " failed to load."); | ||
| 3552 | return NULL; | 3557 | return NULL; |
| 3553 | } | 3558 | } |
| 3554 | 3559 | ||
| 3555 | _scriptEnginesHash.insert(scriptURLString, scriptEngine); | 3560 | _scriptEnginesHash.insertMulti(scriptURLString, scriptEngine); |
| 3556 | _runningScriptsWidget->setRunningScripts(getRunningScripts()); | 3561 | _runningScriptsWidget->setRunningScripts(getRunningScripts()); |
| 3557 | } | 3562 | } |
| 3558 | 3563 | ||
| @@ -3618,7 +3623,7 @@ ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScript · 59 unmodified lines | |||
| 3618 | workerThread->start(); | 3623 | workerThread->start(); |
| 3619 | 3624 | ||
| 3620 | // restore the main window's active state | 3625 | // restore the main window's active state |
| 3621 | if (!loadScriptFromEditor) { | 3626 | if (activateMainWindow && !loadScriptFromEditor) { |
| 3622 | _window->activateWindow(); | 3627 | _window->activateWindow(); |
| 3623 | } | 3628 | } |
| 3624 | bumpSettings(); | 3629 | bumpSettings(); |
| @@ -3627,7 +3632,9 @@ ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScript · 2 unmodified lines | |||
| 3627 | } | 3632 | } |
| 3628 | 3633 | ||
| 3629 | void Application::scriptFinished(const QString& scriptName) { | 3634 | void Application::scriptFinished(const QString& scriptName) { |
| 3630 | if (_scriptEnginesHash.remove(scriptName)) { | 3635 | QHash<QString, ScriptEngine*>::iterator it = _scriptEnginesHash.find(scriptName); |
| 3636 | if (it != _scriptEnginesHash.end()) { | ||
| 3637 | _scriptEnginesHash.erase(it); | ||
| 3631 | _runningScriptsWidget->scriptStopped(scriptName); | 3638 | _runningScriptsWidget->scriptStopped(scriptName); |
| 3632 | _runningScriptsWidget->setRunningScripts(getRunningScripts()); | 3639 | _runningScriptsWidget->setRunningScripts(getRunningScripts()); |
| 3633 | bumpSettings(); | 3640 | bumpSettings(); |
| @@ -3647,8 +3654,9 @@ void Application::stopAllScripts(bool restart) { · 13 unmodified lines | |||
| 3647 | } | 3654 | } |
| 3648 | 3655 | ||
| 3649 | void Application::stopScript(const QString &scriptName) { | 3656 | void Application::stopScript(const QString &scriptName) { |
| 3650 | if (_scriptEnginesHash.contains(scriptName)) { | 3657 | const QString& scriptURLString = QUrl(scriptName).toString(); |
| 3651 | _scriptEnginesHash.value(scriptName)->stop(); | 3658 | if (_scriptEnginesHash.contains(scriptURLString)) { |
| 3659 | _scriptEnginesHash.value(scriptURLString)->stop(); | ||
| 3652 | qDebug() << "stopping script..." << scriptName; | 3660 | qDebug() << "stopping script..." << scriptName; |
| 3653 | } | 3661 | } |
| 3654 | } | 3662 | } |