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