forked from teamnwah/openmw-tes3coop
moved navigation into the WorldspaceWidget
This commit is contained in:
parent
a264e86e13
commit
7386d3eb0b
5 changed files with 65 additions and 34 deletions
apps/opencs/view
|
@ -25,6 +25,8 @@ namespace CSVRender
|
||||||
|
|
||||||
QPaintEngine* paintEngine() const;
|
QPaintEngine* paintEngine() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
void setNavigation (Navigation *navigation);
|
void setNavigation (Navigation *navigation);
|
||||||
///< \attention The ownership of \a navigation is not transferred to *this.
|
///< \attention The ownership of \a navigation is not transferred to *this.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,38 @@
|
||||||
|
|
||||||
#include "worldspacewidget.hpp"
|
#include "worldspacewidget.hpp"
|
||||||
|
|
||||||
|
#include "../world/scenetoolmode.hpp"
|
||||||
|
|
||||||
CSVRender::WorldspaceWidget::WorldspaceWidget (QWidget *parent)
|
CSVRender::WorldspaceWidget::WorldspaceWidget (QWidget *parent)
|
||||||
: SceneWidget (parent)
|
: SceneWidget (parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
void CSVRender::WorldspaceWidget::selectNavigationMode (const std::string& mode)
|
||||||
|
{
|
||||||
|
if (mode=="1st")
|
||||||
|
setNavigation (&m1st);
|
||||||
|
else if (mode=="free")
|
||||||
|
setNavigation (&mFree);
|
||||||
|
else if (mode=="orbit")
|
||||||
|
setNavigation (&mOrbit);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVRender::WorldspaceWidget::selectDefaultNavigationMode()
|
||||||
|
{
|
||||||
|
setNavigation (&m1st);
|
||||||
|
}
|
||||||
|
|
||||||
|
CSVWorld::SceneToolMode *CSVRender::WorldspaceWidget::makeNavigationSelector (
|
||||||
|
CSVWorld::SceneToolbar *parent)
|
||||||
|
{
|
||||||
|
CSVWorld::SceneToolMode *tool = new CSVWorld::SceneToolMode (parent);
|
||||||
|
|
||||||
|
tool->addButton (":door.png", "1st"); /// \todo replace icons
|
||||||
|
tool->addButton (":GMST.png", "free");
|
||||||
|
tool->addButton (":Info.png", "orbit");
|
||||||
|
|
||||||
|
connect (tool, SIGNAL (modeChanged (const std::string&)),
|
||||||
|
this, SLOT (selectNavigationMode (const std::string&)));
|
||||||
|
|
||||||
|
return tool;
|
||||||
|
}
|
|
@ -3,15 +3,39 @@
|
||||||
|
|
||||||
#include "scenewidget.hpp"
|
#include "scenewidget.hpp"
|
||||||
|
|
||||||
|
#include "navigation1st.hpp"
|
||||||
|
#include "navigationfree.hpp"
|
||||||
|
#include "navigationorbit.hpp"
|
||||||
|
|
||||||
|
namespace CSVWorld
|
||||||
|
{
|
||||||
|
class SceneToolMode;
|
||||||
|
class SceneToolbar;
|
||||||
|
}
|
||||||
|
|
||||||
namespace CSVRender
|
namespace CSVRender
|
||||||
{
|
{
|
||||||
class WorldspaceWidget : public SceneWidget
|
class WorldspaceWidget : public SceneWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
CSVRender::Navigation1st m1st;
|
||||||
|
CSVRender::NavigationFree mFree;
|
||||||
|
CSVRender::NavigationOrbit mOrbit;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
WorldspaceWidget (QWidget *parent = 0);
|
WorldspaceWidget (QWidget *parent = 0);
|
||||||
|
|
||||||
|
CSVWorld::SceneToolMode *makeNavigationSelector (CSVWorld::SceneToolbar *parent);
|
||||||
|
///< \important The created tool is not added to the toolbar (via addTool). Doing that
|
||||||
|
/// is the responsibility of the calling function.
|
||||||
|
|
||||||
|
void selectDefaultNavigationMode();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
void selectNavigationMode (const std::string& mode);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,19 +33,13 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
||||||
|
|
||||||
SceneToolbar *toolbar = new SceneToolbar (48, this);
|
SceneToolbar *toolbar = new SceneToolbar (48, this);
|
||||||
|
|
||||||
// navigation mode
|
mScene = new CSVRender::WorldspaceWidget (this);
|
||||||
SceneToolMode *tool = new SceneToolMode (toolbar);
|
|
||||||
tool->addButton (":door.png", "1st"); /// \todo replace icons
|
SceneToolMode *tool = mScene->makeNavigationSelector (toolbar);
|
||||||
tool->addButton (":GMST.png", "free");
|
|
||||||
tool->addButton (":Info.png", "orbit");
|
|
||||||
toolbar->addTool (tool);
|
toolbar->addTool (tool);
|
||||||
connect (tool, SIGNAL (modeChanged (const std::string&)),
|
|
||||||
this, SLOT (selectNavigationMode (const std::string&)));
|
|
||||||
|
|
||||||
layout2->addWidget (toolbar, 0);
|
layout2->addWidget (toolbar, 0);
|
||||||
|
|
||||||
mScene = new CSVRender::WorldspaceWidget (this);
|
|
||||||
|
|
||||||
layout2->addWidget (mScene, 1);
|
layout2->addWidget (mScene, 1);
|
||||||
|
|
||||||
layout->insertLayout (0, layout2, 1);
|
layout->insertLayout (0, layout2, 1);
|
||||||
|
@ -60,7 +54,7 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
||||||
|
|
||||||
setWidget (widget);
|
setWidget (widget);
|
||||||
|
|
||||||
mScene->setNavigation (&m1st);
|
mScene->selectDefaultNavigationMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::SceneSubView::setEditLock (bool locked)
|
void CSVWorld::SceneSubView::setEditLock (bool locked)
|
||||||
|
@ -79,13 +73,3 @@ void CSVWorld::SceneSubView::setStatusBar (bool show)
|
||||||
{
|
{
|
||||||
mBottom->setStatusBar (show);
|
mBottom->setStatusBar (show);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::SceneSubView::selectNavigationMode (const std::string& mode)
|
|
||||||
{
|
|
||||||
if (mode=="1st")
|
|
||||||
mScene->setNavigation (&m1st);
|
|
||||||
else if (mode=="free")
|
|
||||||
mScene->setNavigation (&mFree);
|
|
||||||
else if (mode=="orbit")
|
|
||||||
mScene->setNavigation (&mOrbit);
|
|
||||||
}
|
|
||||||
|
|
|
@ -3,10 +3,6 @@
|
||||||
|
|
||||||
#include "../doc/subview.hpp"
|
#include "../doc/subview.hpp"
|
||||||
|
|
||||||
#include "../render/navigation1st.hpp"
|
|
||||||
#include "../render/navigationfree.hpp"
|
|
||||||
#include "../render/navigationorbit.hpp"
|
|
||||||
|
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
|
|
||||||
namespace CSMDoc
|
namespace CSMDoc
|
||||||
|
@ -16,7 +12,7 @@ namespace CSMDoc
|
||||||
|
|
||||||
namespace CSVRender
|
namespace CSVRender
|
||||||
{
|
{
|
||||||
class SceneWidget;
|
class WorldspaceWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CSVWorld
|
namespace CSVWorld
|
||||||
|
@ -30,10 +26,7 @@ namespace CSVWorld
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
TableBottomBox *mBottom;
|
TableBottomBox *mBottom;
|
||||||
CSVRender::SceneWidget *mScene;
|
CSVRender::WorldspaceWidget *mScene;
|
||||||
CSVRender::Navigation1st m1st;
|
|
||||||
CSVRender::NavigationFree mFree;
|
|
||||||
CSVRender::NavigationOrbit mOrbit;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -44,10 +37,6 @@ namespace CSVWorld
|
||||||
virtual void updateEditorSetting (const QString& key, const QString& value);
|
virtual void updateEditorSetting (const QString& key, const QString& value);
|
||||||
|
|
||||||
virtual void setStatusBar (bool show);
|
virtual void setStatusBar (bool show);
|
||||||
|
|
||||||
private slots:
|
|
||||||
|
|
||||||
void selectNavigationMode (const std::string& mode);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue