Showing the changes to interface/src/Application.cpp (1 of 7 files). Show all
Unified · Split
| @@ -152,6 +152,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 151 unmodified lines | ||
| 152 | 152 | _mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)), |
| 153 | 153 | _cameraPushback(0.0f), |
| 154 | 154 | _scaleMirror(1.0f), |
| 155 | + _rotateMirror(0.0f), | |
| 156 | + _raiseMirror(0.0f), | |
| 155 | 157 | _mouseX(0), |
| 156 | 158 | _mouseY(0), |
| 157 | 159 | _lastMouseMove(usecTimestampNow()), |
| @@ -3374,71 +3376,6 @@ void Application::saveScripts() { · 3216 unmodified lines | ||
| 3374 | 3376 | _settings->endArray(); |
| 3375 | 3377 | } |
| 3376 | 3378 | |
| 3377 | −void Application::stopAllScripts() { | |
| 3378 | − // stops all current running scripts | |
| 3379 | − for (int i = 0; i < _scriptEnginesHash.size(); ++i) { | |
| 3380 | − _scriptEnginesHash.values().at(i)->stop(); | |
| 3381 | − qDebug() << "stopping script..." << getRunningScripts().at(i); | |
| 3382 | − } | |
| 3383 | − _scriptEnginesHash.clear(); | |
| 3384 | − _runningScriptsWidget->setRunningScripts(getRunningScripts()); | |
| 3385 | − bumpSettings(); | |
| 3386 | −} | |
| 3387 | − | |
| 3388 | −void Application::stopScript(const QString &scriptName) { | |
| 3389 | − if (_scriptEnginesHash.contains(scriptName)) { | |
| 3390 | − _scriptEnginesHash.value(scriptName)->stop(); | |
| 3391 | − qDebug() << "stopping script..." << scriptName; | |
| 3392 | − _scriptEnginesHash.remove(scriptName); | |
| 3393 | − _runningScriptsWidget->setRunningScripts(getRunningScripts()); | |
| 3394 | − bumpSettings(); | |
| 3395 | − } | |
| 3396 | −} | |
| 3397 | − | |
| 3398 | −void Application::reloadAllScripts() { | |
| 3399 | − // remember all the current scripts so we can reload them | |
| 3400 | − QStringList reloadList = getRunningScripts(); | |
| 3401 | − // reloads all current running scripts | |
| 3402 | − stopAllScripts(); | |
| 3403 | − | |
| 3404 | − foreach (QString scriptName, reloadList){ | |
| 3405 | − qDebug() << "reloading script..." << scriptName; | |
| 3406 | − loadScript(scriptName); | |
| 3407 | − } | |
| 3408 | −} | |
| 3409 | − | |
| 3410 | −void Application::manageRunningScriptsWidgetVisibility(bool shown) { | |
| 3411 | − if (_runningScriptsWidgetWasVisible && shown) { | |
| 3412 | − _runningScriptsWidget->show(); | |
| 3413 | − } else if (_runningScriptsWidgetWasVisible && !shown) { | |
| 3414 | − _runningScriptsWidget->hide(); | |
| 3415 | − } | |
| 3416 | −} | |
| 3417 | − | |
| 3418 | −void Application::toggleRunningScriptsWidget() { | |
| 3419 | − if (_runningScriptsWidgetWasVisible) { | |
| 3420 | − _runningScriptsWidget->hide(); | |
| 3421 | − _runningScriptsWidgetWasVisible = false; | |
| 3422 | − } else { | |
| 3423 | − _runningScriptsWidget->setBoundary(QRect(_window->geometry().topLeft(), | |
| 3424 | − _window->size())); | |
| 3425 | − _runningScriptsWidget->show(); | |
| 3426 | − _runningScriptsWidgetWasVisible = true; | |
| 3427 | − } | |
| 3428 | −} | |
| 3429 | − | |
| 3430 | −void Application::uploadHead() { | |
| 3431 | − uploadModel(HEAD_MODEL); | |
| 3432 | −} | |
| 3433 | − | |
| 3434 | −void Application::uploadSkeleton() { | |
| 3435 | − uploadModel(SKELETON_MODEL); | |
| 3436 | −} | |
| 3437 | − | |
| 3438 | −void Application::uploadAttachment() { | |
| 3439 | − uploadModel(ATTACHMENT_MODEL); | |
| 3440 | −} | |
| 3441 | − | |
| 3442 | 3379 | ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScriptFromEditor) { |
| 3443 | 3380 | if(loadScriptFromEditor && _scriptEnginesHash.contains(scriptName) && !_scriptEnginesHash[scriptName]->isFinished()){ |
| 3444 | 3381 | return _scriptEnginesHash[scriptName]; |
| @@ -3518,6 +3455,67 @@ ScriptEngine* Application::loadScript(const QString& scriptName, bool loadScript · 73 unmodified lines | ||
| 3518 | 3455 | return scriptEngine; |
| 3519 | 3456 | } |
| 3520 | 3457 | |
| 3458 | +void Application::stopAllScripts(bool restart) { | |
| 3459 | + // stops all current running scripts | |
| 3460 | + for (QHash<QString, ScriptEngine*>::const_iterator it = _scriptEnginesHash.constBegin(); | |
| 3461 | + it != _scriptEnginesHash.constEnd(); it++) { | |
| 3462 | + if (restart) { | |
| 3463 | + connect(it.value(), SIGNAL(finished(const QString&)), SLOT(loadScript(const QString&))); | |
| 3464 | + } | |
| 3465 | + it.value()->stop(); | |
| 3466 | + qDebug() << "stopping script..." << it.key(); | |
| 3467 | + } | |
| 3468 | + _scriptEnginesHash.clear(); | |
| 3469 | + _runningScriptsWidget->setRunningScripts(getRunningScripts()); | |
| 3470 | + bumpSettings(); | |
| 3471 | +} | |
| 3472 | + | |
| 3473 | +void Application::stopScript(const QString &scriptName) { | |
| 3474 | + if (_scriptEnginesHash.contains(scriptName)) { | |
| 3475 | + _scriptEnginesHash.value(scriptName)->stop(); | |
| 3476 | + qDebug() << "stopping script..." << scriptName; | |
| 3477 | + _scriptEnginesHash.remove(scriptName); | |
| 3478 | + _runningScriptsWidget->setRunningScripts(getRunningScripts()); | |
| 3479 | + bumpSettings(); | |
| 3480 | + } | |
| 3481 | +} | |
| 3482 | + | |
| 3483 | +void Application::reloadAllScripts() { | |
| 3484 | + stopAllScripts(true); | |
| 3485 | +} | |
| 3486 | + | |
| 3487 | +void Application::manageRunningScriptsWidgetVisibility(bool shown) { | |
| 3488 | + if (_runningScriptsWidgetWasVisible && shown) { | |
| 3489 | + _runningScriptsWidget->show(); | |
| 3490 | + } else if (_runningScriptsWidgetWasVisible && !shown) { | |
| 3491 | + _runningScriptsWidget->hide(); | |
| 3492 | + } | |
| 3493 | +} | |
| 3494 | + | |
| 3495 | +void Application::toggleRunningScriptsWidget() { | |
| 3496 | + if (_runningScriptsWidgetWasVisible) { | |
| 3497 | + _runningScriptsWidget->hide(); | |
| 3498 | + _runningScriptsWidgetWasVisible = false; | |
| 3499 | + } else { | |
| 3500 | + _runningScriptsWidget->setBoundary(QRect(_window->geometry().topLeft(), | |
| 3501 | + _window->size())); | |
| 3502 | + _runningScriptsWidget->show(); | |
| 3503 | + _runningScriptsWidgetWasVisible = true; | |
| 3504 | + } | |
| 3505 | +} | |
| 3506 | + | |
| 3507 | +void Application::uploadHead() { | |
| 3508 | + uploadModel(HEAD_MODEL); | |
| 3509 | +} | |
| 3510 | + | |
| 3511 | +void Application::uploadSkeleton() { | |
| 3512 | + uploadModel(SKELETON_MODEL); | |
| 3513 | +} | |
| 3514 | + | |
| 3515 | +void Application::uploadAttachment() { | |
| 3516 | + uploadModel(ATTACHMENT_MODEL); | |
| 3517 | +} | |
| 3518 | + | |
| 3521 | 3519 | QString Application::getPreviousScriptLocation() { |
| 3522 | 3520 | QString suggestedName; |
| 3523 | 3521 | if (_previousScriptLocation.isEmpty()) { |