moved navigation into the WorldspaceWidget

actorid
Marc Zinnschlag 11 years ago
parent a264e86e13
commit 7386d3eb0b

@ -25,6 +25,8 @@ namespace CSVRender
QPaintEngine* paintEngine() const;
protected:
void setNavigation (Navigation *navigation);
///< \attention The ownership of \a navigation is not transferred to *this.

@ -1,6 +1,38 @@
#include "worldspacewidget.hpp"
#include "../world/scenetoolmode.hpp"
CSVRender::WorldspaceWidget::WorldspaceWidget (QWidget *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 "navigation1st.hpp"
#include "navigationfree.hpp"
#include "navigationorbit.hpp"
namespace CSVWorld
{
class SceneToolMode;
class SceneToolbar;
}
namespace CSVRender
{
class WorldspaceWidget : public SceneWidget
{
Q_OBJECT
CSVRender::Navigation1st m1st;
CSVRender::NavigationFree mFree;
CSVRender::NavigationOrbit mOrbit;
public:
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);
// navigation mode
SceneToolMode *tool = new SceneToolMode (toolbar);
tool->addButton (":door.png", "1st"); /// \todo replace icons
tool->addButton (":GMST.png", "free");
tool->addButton (":Info.png", "orbit");
mScene = new CSVRender::WorldspaceWidget (this);
SceneToolMode *tool = mScene->makeNavigationSelector (toolbar);
toolbar->addTool (tool);
connect (tool, SIGNAL (modeChanged (const std::string&)),
this, SLOT (selectNavigationMode (const std::string&)));
layout2->addWidget (toolbar, 0);
mScene = new CSVRender::WorldspaceWidget (this);
layout2->addWidget (mScene, 1);
layout->insertLayout (0, layout2, 1);
@ -60,7 +54,7 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::D
setWidget (widget);
mScene->setNavigation (&m1st);
mScene->selectDefaultNavigationMode();
}
void CSVWorld::SceneSubView::setEditLock (bool locked)
@ -79,13 +73,3 @@ void CSVWorld::SceneSubView::setStatusBar (bool 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 "../render/navigation1st.hpp"
#include "../render/navigationfree.hpp"
#include "../render/navigationorbit.hpp"
class QModelIndex;
namespace CSMDoc
@ -16,7 +12,7 @@ namespace CSMDoc
namespace CSVRender
{
class SceneWidget;
class WorldspaceWidget;
}
namespace CSVWorld
@ -30,10 +26,7 @@ namespace CSVWorld
Q_OBJECT
TableBottomBox *mBottom;
CSVRender::SceneWidget *mScene;
CSVRender::Navigation1st m1st;
CSVRender::NavigationFree mFree;
CSVRender::NavigationOrbit mOrbit;
CSVRender::WorldspaceWidget *mScene;
public:
@ -44,10 +37,6 @@ namespace CSVWorld
virtual void updateEditorSetting (const QString& key, const QString& value);
virtual void setStatusBar (bool show);
private slots:
void selectNavigationMode (const std::string& mode);
};
}

Loading…
Cancel
Save