mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-21 09:09:43 +00:00
pass on user settings updates to potentially interested parties within a scene subview
This commit is contained in:
parent
39b7340580
commit
b2cb5f0374
8 changed files with 39 additions and 3 deletions
|
@ -16,3 +16,8 @@ void CSVRender::EditMode::activate (CSVWidget::SceneToolbar *toolbar)
|
|||
{
|
||||
mWorldspaceWidget->setInteractionMask (mMask);
|
||||
}
|
||||
|
||||
void CSVRender::EditMode::updateUserSetting (const QString& name, const QStringList& value)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@ namespace CSVRender
|
|||
unsigned int getInteractionMask() const;
|
||||
|
||||
virtual void activate (CSVWidget::SceneToolbar *toolbar);
|
||||
|
||||
/// Default-implementation: Do nothing.
|
||||
virtual void updateUserSetting (const QString& name, const QStringList& value);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -254,6 +254,11 @@ unsigned int CSVRender::WorldspaceWidget::getInteractionMask() const
|
|||
return mInteractionMask & getVisibilityMask();
|
||||
}
|
||||
|
||||
void CSVRender::WorldspaceWidget::updateUserSetting (const QString& name, const QStringList& value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CSVRender::WorldspaceWidget::addVisibilitySelectorButtons (
|
||||
CSVWidget::SceneToolToggle2 *tool)
|
||||
{
|
||||
|
|
|
@ -93,6 +93,8 @@ namespace CSVRender
|
|||
/// marked for interaction.
|
||||
unsigned int getInteractionMask() const;
|
||||
|
||||
virtual void updateUserSetting (const QString& name, const QStringList& value);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void addVisibilitySelectorButtons (CSVWidget::SceneToolToggle2 *tool);
|
||||
|
|
|
@ -71,6 +71,11 @@ void CSVWidget::SceneToolMode::addButton (ModeButton *button, const std::string&
|
|||
}
|
||||
}
|
||||
|
||||
CSVWidget::ModeButton *CSVWidget::SceneToolMode::getCurrent()
|
||||
{
|
||||
return mCurrent;
|
||||
}
|
||||
|
||||
void CSVWidget::SceneToolMode::selected()
|
||||
{
|
||||
std::map<ModeButton *, std::string>::const_iterator iter =
|
||||
|
|
|
@ -41,6 +41,9 @@ namespace CSVWidget
|
|||
/// The ownership of \a button is transferred to *this.
|
||||
void addButton (ModeButton *button, const std::string& id);
|
||||
|
||||
/// Will return a 0-pointer only if the mode does not have any buttons yet.
|
||||
ModeButton *getCurrent();
|
||||
|
||||
signals:
|
||||
|
||||
void modeChanged (const std::string& id);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include "../render/pagedworldspacewidget.hpp"
|
||||
#include "../render/unpagedworldspacewidget.hpp"
|
||||
#include "../render/editmode.hpp"
|
||||
|
||||
#include "../widget/scenetoolbar.hpp"
|
||||
#include "../widget/scenetoolmode.hpp"
|
||||
|
@ -26,7 +27,8 @@
|
|||
#include "creator.hpp"
|
||||
|
||||
CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
||||
: SubView (id), mScene(NULL), mLayout(new QHBoxLayout), mDocument(document), mToolbar(NULL)
|
||||
: SubView (id), mScene(NULL), mLayout(new QHBoxLayout), mDocument(document), mToolbar(NULL),
|
||||
mEditMode (0)
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
|
||||
|
@ -121,8 +123,8 @@ CSVWidget::SceneToolbar* CSVWorld::SceneSubView::makeToolbar (CSVRender::Worldsp
|
|||
CSVWidget::SceneToolRun *runTool = widget->makeRunTool (toolbar);
|
||||
toolbar->addTool (runTool);
|
||||
|
||||
CSVWidget::SceneToolMode *editModeTool = widget->makeEditModeSelector (toolbar);
|
||||
toolbar->addTool (editModeTool);
|
||||
mEditMode = widget->makeEditModeSelector (toolbar);
|
||||
toolbar->addTool (mEditMode);
|
||||
|
||||
return toolbar;
|
||||
}
|
||||
|
@ -147,6 +149,13 @@ std::string CSVWorld::SceneSubView::getTitle() const
|
|||
return mTitle;
|
||||
}
|
||||
|
||||
void CSVWorld::SceneSubView::updateUserSetting (const QString& name, const QStringList& value)
|
||||
{
|
||||
mScene->updateUserSetting (name, value);
|
||||
dynamic_cast<CSVRender::EditMode&> (*mEditMode->getCurrent()).updateUserSetting (name, value);
|
||||
CSVDoc::SubView::updateUserSetting (name, value);
|
||||
}
|
||||
|
||||
void CSVWorld::SceneSubView::cellSelectionChanged (const CSMWorld::UniversalId& id)
|
||||
{
|
||||
setUniversalId(id);
|
||||
|
|
|
@ -27,6 +27,7 @@ namespace CSVRender
|
|||
namespace CSVWidget
|
||||
{
|
||||
class SceneToolbar;
|
||||
class SceneToolMode;
|
||||
}
|
||||
|
||||
namespace CSVWorld
|
||||
|
@ -45,6 +46,7 @@ namespace CSVWorld
|
|||
CSMDoc::Document& mDocument;
|
||||
CSVWidget::SceneToolbar* mToolbar;
|
||||
std::string mTitle;
|
||||
CSVWidget::SceneToolMode *mEditMode;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -58,6 +60,8 @@ namespace CSVWorld
|
|||
|
||||
virtual std::string getTitle() const;
|
||||
|
||||
virtual void updateUserSetting (const QString& name, const QStringList& value);
|
||||
|
||||
private:
|
||||
|
||||
void makeConnections(CSVRender::PagedWorldspaceWidget* widget);
|
||||
|
|
Loading…
Reference in a new issue