mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-19 15:09:43 +00:00
basic sub view system (very incomplete)
This commit is contained in:
parent
4c0dcd46a1
commit
eece4226c0
5 changed files with 89 additions and 2 deletions
|
@ -7,6 +7,8 @@ set (OPENCS_SRC
|
|||
model/world/universalid.cpp
|
||||
|
||||
view/doc/viewmanager.cpp view/doc/view.cpp view/doc/operations.cpp view/doc/operation.cpp
|
||||
|
||||
view/world/subview.cpp
|
||||
)
|
||||
|
||||
set (OPENCS_HDR
|
||||
|
@ -17,6 +19,8 @@ set (OPENCS_HDR
|
|||
model/world/universalid.hpp
|
||||
|
||||
view/doc/viewmanager.hpp view/doc/view.hpp view/doc/operations.hpp view/doc/operation.hpp
|
||||
|
||||
view/world/subview.hpp
|
||||
)
|
||||
|
||||
set (OPENCS_US
|
||||
|
|
|
@ -5,9 +5,12 @@
|
|||
|
||||
#include <QCloseEvent>
|
||||
#include <QMenuBar>
|
||||
#include <QMdiArea>
|
||||
|
||||
#include "../../model/doc/document.hpp"
|
||||
|
||||
#include "../world/subview.hpp"
|
||||
|
||||
#include "viewmanager.hpp"
|
||||
#include "operations.hpp"
|
||||
|
||||
|
@ -56,6 +59,10 @@ void CSVDoc::View::setupViewMenu()
|
|||
QAction *newWindow = new QAction (tr ("&New View"), this);
|
||||
connect (newWindow, SIGNAL (triggered()), this, SLOT (newView()));
|
||||
view->addAction (newWindow);
|
||||
|
||||
QAction *test = new QAction (tr ("Add test Subview"), this);
|
||||
connect (test, SIGNAL (triggered()), this, SLOT (addTestSubView()));
|
||||
view->addAction (test);
|
||||
}
|
||||
|
||||
void CSVDoc::View::setupWorldMenu()
|
||||
|
@ -107,8 +114,9 @@ void CSVDoc::View::updateActions()
|
|||
CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews)
|
||||
: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1), mViewTotal (totalViews)
|
||||
{
|
||||
setCentralWidget (new QWidget);
|
||||
resize (200, 200); /// \todo get default size from settings and set reasonable minimal size
|
||||
setDockOptions (QMainWindow::AllowNestedDocks);
|
||||
|
||||
resize (300, 300); /// \todo get default size from settings and set reasonable minimal size
|
||||
|
||||
mOperations = new Operations;
|
||||
addDockWidget (Qt::BottomDockWidgetArea, mOperations);
|
||||
|
@ -158,6 +166,21 @@ void CSVDoc::View::updateProgress (int current, int max, int type, int threads)
|
|||
mOperations->setProgress (current, max, type, threads);
|
||||
}
|
||||
|
||||
void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id)
|
||||
{
|
||||
/// \todo add an user setting for limiting the number of sub views per top level view. Automatically open a new top level view if this
|
||||
/// number is exceeded
|
||||
|
||||
/// \todo if the sub view limit setting is one, the sub view title bar should be hidden and the text in the main title bar adjusted
|
||||
/// accordingly
|
||||
|
||||
/// \todo add an user setting to reuse sub views (on a per document basis or on a per top level view basis)
|
||||
|
||||
CSVWorld::SubView *view = new CSVWorld::SubView (id);
|
||||
addDockWidget (Qt::RightDockWidgetArea, view);
|
||||
view->show();
|
||||
}
|
||||
|
||||
void CSVDoc::View::newView()
|
||||
{
|
||||
mViewManager.addView (mDocument);
|
||||
|
@ -176,4 +199,9 @@ void CSVDoc::View::save()
|
|||
void CSVDoc::View::verify()
|
||||
{
|
||||
mDocument->verify();
|
||||
}
|
||||
|
||||
void CSVDoc::View::addTestSubView()
|
||||
{
|
||||
addSubView (CSMWorld::UniversalId::Type_None);
|
||||
}
|
|
@ -12,6 +12,11 @@ namespace CSMDoc
|
|||
class Document;
|
||||
}
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
class UniversalId;
|
||||
}
|
||||
|
||||
namespace CSVDoc
|
||||
{
|
||||
class ViewManager;
|
||||
|
@ -69,6 +74,8 @@ namespace CSVDoc
|
|||
|
||||
void updateProgress (int current, int max, int type, int threads);
|
||||
|
||||
void addSubView (const CSMWorld::UniversalId& id);
|
||||
|
||||
signals:
|
||||
|
||||
void newDocumentRequest();
|
||||
|
@ -82,6 +89,8 @@ namespace CSVDoc
|
|||
void save();
|
||||
|
||||
void verify();
|
||||
|
||||
void addTestSubView(); ///< \todo remove
|
||||
};
|
||||
}
|
||||
|
||||
|
|
18
apps/opencs/view/world/subview.cpp
Normal file
18
apps/opencs/view/world/subview.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
#include "subview.hpp"
|
||||
|
||||
CSVWorld::SubView::SubView (const CSMWorld::UniversalId& id) : mUniversalId (id)
|
||||
{
|
||||
/// \todo add a button to the title bar that clones this sub view
|
||||
|
||||
setWindowTitle (mUniversalId.toString().c_str());
|
||||
|
||||
/// \todo remove (for testing only)
|
||||
setMinimumWidth (100);
|
||||
setMinimumHeight (60);
|
||||
}
|
||||
|
||||
CSMWorld::UniversalId CSVWorld::SubView::getUniversalId() const
|
||||
{
|
||||
return mUniversalId;
|
||||
}
|
28
apps/opencs/view/world/subview.hpp
Normal file
28
apps/opencs/view/world/subview.hpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#ifndef CSV_WORLD_SUBVIEW_H
|
||||
#define CSV_WORLD_SUBVIEW_H
|
||||
|
||||
#include "../../model/world/universalid.hpp"
|
||||
|
||||
#include <QDockWidget>
|
||||
|
||||
namespace CSVWorld
|
||||
{
|
||||
class SubView : public QDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
CSMWorld::UniversalId mUniversalId;
|
||||
|
||||
// not implemented
|
||||
SubView (const SubView&);
|
||||
SubView& operator= (SubView&);
|
||||
|
||||
public:
|
||||
|
||||
SubView (const CSMWorld::UniversalId& id);
|
||||
|
||||
CSMWorld::UniversalId getUniversalId() const;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue