From 8a0ff17c22891c036b92a484ce493bd4825169af Mon Sep 17 00:00:00 2001 From: cc9cii Date: Sun, 28 Sep 2014 14:08:14 +1000 Subject: [PATCH] Update SceneWidget when relevant user settings change. --- apps/opencs/view/render/scenewidget.cpp | 6 ++++++ apps/opencs/view/render/scenewidget.hpp | 4 ++++ apps/opencs/view/world/scenesubview.cpp | 9 ++++++++- apps/opencs/view/world/scenesubview.hpp | 8 ++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/apps/opencs/view/render/scenewidget.cpp b/apps/opencs/view/render/scenewidget.cpp index cdf55a9eb..1b0b578f6 100644 --- a/apps/opencs/view/render/scenewidget.cpp +++ b/apps/opencs/view/render/scenewidget.cpp @@ -397,4 +397,10 @@ namespace CSVRender else if (mode=="bright") setLighting (&mLightingBright); } + + void SceneWidget::updateUserSetting (const QString &key, const QStringList &list) + { + if(key.contains(QRegExp("^\\b(Objects|Shader|Scene)", Qt::CaseInsensitive))) + flagAsModified(); + } } diff --git a/apps/opencs/view/render/scenewidget.hpp b/apps/opencs/view/render/scenewidget.hpp index 9f79aee17..f28504c2d 100644 --- a/apps/opencs/view/render/scenewidget.hpp +++ b/apps/opencs/view/render/scenewidget.hpp @@ -110,6 +110,10 @@ namespace CSVRender LightingNight mLightingNight; LightingBright mLightingBright; + public slots: + + void updateUserSetting (const QString &key, const QStringList &list); + private slots: void update(); diff --git a/apps/opencs/view/world/scenesubview.cpp b/apps/opencs/view/world/scenesubview.cpp index 52bd47b54..d10eebb30 100644 --- a/apps/opencs/view/world/scenesubview.cpp +++ b/apps/opencs/view/world/scenesubview.cpp @@ -247,6 +247,8 @@ void CSVWorld::SceneSubView::replaceToolbarAndWorldspace (CSVRender::WorldspaceW mToolbar = toolbar; connect (mScene, SIGNAL (focusToolbarRequest()), mToolbar, SLOT (setFocus())); + connect (this, SIGNAL (updateSceneUserSetting(const QString &, const QStringList &)), + mScene, SLOT (updateUserSetting(const QString &, const QStringList &))); connect (mToolbar, SIGNAL (focusSceneRequest()), mScene, SLOT (setFocus())); mLayout->addWidget (mToolbar, 0); @@ -254,4 +256,9 @@ void CSVWorld::SceneSubView::replaceToolbarAndWorldspace (CSVRender::WorldspaceW mScene->selectDefaultNavigationMode(); setFocusProxy (mScene); -} \ No newline at end of file +} + +void CSVWorld::SceneSubView::updateUserSetting (const QString &key, const QStringList &list) +{ + emit updateSceneUserSetting(key, list); +} diff --git a/apps/opencs/view/world/scenesubview.hpp b/apps/opencs/view/world/scenesubview.hpp index b9dcdd6a3..c0905f0d6 100644 --- a/apps/opencs/view/world/scenesubview.hpp +++ b/apps/opencs/view/world/scenesubview.hpp @@ -82,6 +82,14 @@ namespace CSVWorld void cellSelectionChanged (const CSMWorld::UniversalId& id); void handleDrop(const std::vector& data); + + public slots: + + void updateUserSetting (const QString &, const QStringList &); + + signals: + + void updateSceneUserSetting (const QString &, const QStringList &); }; }