Showing the changes to interface/src/Application.cpp (1 of 3 files). Show all
Unified · Split
| @@ -73,7 +73,7 @@ · 72 unmodified lines | ||
| 73 | 73 | #include <PhysicsEngine.h> |
| 74 | 74 | #include <ProgramObject.h> |
| 75 | 75 | #include <ResourceCache.h> |
| 76 | −#include <Settings.h> | |
| 76 | +#include <SettingHandle.h> | |
| 77 | 77 | #include <SoundCache.h> |
| 78 | 78 | #include <TextRenderer.h> |
| 79 | 79 | #include <UserActivityLogger.h> |
| @@ -146,12 +146,6 @@ const QString SKIP_FILENAME = QStandardPaths::writableLocation(QStandardPaths::D · 66 unmodified lines | ||
| 146 | 146 | |
| 147 | 147 | const QString DEFAULT_SCRIPTS_JS_URL = "http://s3.amazonaws.com/hifi-public/scripts/defaultScripts.js"; |
| 148 | 148 | |
| 149 | −namespace SettingHandles { | |
| 150 | − const SettingHandle<bool> firstRun("firstRun", true); | |
| 151 | − const SettingHandle<QString> lastScriptLocation("LastScriptLocation"); | |
| 152 | − const SettingHandle<QString> scriptsLocation("scriptsLocation"); | |
| 153 | −} | |
| 154 | − | |
| 155 | 149 | void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& message) { |
| 156 | 150 | QString logMessage = LogHandler::getInstance().printMessage((LogMsgType) type, context, message); |
| 157 | 151 | |
| @@ -200,7 +194,6 @@ bool setupEssentials(int& argc, char** argv) { · 42 unmodified lines | ||
| 200 | 194 | return true; |
| 201 | 195 | } |
| 202 | 196 | |
| 203 | − | |
| 204 | 197 | Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : |
| 205 | 198 | QApplication(argc, argv), |
| 206 | 199 | _dependencyManagerIsSetup(setupEssentials(argc, argv)), |
| @@ -221,6 +214,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 14 unmodified lines | ||
| 221 | 214 | _lastQueriedViewFrustum(), |
| 222 | 215 | _lastQueriedTime(usecTimestampNow()), |
| 223 | 216 | _mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)), |
| 217 | + _firstRun("firstRun", true), | |
| 218 | + _previousScriptLocation("LastScriptLocation"), | |
| 219 | + _scriptsLocationHandle("scriptsLocation"), | |
| 220 | + _fieldOfView("fieldOfView", DEFAULT_FIELD_OF_VIEW_DEGREES), | |
| 224 | 221 | _viewTransform(), |
| 225 | 222 | _scaleMirror(1.0f), |
| 226 | 223 | _rotateMirror(0.0f), |
| @@ -238,7 +235,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 11 unmodified lines | ||
| 238 | 235 | _inBytesPerSecond(0), |
| 239 | 236 | _outBytesPerSecond(0), |
| 240 | 237 | _nodeBoundsDisplay(this), |
| 241 | − _previousScriptLocation(), | |
| 242 | 238 | _applicationOverlay(), |
| 243 | 239 | _runningScriptsWidget(NULL), |
| 244 | 240 | _runningScriptsWidgetWasVisible(false), |
| @@ -428,19 +424,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) : · 183 unmodified lines | ||
| 428 | 424 | connect(this, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuit())); |
| 429 | 425 | |
| 430 | 426 | // check first run... |
| 431 | − bool firstRun = SettingHandles::firstRun.get(); | |
| 432 | − if (firstRun) { | |
| 427 | + if (_firstRun.get()) { | |
| 433 | 428 | qDebug() << "This is a first run..."; |
| 434 | 429 | // clear the scripts, and set out script to our default scripts |
| 435 | 430 | clearScriptsBeforeRunning(); |
| 436 | 431 | loadScript(DEFAULT_SCRIPTS_JS_URL); |
| 437 | 432 | |
| 438 | − SettingHandles::firstRun.set(false); | |
| 433 | + _firstRun.set(false); | |
| 439 | 434 | } else { |
| 440 | 435 | // do this as late as possible so that all required subsystems are initialized |
| 441 | 436 | loadScripts(); |
| 442 | − | |
| 443 | − _previousScriptLocation = SettingHandles::lastScriptLocation.get(); | |
| 444 | 437 | } |
| 445 | 438 | |
| 446 | 439 | loadSettings(); |
| @@ -717,7 +710,7 @@ void Application::resetCamerasOnResizeGL(Camera& camera, int width, int height) · 270 unmodified lines | ||
| 717 | 710 | TV3DManager::configureCamera(camera, width, height); |
| 718 | 711 | } else { |
| 719 | 712 | camera.setAspectRatio((float)width / height); |
| 720 | − camera.setFieldOfView(_viewFrustum.getFieldOfView()); | |
| 713 | + camera.setFieldOfView(_fieldOfView.get()); | |
| 721 | 714 | } |
| 722 | 715 | } |
| 723 | 716 | |
| @@ -2974,7 +2967,7 @@ void Application::renderRearViewMirror(const QRect& region, bool billboard) { · 2250 unmodified lines | ||
| 2974 | 2967 | _mirrorCamera.setPosition(_myAvatar->getPosition() + |
| 2975 | 2968 | _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * BILLBOARD_DISTANCE * _myAvatar->getScale()); |
| 2976 | 2969 | |
| 2977 | − } else if (SettingHandles::rearViewZoomLevel.get() == BODY) { | |
| 2970 | + } else if (RearMirrorTools::rearViewZoomLevel.get() == BODY) { | |
| 2978 | 2971 | _mirrorCamera.setFieldOfView(MIRROR_FIELD_OF_VIEW); // degrees |
| 2979 | 2972 | _mirrorCamera.setPosition(_myAvatar->getChestPosition() + |
| 2980 | 2973 | _myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, -1.0f) * MIRROR_REARVIEW_BODY_DISTANCE * _myAvatar->getScale()); |
| @@ -3704,21 +3697,20 @@ void Application::domainSettingsReceived(const QJsonObject& domainSettingsObject · 723 unmodified lines | ||
| 3704 | 3697 | |
| 3705 | 3698 | QString Application::getPreviousScriptLocation() { |
| 3706 | 3699 | QString suggestedName; |
| 3707 | − if (_previousScriptLocation.isEmpty()) { | |
| 3700 | + if (_previousScriptLocation.get().isEmpty()) { | |
| 3708 | 3701 | QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); |
| 3709 | 3702 | // Temporary fix to Qt bug: http://stackoverflow.com/questions/16194475 |
| 3710 | 3703 | #ifdef __APPLE__ |
| 3711 | 3704 | suggestedName = desktopLocation.append("/script.js"); |
| 3712 | 3705 | #endif |
| 3713 | 3706 | } else { |
| 3714 | − suggestedName = _previousScriptLocation; | |
| 3707 | + suggestedName = _previousScriptLocation.get(); | |
| 3715 | 3708 | } |
| 3716 | 3709 | return suggestedName; |
| 3717 | 3710 | } |
| 3718 | 3711 | |
| 3719 | 3712 | void Application::setPreviousScriptLocation(const QString& previousScriptLocation) { |
| 3720 | − _previousScriptLocation = previousScriptLocation; | |
| 3721 | − SettingHandles::lastScriptLocation.set(_previousScriptLocation); | |
| 3713 | + _previousScriptLocation.set(previousScriptLocation); | |
| 3722 | 3714 | } |
| 3723 | 3715 | |
| 3724 | 3716 | void Application::loadDialog() { |
| @@ -3753,12 +3745,12 @@ void Application::loadScriptURLDialog() { · 28 unmodified lines | ||
| 3753 | 3745 | } |
| 3754 | 3746 | } |
| 3755 | 3747 | |
| 3756 | −QString Application::getScriptsLocation() const { | |
| 3757 | − return SettingHandles::scriptsLocation.get(); | |
| 3748 | +QString Application::getScriptsLocation() { | |
| 3749 | + return _scriptsLocationHandle.get(); | |
| 3758 | 3750 | } |
| 3759 | 3751 | |
| 3760 | 3752 | void Application::setScriptsLocation(const QString& scriptsLocation) { |
| 3761 | − SettingHandles::scriptsLocation.set(scriptsLocation); | |
| 3753 | + _scriptsLocationHandle.set(scriptsLocation); | |
| 3762 | 3754 | emit scriptLocationChanged(scriptsLocation); |
| 3763 | 3755 | } |
| 3764 | 3756 | |