mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-10-31 21:56:45 +00:00 
			
		
		
		
	replace paged with unpaged (and vice versa)
This commit is contained in:
		
							parent
							
								
									d00dbf47d5
								
							
						
					
					
						commit
						ea1aaef8ca
					
				
					 8 changed files with 115 additions and 29 deletions
				
			
		|  | @ -453,7 +453,7 @@ CSMWorld::IdCollection<CSMFilter::Filter>& CSMWorld::Data::getFilters() | |||
|     return mFilters; | ||||
| } | ||||
| 
 | ||||
| QAbstractItemModel *CSMWorld::Data::getTableModel (const UniversalId& id) | ||||
| QAbstractItemModel *CSMWorld::Data::getTableModel (const CSMWorld::UniversalId& id) | ||||
| { | ||||
|     std::map<UniversalId::Type, QAbstractItemModel *>::iterator iter = mModelIndex.find (id.getType()); | ||||
| 
 | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ | |||
| 
 | ||||
| #include <apps/opencs/model/world/tablemimedata.hpp> | ||||
| 
 | ||||
| CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget *parent, const CSMDoc::Document& document) | ||||
| CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget* parent, CSMDoc::Document& document) | ||||
| : WorldspaceWidget (document, parent) | ||||
| {} | ||||
| 
 | ||||
|  | @ -56,10 +56,9 @@ void CSVRender::PagedWorldspaceWidget::dropEvent (QDropEvent* event) | |||
| 
 | ||||
|     if (mime->fromDocument(mDocument)) | ||||
|     { | ||||
|         const std::vector<CSMWorld::UniversalId> data(mime->getData()); | ||||
|         const std::vector<CSMWorld::UniversalId>& data(mime->getData()); | ||||
|         CSVRender::WorldspaceWidget::dropType whatHappend = getDropType(data); | ||||
| 
 | ||||
|         std::cout<<whatHappend<<std::endl; | ||||
|         switch (whatHappend) | ||||
|         { | ||||
|             case CSVRender::WorldspaceWidget::cellsExterior: | ||||
|  |  | |||
|  | @ -19,19 +19,19 @@ namespace CSVRender | |||
| 
 | ||||
|             std::pair<int, int> getCoordinatesFromId(const std::string& record) const; | ||||
| 
 | ||||
|             void handleDrop(const std::vector<CSMWorld::UniversalId>& data); | ||||
| 
 | ||||
|         public: | ||||
| 
 | ||||
|             PagedWorldspaceWidget (QWidget *parent, const CSMDoc::Document& document); | ||||
|             PagedWorldspaceWidget (QWidget *parent, CSMDoc::Document& document); | ||||
|             ///< \note Sets the cell area selection to an invalid value to indicate that currently
 | ||||
|             /// no cells are displayed. The cells to be displayed will be specified later through
 | ||||
|             /// hint system.
 | ||||
| 
 | ||||
|             virtual void useViewHint (const std::string& hint); | ||||
|             void useViewHint (const std::string& hint); | ||||
| 
 | ||||
|             void setCellSelection (const CSMWorld::CellSelection& selection); | ||||
| 
 | ||||
|             virtual void handleDrop(const std::vector<CSMWorld::UniversalId>& data); | ||||
| 
 | ||||
|         signals: | ||||
| 
 | ||||
|             void cellSelectionChanged (const CSMWorld::CellSelection& selection); | ||||
|  |  | |||
|  | @ -36,7 +36,7 @@ namespace CSVRender | |||
|             SceneWidget(QWidget *parent); | ||||
|             virtual ~SceneWidget(); | ||||
| 
 | ||||
|             QPaintEngine*	paintEngine() const; | ||||
|             QPaintEngine* paintEngine() const; | ||||
| 
 | ||||
|             CSVWorld::SceneToolMode *makeLightingSelector (CSVWorld::SceneToolbar *parent); | ||||
|             ///< \attention The created tool is not added to the toolbar (via addTool). Doing that
 | ||||
|  |  | |||
|  | @ -23,8 +23,7 @@ void CSVRender::UnpagedWorldspaceWidget::update() | |||
|     /// \todo deal with mSunlight and mFog/mForDensity
 | ||||
| } | ||||
| 
 | ||||
| CSVRender::UnpagedWorldspaceWidget::UnpagedWorldspaceWidget (const std::string& cellId, | ||||
|     CSMDoc::Document& document, QWidget *parent) | ||||
| CSVRender::UnpagedWorldspaceWidget::UnpagedWorldspaceWidget (const std::string& cellId, CSMDoc::Document& document, QWidget* parent) | ||||
| : WorldspaceWidget (document, parent), mCellId (cellId) | ||||
| { | ||||
|     mCellsModel = &dynamic_cast<CSMWorld::IdTable&> ( | ||||
|  | @ -74,7 +73,7 @@ void CSVRender::UnpagedWorldspaceWidget::dropEvent (QDropEvent* event) | |||
| 
 | ||||
|     if (mime->fromDocument (mDocument)) | ||||
|     { | ||||
|         const std::vector<CSMWorld::UniversalId> data (mime->getData()); | ||||
|         const std::vector<CSMWorld::UniversalId>& data (mime->getData()); | ||||
|         CSVRender::WorldspaceWidget::dropType whatHappend = getDropType (data); | ||||
| 
 | ||||
|         switch (whatHappend) | ||||
|  | @ -96,5 +95,6 @@ void CSVRender::UnpagedWorldspaceWidget::dropEvent (QDropEvent* event) | |||
| 
 | ||||
| void CSVRender::UnpagedWorldspaceWidget::handleDrop (const std::vector< CSMWorld::UniversalId >& data) | ||||
| { | ||||
| 
 | ||||
|     mCellId = data.begin()->getId(); | ||||
|     update(); | ||||
| } | ||||
|  |  | |||
|  | @ -33,6 +33,7 @@ namespace CSVRender | |||
|             UnpagedWorldspaceWidget (const std::string& cellId, CSMDoc::Document& document, | ||||
|                 QWidget *parent); | ||||
| 
 | ||||
| 
 | ||||
|         private: | ||||
| 
 | ||||
|             void handleDrop(const std::vector<CSMWorld::UniversalId>& data); | ||||
|  |  | |||
|  | @ -18,11 +18,10 @@ | |||
| 
 | ||||
| #include "tablebottombox.hpp" | ||||
| #include "creator.hpp" | ||||
| #include "scenetoolbar.hpp" | ||||
| #include "scenetoolmode.hpp" | ||||
| 
 | ||||
| CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document) | ||||
| : SubView (id) | ||||
| : SubView (id), mLayout(new QHBoxLayout), mDocument(document) | ||||
| { | ||||
|     QVBoxLayout *layout = new QVBoxLayout; | ||||
| 
 | ||||
|  | @ -32,33 +31,43 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::D | |||
|         new TableBottomBox (NullCreatorFactory(), document.getData(), document.getUndoStack(), id, | ||||
|         this), 0); | ||||
| 
 | ||||
|     QHBoxLayout *layout2 = new QHBoxLayout; | ||||
|     mLayout->setContentsMargins (QMargins (0, 0, 0, 0)); | ||||
| 
 | ||||
|     layout2->setContentsMargins (QMargins (0, 0, 0, 0)); | ||||
| 
 | ||||
|     SceneToolbar *toolbar = new SceneToolbar (48+6, this); | ||||
|     mToolbar = new SceneToolbar (48+6, this); | ||||
| 
 | ||||
|     if (id.getId()=="sys::default") | ||||
|     { | ||||
|         CSVRender::PagedWorldspaceWidget *widget = new CSVRender::PagedWorldspaceWidget (this, document); | ||||
| 
 | ||||
|         mScene = widget; | ||||
| 
 | ||||
|         connect (widget, SIGNAL (cellSelectionChanged (const CSMWorld::CellSelection&)), | ||||
|             this, SLOT (cellSelectionChanged (const CSMWorld::CellSelection&))); | ||||
|                  this, SLOT (cellSelectionChanged (const CSMWorld::CellSelection&))); | ||||
| 
 | ||||
|         connect (widget, SIGNAL(interiorCellsDropped (const std::vector<CSMWorld::UniversalId>&)), | ||||
|                  this, SLOT(changeToUnpaged (const std::vector<CSMWorld::UniversalId>&))); | ||||
|     } | ||||
|     else | ||||
|         mScene = new CSVRender::UnpagedWorldspaceWidget (id.getId(), document, this); | ||||
|     { | ||||
|         CSVRender::UnpagedWorldspaceWidget *widget = new CSVRender::UnpagedWorldspaceWidget (id.getId(), document, this); | ||||
| 
 | ||||
|     SceneToolMode *navigationTool = mScene->makeNavigationSelector (toolbar); | ||||
|     toolbar->addTool (navigationTool); | ||||
|         mScene = widget; | ||||
| 
 | ||||
|     SceneToolMode *lightingTool = mScene->makeLightingSelector (toolbar); | ||||
|     toolbar->addTool (lightingTool); | ||||
|         connect (widget, SIGNAL(exteriorCellsDropped(const std::vector<CSMWorld::UniversalId>&)), | ||||
|                  this, SLOT(changeToUnpaged(const std::vector<CSMWorld::UniversalId>&))); | ||||
|     } | ||||
| 
 | ||||
|     layout2->addWidget (toolbar, 0); | ||||
|     SceneToolMode *navigationTool = mScene->makeNavigationSelector (mToolbar); | ||||
|     mToolbar->addTool (navigationTool); | ||||
| 
 | ||||
|     layout2->addWidget (mScene, 1); | ||||
|     SceneToolMode *lightingTool = mScene->makeLightingSelector (mToolbar); | ||||
|     mToolbar->addTool (lightingTool); | ||||
| 
 | ||||
|     layout->insertLayout (0, layout2, 1); | ||||
|     mLayout->addWidget (mToolbar, 0); | ||||
| 
 | ||||
|     mLayout->addWidget (mScene, 1); | ||||
| 
 | ||||
|     layout->insertLayout (0, mLayout, 1); | ||||
| 
 | ||||
|     CSVFilter::FilterBox *filterBox = new CSVFilter::FilterBox (document.getData(), this); | ||||
| 
 | ||||
|  | @ -126,4 +135,71 @@ void CSVWorld::SceneSubView::cellSelectionChanged (const CSMWorld::CellSelection | |||
|     } | ||||
| 
 | ||||
|     setWindowTitle (QString::fromUtf8 (stream.str().c_str())); | ||||
| } | ||||
| } | ||||
| 
 | ||||
| void CSVWorld::SceneSubView::changeToPaged (const std::vector< CSMWorld::UniversalId >& data) | ||||
| { | ||||
|     mLayout->removeWidget(mToolbar); | ||||
|     mLayout->removeWidget(mScene); | ||||
| 
 | ||||
|     delete mScene; | ||||
| 
 | ||||
|     delete mToolbar; | ||||
| 
 | ||||
|     mToolbar = new SceneToolbar (48+6, this); | ||||
| 
 | ||||
|     CSVRender::PagedWorldspaceWidget* widget = new CSVRender::PagedWorldspaceWidget (this, mDocument); | ||||
| 
 | ||||
|     mScene = widget; | ||||
| 
 | ||||
|     SceneToolMode* navigationTool = mScene->makeNavigationSelector (mToolbar); | ||||
|     mToolbar->addTool (navigationTool); | ||||
| 
 | ||||
|     SceneToolMode* lightingTool = mScene->makeLightingSelector (mToolbar); | ||||
|     mToolbar->addTool (lightingTool); | ||||
| 
 | ||||
|     connect (widget, SIGNAL (cellSelectionChanged (const CSMWorld::CellSelection&)), | ||||
|              this, SLOT (cellSelectionChanged (const CSMWorld::CellSelection&))); | ||||
| 
 | ||||
|     connect (widget, SIGNAL (interiorCellsDropped (const std::vector<CSMWorld::UniversalId>&)), | ||||
|              this, SLOT (changeToUnpaged (const std::vector<CSMWorld::UniversalId>&))); | ||||
| 
 | ||||
|     mLayout->addWidget (mToolbar, 0); | ||||
|     mLayout->addWidget (mScene, 1); | ||||
| 
 | ||||
|     mScene->selectDefaultNavigationMode(); | ||||
| 
 | ||||
|     connect (mScene, SIGNAL (closeRequest()), this, SLOT (closeRequest())); | ||||
| 
 | ||||
|     widget->handleDrop (data); | ||||
| } | ||||
| 
 | ||||
| void CSVWorld::SceneSubView::changeToUnpaged (const std::vector< CSMWorld::UniversalId >& data) | ||||
| { | ||||
|     mLayout->removeWidget(mToolbar); | ||||
|     mLayout->removeWidget(mScene); | ||||
| 
 | ||||
|     delete mScene; | ||||
|     delete mToolbar; | ||||
| 
 | ||||
|     mToolbar = new SceneToolbar (48+6, this); | ||||
|     CSVRender::UnpagedWorldspaceWidget* widget = new CSVRender::UnpagedWorldspaceWidget (data.begin()->getId(), mDocument, this); | ||||
| 
 | ||||
|     mScene = widget; | ||||
| 
 | ||||
|     SceneToolMode* navigationTool = mScene->makeNavigationSelector (mToolbar); | ||||
|     mToolbar->addTool (navigationTool); | ||||
| 
 | ||||
|     SceneToolMode* lightingTool = mScene->makeLightingSelector (mToolbar); | ||||
|     mToolbar->addTool (lightingTool); | ||||
| 
 | ||||
|     connect (widget, SIGNAL (exteriorCellsDropped (const std::vector<CSMWorld::UniversalId>&)), | ||||
|              this, SLOT (changeToPaged (const std::vector<CSMWorld::UniversalId>&))); | ||||
| 
 | ||||
|     mLayout->addWidget (mToolbar, 0); | ||||
|     mLayout->addWidget (mScene, 1); | ||||
| 
 | ||||
|     mScene->selectDefaultNavigationMode(); | ||||
| 
 | ||||
|     connect (mScene, SIGNAL (closeRequest()), this, SLOT (closeRequest())); | ||||
| } | ||||
|  |  | |||
|  | @ -1,7 +1,10 @@ | |||
| #ifndef CSV_WORLD_SCENESUBVIEW_H | ||||
| #define CSV_WORLD_SCENESUBVIEW_H | ||||
| 
 | ||||
| #include <QHBoxLayout> | ||||
| 
 | ||||
| #include "../doc/subview.hpp" | ||||
| #include "scenetoolbar.hpp" | ||||
| 
 | ||||
| class QModelIndex; | ||||
| 
 | ||||
|  | @ -32,6 +35,9 @@ namespace CSVWorld | |||
| 
 | ||||
|             TableBottomBox *mBottom; | ||||
|             CSVRender::WorldspaceWidget *mScene; | ||||
|             QHBoxLayout* mLayout; | ||||
|             CSMDoc::Document& mDocument; | ||||
|             SceneToolbar* mToolbar; | ||||
| 
 | ||||
|         public: | ||||
| 
 | ||||
|  | @ -50,6 +56,10 @@ namespace CSVWorld | |||
|             void closeRequest(); | ||||
| 
 | ||||
|             void cellSelectionChanged (const CSMWorld::CellSelection& selection); | ||||
| 
 | ||||
|             void changeToPaged(const std::vector<CSMWorld::UniversalId>& data); | ||||
| 
 | ||||
|             void changeToUnpaged(const std::vector<CSMWorld::UniversalId>& data); | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue