changed sub view factory method signature

pull/16/head
Marc Zinnschlag 12 years ago
parent 832fc56d34
commit 0ed378dfb2

@ -191,7 +191,7 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id)
if (iter==mSubViewFactories.end())
throw std::logic_error ("can't create subview for " + id.toString());
CSVWorld::SubView *view = iter->second->makeSubView (id, mDocument->getData(), mDocument->getUndoStack());
CSVWorld::SubView *view = iter->second->makeSubView (id, *mDocument);
addDockWidget (Qt::TopDockWidgetArea, view);
view->show();
}

@ -1,6 +1,8 @@
#ifndef CSV_WORLD_SUBVIEW_H
#define CSV_WORLD_SUBVIEW_H
#include "../../model/doc/document.hpp"
#include "../../model/world/universalid.hpp"
#include <QDockWidget>
@ -35,21 +37,20 @@ namespace CSVWorld
struct SubViewFactoryBase
{
virtual SubView *makeSubView (const CSMWorld::UniversalId& id, CSMWorld::Data& data, QUndoStack& undoStack)
virtual SubView *makeSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
= 0;
};
template<class SubViewT>
struct SubViewFactory : public SubViewFactoryBase
{
virtual SubView *makeSubView (const CSMWorld::UniversalId& id, CSMWorld::Data& data, QUndoStack& undoStack);
virtual SubView *makeSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document);
};
template<class SubViewT>
SubView *SubViewFactory<SubViewT>::makeSubView (const CSMWorld::UniversalId& id, CSMWorld::Data& data,
QUndoStack& undoStack)
SubView *SubViewFactory<SubViewT>::makeSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
{
return new SubViewT (id, data, undoStack);
return new SubViewT (id, document.getData(), document.getUndoStack());
}
template<class SubViewT>
@ -59,7 +60,7 @@ namespace CSVWorld
SubViewFactoryWithCreateFlag (bool createAndDelete);
virtual SubView *makeSubView (const CSMWorld::UniversalId& id, CSMWorld::Data& data, QUndoStack& undoStack);
virtual SubView *makeSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document);
};
template<class SubViewT>
@ -69,10 +70,9 @@ namespace CSVWorld
template<class SubViewT>
SubView *SubViewFactoryWithCreateFlag<SubViewT>::makeSubView (const CSMWorld::UniversalId& id,
CSMWorld::Data& data,
QUndoStack& undoStack)
CSMDoc::Document& document)
{
return new SubViewT (id, data, undoStack, mCreateAndDelete);
return new SubViewT (id, document.getData(), document.getUndoStack(), mCreateAndDelete);
}
}

Loading…
Cancel
Save