mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-21 23:09:42 +00:00
Resolve merge issues and fix typos.
This commit is contained in:
parent
f1a58994c6
commit
acb800b8f9
9 changed files with 38 additions and 60 deletions
|
@ -18,7 +18,7 @@ namespace CSMWorld
|
|||
{
|
||||
Role_Flags = Qt::UserRole,
|
||||
Role_Display = Qt::UserRole+1,
|
||||
Role_ColumnId = Qt::UserRole+1
|
||||
Role_ColumnId = Qt::UserRole+2
|
||||
};
|
||||
|
||||
enum Flags
|
||||
|
|
|
@ -8,7 +8,6 @@ CSMWorld::CellRef::CellRef()
|
|||
mRefNum.mIndex = 0;
|
||||
mRefNum.mContentFile = 0;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
|
||||
std::pair<int, int> CSMWorld::CellRef::getCellIndex() const
|
||||
{
|
||||
|
@ -17,5 +16,3 @@ std::pair<int, int> CSMWorld::CellRef::getCellIndex() const
|
|||
return std::make_pair (
|
||||
std::floor (mPos.pos[0]/cellSize), std::floor (mPos.pos[1]/cellSize));
|
||||
}
|
||||
=======
|
||||
>>>>>>> master
|
||||
|
|
|
@ -176,18 +176,12 @@ void CSVWorld::DialogueDelegateDispatcherProxy::tableMimeDataDropped(const std::
|
|||
==============================DialogueDelegateDispatcher==========================================
|
||||
*/
|
||||
|
||||
<<<<<<< HEAD
|
||||
CSVWorld::DialogueDelegateDispatcher::DialogueDelegateDispatcher(QObject* parent, CSMWorld::IdTable* table, CSMWorld::CommandDispatcher& commandDispatcher, CSMDoc::Document& document) :
|
||||
mParent(parent),
|
||||
mTable(table),
|
||||
mCommandDispatcher (commandDispatcher), mDocument (document),
|
||||
=======
|
||||
CSVWorld::DialogueDelegateDispatcher::DialogueDelegateDispatcher(QObject* parent,
|
||||
CSMWorld::IdTable* table, CSMDoc::Document& document, QAbstractItemModel *model) :
|
||||
CSMWorld::IdTable* table, CSMWorld::CommandDispatcher& commandDispatcher,
|
||||
CSMDoc::Document& document, QAbstractItemModel *model) :
|
||||
mParent(parent),
|
||||
mTable(model ? model : table),
|
||||
mDocument (document),
|
||||
>>>>>>> master
|
||||
mCommandDispatcher (commandDispatcher), mDocument (document),
|
||||
mNotEditableDelegate(table, parent)
|
||||
{
|
||||
}
|
||||
|
@ -350,10 +344,6 @@ CSVWorld::DialogueDelegateDispatcher::~DialogueDelegateDispatcher()
|
|||
=============================================================EditWidget=====================================================
|
||||
*/
|
||||
|
||||
<<<<<<< HEAD
|
||||
CSVWorld::EditWidget::EditWidget(QWidget *parent, int row, CSMWorld::IdTable* table, CSMWorld::CommandDispatcher& commandDispatcher, CSMDoc::Document& document, bool createAndDelete) :
|
||||
mDispatcher(this, table, commandDispatcher, document),
|
||||
=======
|
||||
CSVWorld::EditWidget::~EditWidget()
|
||||
{
|
||||
for (unsigned i = 0; i < mNestedModels.size(); ++i)
|
||||
|
@ -363,15 +353,17 @@ CSVWorld::EditWidget::~EditWidget()
|
|||
delete mNestedTableDispatcher;
|
||||
}
|
||||
|
||||
CSVWorld::EditWidget::EditWidget(QWidget *parent, int row, CSMWorld::IdTable* table, CSMDoc::Document& document, bool createAndDelete) :
|
||||
mDispatcher(this, table, document),
|
||||
CSVWorld::EditWidget::EditWidget(QWidget *parent,
|
||||
int row, CSMWorld::IdTable* table, CSMWorld::CommandDispatcher& commandDispatcher,
|
||||
CSMDoc::Document& document, bool createAndDelete) :
|
||||
mDispatcher(this, table, commandDispatcher, document),
|
||||
mNestedTableDispatcher(NULL),
|
||||
>>>>>>> master
|
||||
QScrollArea(parent),
|
||||
mWidgetMapper(NULL),
|
||||
mNestedTableMapper(NULL),
|
||||
mMainWidget(NULL),
|
||||
mCommandDispatcher (commandDispatcher),
|
||||
mDocument (document),
|
||||
mTable(table)
|
||||
{
|
||||
remake (row);
|
||||
|
@ -454,7 +446,14 @@ void CSVWorld::EditWidget::remake(int row)
|
|||
{
|
||||
mNestedModels.push_back(new CSMWorld::NestedTableProxyModel (mTable->index(row, i), display, dynamic_cast<CSMWorld::IdTree*>(mTable)));
|
||||
|
||||
NestedTable* table = new NestedTable(mDocument, mNestedModels.back(), this);
|
||||
int idColumn = mTable->findColumnIndex (CSMWorld::Columns::ColumnId_Id);
|
||||
int typeColumn = mTable->findColumnIndex (CSMWorld::Columns::ColumnId_RecordType);
|
||||
|
||||
CSMWorld::UniversalId id = CSMWorld::UniversalId(
|
||||
static_cast<CSMWorld::UniversalId::Type> (mTable->data (mTable->index (row, typeColumn)).toInt()),
|
||||
mTable->data (mTable->index (row, idColumn)).toString().toUtf8().constData());
|
||||
|
||||
NestedTable* table = new NestedTable(mDocument, id, mNestedModels.back(), this);
|
||||
// FIXME: does not work well when enum delegates are used
|
||||
//table->resizeColumnsToContents();
|
||||
table->setEditTriggers(QAbstractItemView::SelectedClicked | QAbstractItemView::CurrentChanged);
|
||||
|
@ -511,7 +510,7 @@ void CSVWorld::EditWidget::remake(int row)
|
|||
mNestedTableMapper->setModel(mNestedModels.back());
|
||||
// FIXME: lack MIME support?
|
||||
mNestedTableDispatcher =
|
||||
new DialogueDelegateDispatcher (this, mTable, mDocument, mNestedModels.back());
|
||||
new DialogueDelegateDispatcher (this, mTable, mCommandDispatcher, mDocument, mNestedModels.back());
|
||||
mNestedTableMapper->setItemDelegate(mNestedTableDispatcher);
|
||||
|
||||
int columnCount =
|
||||
|
@ -638,11 +637,8 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
|
|||
|
||||
mMainLayout = new QVBoxLayout(mainWidget);
|
||||
|
||||
<<<<<<< HEAD
|
||||
mEditWidget = new EditWidget(mainWidget, mRow, mTable, mCommandDispatcher, document, false);
|
||||
=======
|
||||
mEditWidget = new EditWidget(mainWidget, mTable->getModelIndex(mCurrentId, 0).row(), mTable, document, false);
|
||||
>>>>>>> master
|
||||
mEditWidget = new EditWidget(mainWidget,
|
||||
mTable->getModelIndex(mCurrentId, 0).row(), mTable, mCommandDispatcher, document, false);
|
||||
connect(mEditWidget, SIGNAL(tableMimeDataDropped(QWidget*, const QModelIndex&, const CSMWorld::UniversalId&, const CSMDoc::Document*)),
|
||||
this, SLOT(tableMimeDataDropped(QWidget*, const QModelIndex&, const CSMWorld::UniversalId&, const CSMDoc::Document*)));
|
||||
|
||||
|
|
|
@ -109,10 +109,7 @@ namespace CSVWorld
|
|||
|
||||
QAbstractItemModel* mTable;
|
||||
|
||||
<<<<<<< HEAD
|
||||
CSMWorld::CommandDispatcher& mCommandDispatcher;
|
||||
=======
|
||||
>>>>>>> master
|
||||
CSMDoc::Document& mDocument;
|
||||
|
||||
NotEditableSubDelegate mNotEditableDelegate;
|
||||
|
@ -121,15 +118,11 @@ namespace CSVWorld
|
|||
//once we move to the C++11 we should use unique_ptr
|
||||
|
||||
public:
|
||||
<<<<<<< HEAD
|
||||
DialogueDelegateDispatcher(QObject* parent, CSMWorld::IdTable* table,
|
||||
CSMWorld::CommandDispatcher& commandDispatcher, CSMDoc::Document& document);
|
||||
=======
|
||||
DialogueDelegateDispatcher(QObject* parent,
|
||||
CSMWorld::IdTable* table,
|
||||
CSMWorld::CommandDispatcher& commandDispatcher,
|
||||
CSMDoc::Document& document,
|
||||
QAbstractItemModel* model = 0);
|
||||
>>>>>>> master
|
||||
|
||||
~DialogueDelegateDispatcher();
|
||||
|
||||
|
@ -176,23 +169,17 @@ namespace CSVWorld
|
|||
DialogueDelegateDispatcher *mNestedTableDispatcher;
|
||||
QWidget* mMainWidget;
|
||||
CSMWorld::IdTable* mTable;
|
||||
<<<<<<< HEAD
|
||||
CSMWorld::CommandDispatcher& mCommandDispatcher;
|
||||
|
||||
public:
|
||||
|
||||
EditWidget (QWidget *parent, int row, CSMWorld::IdTable* table, CSMWorld::CommandDispatcher& commandDispatcher, CSMDoc::Document& document, bool createAndDelete = false);
|
||||
=======
|
||||
CSMDoc::Document& mDocument;
|
||||
std::vector<CSMWorld::NestedTableProxyModel*> mNestedModels; //Plain, raw C pointers, deleted in the dtor
|
||||
|
||||
public:
|
||||
|
||||
EditWidget (QWidget *parent, int row, CSMWorld::IdTable* table,
|
||||
CSMWorld::CommandDispatcher& commandDispatcher,
|
||||
CSMDoc::Document& document, bool createAndDelete = false);
|
||||
|
||||
virtual ~EditWidget();
|
||||
>>>>>>> master
|
||||
|
||||
void remake(int row);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "../../model/world/nestedtableproxymodel.hpp"
|
||||
#include "../../model/world/universalid.hpp"
|
||||
#include "../../model/world/commands.hpp"
|
||||
#include "../../model/world/commanddispatcher.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
#include <QHeaderView>
|
||||
|
@ -10,12 +11,14 @@
|
|||
#include <QDebug>
|
||||
|
||||
CSVWorld::NestedTable::NestedTable(CSMDoc::Document& document,
|
||||
CSMWorld::UniversalId id,
|
||||
CSMWorld::NestedTableProxyModel* model,
|
||||
QWidget* parent)
|
||||
: QTableView(parent),
|
||||
mUndoStack(document.getUndoStack()),
|
||||
mModel(model)
|
||||
{
|
||||
mDispatcher = new CSMWorld::CommandDispatcher (document, id, this);
|
||||
|
||||
setSelectionBehavior (QAbstractItemView::SelectRows);
|
||||
setSelectionMode (QAbstractItemView::ExtendedSelection);
|
||||
|
@ -31,6 +34,7 @@ CSVWorld::NestedTable::NestedTable(CSMDoc::Document& document,
|
|||
model->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt());
|
||||
|
||||
CommandDelegate *delegate = CommandDelegateFactoryCollection::get().makeDelegate(display,
|
||||
mDispatcher,
|
||||
document,
|
||||
this);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ namespace CSMWorld
|
|||
{
|
||||
class NestedTableProxyModel;
|
||||
class UniversalId;
|
||||
class CommandDispatcher;
|
||||
}
|
||||
|
||||
namespace CSMDoc
|
||||
|
@ -29,9 +30,11 @@ namespace CSVWorld
|
|||
QAction *mRemoveRowAction;
|
||||
QUndoStack& mUndoStack;
|
||||
CSMWorld::NestedTableProxyModel* mModel;
|
||||
CSMWorld::CommandDispatcher *mDispatcher;
|
||||
|
||||
public:
|
||||
NestedTable(CSMDoc::Document& document,
|
||||
CSMWorld::UniversalId id,
|
||||
CSMWorld::NestedTableProxyModel* model,
|
||||
QWidget* parent = NULL);
|
||||
|
||||
|
|
|
@ -124,13 +124,9 @@ void CSVWorld::CommandDelegate::setModelDataImp (QWidget *editor, QAbstractItemM
|
|||
|
||||
QVariant new_ = hack.getData();
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (model->data (index)!=new_)
|
||||
mCommandDispatcher->executeModify (model, index, new_);
|
||||
=======
|
||||
if ((model->data (index)!=new_) && (model->flags(index) & Qt::ItemIsEditable))
|
||||
getUndoStack().push (new CSMWorld::ModifyCommand (*model, index, new_));
|
||||
>>>>>>> master
|
||||
//getUndoStack().push (new CSMWorld::ModifyCommand (*model, index, new_)); // FIXME
|
||||
mCommandDispatcher->executeModify (model, index, new_);
|
||||
}
|
||||
|
||||
CSVWorld::CommandDelegate::CommandDelegate (CSMWorld::CommandDispatcher *commandDispatcher,
|
||||
|
|
|
@ -18,7 +18,7 @@ void ESM::RefNum::save (ESMWriter &esm, bool wide, const std::string& tag) const
|
|||
esm.writeHNT (tag, *this, 8);
|
||||
else
|
||||
{
|
||||
int refNum = (mIndex & 0xffffff) | ((mContentFile==-1 ? 0xff : mContentFile)<<24);
|
||||
int refNum = (mIndex & 0xffffff) | ((hasContentFile() ? mContentFile<<24 : 0xff));
|
||||
|
||||
esm.writeHNT (tag, refNum, 4);
|
||||
}
|
||||
|
@ -27,11 +27,11 @@ void ESM::RefNum::save (ESMWriter &esm, bool wide, const std::string& tag) const
|
|||
|
||||
void ESM::CellRef::load (ESMReader& esm, bool wideRefNum, bool ignoreRefNum)
|
||||
{
|
||||
loadId(esm, wideRefNum);
|
||||
loadId(esm, wideRefNum, ignoreRefNum);
|
||||
loadData(esm);
|
||||
}
|
||||
|
||||
void ESM::CellRef::loadId(ESMReader &esm, bool wideRefNum)
|
||||
void ESM::CellRef::loadId (ESMReader& esm, bool wideRefNum, bool ignoreRefNum)
|
||||
{
|
||||
// According to Hrnchamd, this does not belong to the actual ref. Instead, it is a marker indicating that
|
||||
// the following refs are part of a "temp refs" section. A temp ref is not being tracked by the moved references system.
|
||||
|
|
|
@ -13,21 +13,16 @@ namespace ESM
|
|||
|
||||
struct RefNum
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
int mIndex;
|
||||
int mContentFile; // -1 no content file
|
||||
unsigned int mIndex;
|
||||
int mContentFile;
|
||||
|
||||
void load (ESMReader& esm, bool wide = false);
|
||||
|
||||
void save (ESMWriter &esm, bool wide = false, const std::string& tag = "FRMR") const;
|
||||
=======
|
||||
unsigned int mIndex;
|
||||
int mContentFile;
|
||||
|
||||
enum { RefNum_NoContentFile = -1 };
|
||||
inline bool hasContentFile() const { return mContentFile != RefNum_NoContentFile; }
|
||||
inline void unset() { mIndex = 0; mContentFile = RefNum_NoContentFile; }
|
||||
>>>>>>> master
|
||||
};
|
||||
|
||||
/* Cell reference. This represents ONE object (of many) inside the
|
||||
|
@ -105,9 +100,9 @@ namespace ESM
|
|||
Position mPos;
|
||||
|
||||
/// Calls loadId and loadData
|
||||
void load (ESMReader& esm, bool wideRefNum = false);
|
||||
void load (ESMReader& esm, bool wideRefNum = false, bool ignoreRefNum = false);
|
||||
|
||||
void loadId (ESMReader& esm, bool wideRefNum = false);
|
||||
void loadId (ESMReader& esm, bool wideRefNum = false, bool ignoreRefNum = false);
|
||||
|
||||
/// Implicitly called by load
|
||||
void loadData (ESMReader& esm);
|
||||
|
|
Loading…
Reference in a new issue