mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:53:53 +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;
|
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());
|
std::map<UniversalId::Type, QAbstractItemModel *>::iterator iter = mModelIndex.find (id.getType());
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#include <apps/opencs/model/world/tablemimedata.hpp>
|
#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)
|
: WorldspaceWidget (document, parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
@ -56,10 +56,9 @@ void CSVRender::PagedWorldspaceWidget::dropEvent (QDropEvent* event)
|
||||||
|
|
||||||
if (mime->fromDocument(mDocument))
|
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);
|
CSVRender::WorldspaceWidget::dropType whatHappend = getDropType(data);
|
||||||
|
|
||||||
std::cout<<whatHappend<<std::endl;
|
|
||||||
switch (whatHappend)
|
switch (whatHappend)
|
||||||
{
|
{
|
||||||
case CSVRender::WorldspaceWidget::cellsExterior:
|
case CSVRender::WorldspaceWidget::cellsExterior:
|
||||||
|
|
|
@ -19,19 +19,19 @@ namespace CSVRender
|
||||||
|
|
||||||
std::pair<int, int> getCoordinatesFromId(const std::string& record) const;
|
std::pair<int, int> getCoordinatesFromId(const std::string& record) const;
|
||||||
|
|
||||||
void handleDrop(const std::vector<CSMWorld::UniversalId>& data);
|
|
||||||
|
|
||||||
public:
|
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
|
///< \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
|
/// no cells are displayed. The cells to be displayed will be specified later through
|
||||||
/// hint system.
|
/// hint system.
|
||||||
|
|
||||||
virtual void useViewHint (const std::string& hint);
|
void useViewHint (const std::string& hint);
|
||||||
|
|
||||||
void setCellSelection (const CSMWorld::CellSelection& selection);
|
void setCellSelection (const CSMWorld::CellSelection& selection);
|
||||||
|
|
||||||
|
virtual void handleDrop(const std::vector<CSMWorld::UniversalId>& data);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void cellSelectionChanged (const CSMWorld::CellSelection& selection);
|
void cellSelectionChanged (const CSMWorld::CellSelection& selection);
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace CSVRender
|
||||||
SceneWidget(QWidget *parent);
|
SceneWidget(QWidget *parent);
|
||||||
virtual ~SceneWidget();
|
virtual ~SceneWidget();
|
||||||
|
|
||||||
QPaintEngine* paintEngine() const;
|
QPaintEngine* paintEngine() const;
|
||||||
|
|
||||||
CSVWorld::SceneToolMode *makeLightingSelector (CSVWorld::SceneToolbar *parent);
|
CSVWorld::SceneToolMode *makeLightingSelector (CSVWorld::SceneToolbar *parent);
|
||||||
///< \attention The created tool is not added to the toolbar (via addTool). Doing that
|
///< \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
|
/// \todo deal with mSunlight and mFog/mForDensity
|
||||||
}
|
}
|
||||||
|
|
||||||
CSVRender::UnpagedWorldspaceWidget::UnpagedWorldspaceWidget (const std::string& cellId,
|
CSVRender::UnpagedWorldspaceWidget::UnpagedWorldspaceWidget (const std::string& cellId, CSMDoc::Document& document, QWidget* parent)
|
||||||
CSMDoc::Document& document, QWidget *parent)
|
|
||||||
: WorldspaceWidget (document, parent), mCellId (cellId)
|
: WorldspaceWidget (document, parent), mCellId (cellId)
|
||||||
{
|
{
|
||||||
mCellsModel = &dynamic_cast<CSMWorld::IdTable&> (
|
mCellsModel = &dynamic_cast<CSMWorld::IdTable&> (
|
||||||
|
@ -74,7 +73,7 @@ void CSVRender::UnpagedWorldspaceWidget::dropEvent (QDropEvent* event)
|
||||||
|
|
||||||
if (mime->fromDocument (mDocument))
|
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);
|
CSVRender::WorldspaceWidget::dropType whatHappend = getDropType (data);
|
||||||
|
|
||||||
switch (whatHappend)
|
switch (whatHappend)
|
||||||
|
@ -96,5 +95,6 @@ void CSVRender::UnpagedWorldspaceWidget::dropEvent (QDropEvent* event)
|
||||||
|
|
||||||
void CSVRender::UnpagedWorldspaceWidget::handleDrop (const std::vector< CSMWorld::UniversalId >& data)
|
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,
|
UnpagedWorldspaceWidget (const std::string& cellId, CSMDoc::Document& document,
|
||||||
QWidget *parent);
|
QWidget *parent);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void handleDrop(const std::vector<CSMWorld::UniversalId>& data);
|
void handleDrop(const std::vector<CSMWorld::UniversalId>& data);
|
||||||
|
|
|
@ -18,11 +18,10 @@
|
||||||
|
|
||||||
#include "tablebottombox.hpp"
|
#include "tablebottombox.hpp"
|
||||||
#include "creator.hpp"
|
#include "creator.hpp"
|
||||||
#include "scenetoolbar.hpp"
|
|
||||||
#include "scenetoolmode.hpp"
|
#include "scenetoolmode.hpp"
|
||||||
|
|
||||||
CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
||||||
: SubView (id)
|
: SubView (id), mLayout(new QHBoxLayout), mDocument(document)
|
||||||
{
|
{
|
||||||
QVBoxLayout *layout = new QVBoxLayout;
|
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,
|
new TableBottomBox (NullCreatorFactory(), document.getData(), document.getUndoStack(), id,
|
||||||
this), 0);
|
this), 0);
|
||||||
|
|
||||||
QHBoxLayout *layout2 = new QHBoxLayout;
|
mLayout->setContentsMargins (QMargins (0, 0, 0, 0));
|
||||||
|
|
||||||
layout2->setContentsMargins (QMargins (0, 0, 0, 0));
|
mToolbar = new SceneToolbar (48+6, this);
|
||||||
|
|
||||||
SceneToolbar *toolbar = new SceneToolbar (48+6, this);
|
|
||||||
|
|
||||||
if (id.getId()=="sys::default")
|
if (id.getId()=="sys::default")
|
||||||
{
|
{
|
||||||
CSVRender::PagedWorldspaceWidget *widget = new CSVRender::PagedWorldspaceWidget (this, document);
|
CSVRender::PagedWorldspaceWidget *widget = new CSVRender::PagedWorldspaceWidget (this, document);
|
||||||
|
|
||||||
mScene = widget;
|
mScene = widget;
|
||||||
|
|
||||||
connect (widget, SIGNAL (cellSelectionChanged (const CSMWorld::CellSelection&)),
|
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
|
else
|
||||||
mScene = new CSVRender::UnpagedWorldspaceWidget (id.getId(), document, this);
|
{
|
||||||
|
CSVRender::UnpagedWorldspaceWidget *widget = new CSVRender::UnpagedWorldspaceWidget (id.getId(), document, this);
|
||||||
|
|
||||||
SceneToolMode *navigationTool = mScene->makeNavigationSelector (toolbar);
|
mScene = widget;
|
||||||
toolbar->addTool (navigationTool);
|
|
||||||
|
|
||||||
SceneToolMode *lightingTool = mScene->makeLightingSelector (toolbar);
|
connect (widget, SIGNAL(exteriorCellsDropped(const std::vector<CSMWorld::UniversalId>&)),
|
||||||
toolbar->addTool (lightingTool);
|
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);
|
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()));
|
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
|
#ifndef CSV_WORLD_SCENESUBVIEW_H
|
||||||
#define CSV_WORLD_SCENESUBVIEW_H
|
#define CSV_WORLD_SCENESUBVIEW_H
|
||||||
|
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
|
||||||
#include "../doc/subview.hpp"
|
#include "../doc/subview.hpp"
|
||||||
|
#include "scenetoolbar.hpp"
|
||||||
|
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
|
|
||||||
|
@ -32,6 +35,9 @@ namespace CSVWorld
|
||||||
|
|
||||||
TableBottomBox *mBottom;
|
TableBottomBox *mBottom;
|
||||||
CSVRender::WorldspaceWidget *mScene;
|
CSVRender::WorldspaceWidget *mScene;
|
||||||
|
QHBoxLayout* mLayout;
|
||||||
|
CSMDoc::Document& mDocument;
|
||||||
|
SceneToolbar* mToolbar;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -50,6 +56,10 @@ namespace CSVWorld
|
||||||
void closeRequest();
|
void closeRequest();
|
||||||
|
|
||||||
void cellSelectionChanged (const CSMWorld::CellSelection& selection);
|
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