From e38d8f7afd7a372967da765e7329d2470d171d03 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 26 Aug 2014 07:47:22 -0700 Subject: [PATCH] Update all locations that update settings to call bumpSettings() --- interface/src/Application.cpp | 1 + interface/src/Menu.cpp | 16 +++++++++++++- interface/src/Menu.h | 29 +++++++++++++------------- interface/src/ui/PreferencesDialog.cpp | 3 ++- interface/src/ui/RearMirrorTools.cpp | 2 ++ 5 files changed, 35 insertions(+), 16 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 8421ee05b1..323dd85822 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3931,6 +3931,7 @@ void Application::setPreviousScriptLocation(const QString& previousScriptLocatio _previousScriptLocation = previousScriptLocation; QMutexLocker locker(&_settingsMutex); _settings->setValue("LastScriptLocation", _previousScriptLocation); + bumpSettings(); } void Application::loadDialog() { diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 2e2c10458d..a331d9b595 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -718,6 +718,9 @@ void Menu::loadSettings(QSettings* settings) { Application::getInstance()->updateWindowTitle(); NodeList::getInstance()->loadData(settings); + // notify that a settings has changed + connect(&NodeList::getInstance()->getDomainHandler(), &DomainHandler::hostnameChanged, this, &Menu::bumpSettings); + // MyAvatar caches some menu options, so we have to update them whenever we load settings. // TODO: cache more settings in MyAvatar that are checked with very high frequency. MyAvatar* myAvatar = Application::getInstance()->getAvatar(); @@ -880,6 +883,8 @@ void Menu::handleViewFrustumOffsetKeyModifier(int key) { default: break; } + + bumpSettings(); } void Menu::addDisabledActionAndSeparator(QMenu* destinationMenu, const QString& actionName, int menuItemLocation) { @@ -986,7 +991,7 @@ QAction* Menu::addCheckableActionToQMenuAndActionHash(QMenu* destinationMenu, QAction::NoRole, menuItemLocation); action->setCheckable(true); action->setChecked(checked); - connect(action, SIGNAL(changed()), Application::getInstance(), SLOT(bumpSettings())); + connect(action, SIGNAL(changed()), this, SLOT(bumpSettings())); return action; } @@ -1028,6 +1033,10 @@ void Menu::aboutApp() { InfoView::forcedShow(); } +void Menu::bumpSettings() { + Application::getInstance()->bumpSettings(); +} + void sendFakeEnterEvent() { QPoint lastCursorPosition = QCursor::pos(); QGLWidget* glWidget = Application::getInstance()->getGLWidget(); @@ -1089,6 +1098,8 @@ void Menu::changePrivateKey() { // pull the private key from the dialog _walletPrivateKey = privateKeyDialog.textValue().toUtf8(); } + + bumpSettings(); sendFakeEnterEvent(); } @@ -1611,10 +1622,12 @@ void Menu::resetLODAdjust() { void Menu::setVoxelSizeScale(float sizeScale) { _voxelSizeScale = sizeScale; + bumpSettings(); } void Menu::setBoundaryLevelAdjust(int boundaryLevelAdjust) { _boundaryLevelAdjust = boundaryLevelAdjust; + bumpSettings(); } void Menu::lodTools() { @@ -1904,5 +1917,6 @@ QString Menu::getSnapshotsLocation() const { void Menu::setScriptsLocation(const QString& scriptsLocation) { _scriptsLocation = scriptsLocation; + bumpSettings(); emit scriptLocationChanged(scriptsLocation); } diff --git a/interface/src/Menu.h b/interface/src/Menu.h index efc812fb22..4a6551a6f3 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -90,24 +90,24 @@ public: QAction* getActionForOption(const QString& menuOption); float getAudioJitterBufferFrames() const { return _audioJitterBufferFrames; } - void setAudioJitterBufferFrames(float audioJitterBufferSamples) { _audioJitterBufferFrames = audioJitterBufferSamples; } + void setAudioJitterBufferFrames(float audioJitterBufferSamples) { _audioJitterBufferFrames = audioJitterBufferSamples; bumpSettings(); } int getMaxFramesOverDesired() const { return _maxFramesOverDesired; } - void setMaxFramesOverDesired(int maxFramesOverDesired) { _maxFramesOverDesired = maxFramesOverDesired; } + void setMaxFramesOverDesired(int maxFramesOverDesired) { _maxFramesOverDesired = maxFramesOverDesired; bumpSettings(); } float getFieldOfView() const { return _fieldOfView; } - void setFieldOfView(float fieldOfView) { _fieldOfView = fieldOfView; } + void setFieldOfView(float fieldOfView) { _fieldOfView = fieldOfView; bumpSettings(); } float getRealWorldFieldOfView() const { return _realWorldFieldOfView; } - void setRealWorldFieldOfView(float realWorldFieldOfView) { _realWorldFieldOfView = realWorldFieldOfView; } + void setRealWorldFieldOfView(float realWorldFieldOfView) { _realWorldFieldOfView = realWorldFieldOfView; bumpSettings(); } float getOculusUIAngularSize() const { return _oculusUIAngularSize; } - void setOculusUIAngularSize(float oculusUIAngularSize) { _oculusUIAngularSize = oculusUIAngularSize; } + void setOculusUIAngularSize(float oculusUIAngularSize) { _oculusUIAngularSize = oculusUIAngularSize; bumpSettings(); } float getSixenseReticleMoveSpeed() const { return _sixenseReticleMoveSpeed; } - void setSixenseReticleMoveSpeed(float sixenseReticleMoveSpeed) { _sixenseReticleMoveSpeed = sixenseReticleMoveSpeed; } + void setSixenseReticleMoveSpeed(float sixenseReticleMoveSpeed) { _sixenseReticleMoveSpeed = sixenseReticleMoveSpeed; bumpSettings(); } bool getInvertSixenseButtons() const { return _invertSixenseButtons; } - void setInvertSixenseButtons(bool invertSixenseButtons) { _invertSixenseButtons = invertSixenseButtons; } + void setInvertSixenseButtons(bool invertSixenseButtons) { _invertSixenseButtons = invertSixenseButtons; bumpSettings(); } float getFaceshiftEyeDeflection() const { return _faceshiftEyeDeflection; } - void setFaceshiftEyeDeflection(float faceshiftEyeDeflection) { _faceshiftEyeDeflection = faceshiftEyeDeflection; } + void setFaceshiftEyeDeflection(float faceshiftEyeDeflection) { _faceshiftEyeDeflection = faceshiftEyeDeflection; bumpSettings(); } QString getSnapshotsLocation() const; - void setSnapshotsLocation(QString snapshotsLocation) { _snapshotsLocation = snapshotsLocation; } + void setSnapshotsLocation(QString snapshotsLocation) { _snapshotsLocation = snapshotsLocation; bumpSettings(); } const QString& getScriptsLocation() const { return _scriptsLocation; } void setScriptsLocation(const QString& scriptsLocation); @@ -130,13 +130,13 @@ public: void resetLODAdjust(); void setVoxelSizeScale(float sizeScale); float getVoxelSizeScale() const { return _voxelSizeScale; } - void setAutomaticAvatarLOD(bool automaticAvatarLOD) { _automaticAvatarLOD = automaticAvatarLOD; } + void setAutomaticAvatarLOD(bool automaticAvatarLOD) { _automaticAvatarLOD = automaticAvatarLOD; bumpSettings(); } bool getAutomaticAvatarLOD() const { return _automaticAvatarLOD; } - void setAvatarLODDecreaseFPS(float avatarLODDecreaseFPS) { _avatarLODDecreaseFPS = avatarLODDecreaseFPS; } + void setAvatarLODDecreaseFPS(float avatarLODDecreaseFPS) { _avatarLODDecreaseFPS = avatarLODDecreaseFPS; bumpSettings(); } float getAvatarLODDecreaseFPS() const { return _avatarLODDecreaseFPS; } - void setAvatarLODIncreaseFPS(float avatarLODIncreaseFPS) { _avatarLODIncreaseFPS = avatarLODIncreaseFPS; } + void setAvatarLODIncreaseFPS(float avatarLODIncreaseFPS) { _avatarLODIncreaseFPS = avatarLODIncreaseFPS; bumpSettings(); } float getAvatarLODIncreaseFPS() const { return _avatarLODIncreaseFPS; } - void setAvatarLODDistanceMultiplier(float multiplier) { _avatarLODDistanceMultiplier = multiplier; } + void setAvatarLODDistanceMultiplier(float multiplier) { _avatarLODDistanceMultiplier = multiplier; bumpSettings(); } float getAvatarLODDistanceMultiplier() const { return _avatarLODDistanceMultiplier; } void setBoundaryLevelAdjust(int boundaryLevelAdjust); int getBoundaryLevelAdjust() const { return _boundaryLevelAdjust; } @@ -147,7 +147,7 @@ public: // User Tweakable PPS from Voxel Server int getMaxVoxelPacketsPerSecond() const { return _maxVoxelPacketsPerSecond; } - void setMaxVoxelPacketsPerSecond(int maxVoxelPacketsPerSecond) { _maxVoxelPacketsPerSecond = maxVoxelPacketsPerSecond; } + void setMaxVoxelPacketsPerSecond(int maxVoxelPacketsPerSecond) { _maxVoxelPacketsPerSecond = maxVoxelPacketsPerSecond; bumpSettings(); } QAction* addActionToQMenuAndActionHash(QMenu* destinationMenu, const QString& actionName, @@ -206,6 +206,7 @@ public slots: private slots: void aboutApp(); + void bumpSettings(); void editPreferences(); void editAttachments(); void editAnimations(); diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index 4ebd5f4c1a..1713209e87 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -203,7 +203,6 @@ void PreferencesDialog::savePreferences() { if (shouldDispatchIdentityPacket) { myAvatar->sendIdentityPacket(); - Application::getInstance()->bumpSettings(); } if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableActivityLogger) @@ -254,4 +253,6 @@ void PreferencesDialog::savePreferences() { Application::getInstance()->resizeGL(Application::getInstance()->getGLWidget()->width(), Application::getInstance()->getGLWidget()->height()); + + Application::getInstance()->bumpSettings(); } diff --git a/interface/src/ui/RearMirrorTools.cpp b/interface/src/ui/RearMirrorTools.cpp index 9620469a22..f4b0bb82b5 100644 --- a/interface/src/ui/RearMirrorTools.cpp +++ b/interface/src/ui/RearMirrorTools.cpp @@ -88,11 +88,13 @@ bool RearMirrorTools::mousePressEvent(int x, int y) { if (_headZoomIconRect.contains(x, y)) { _zoomLevel = HEAD; + Application::getInstance()->bumpSettings(); return true; } if (_bodyZoomIconRect.contains(x, y)) { _zoomLevel = BODY; + Application::getInstance()->bumpSettings(); return true; }