Resolve merge issues and fix typos.

test
cc9cii 10 years ago
parent f1a58994c6
commit acb800b8f9

@ -18,7 +18,7 @@ namespace CSMWorld
{ {
Role_Flags = Qt::UserRole, Role_Flags = Qt::UserRole,
Role_Display = Qt::UserRole+1, Role_Display = Qt::UserRole+1,
Role_ColumnId = Qt::UserRole+1 Role_ColumnId = Qt::UserRole+2
}; };
enum Flags enum Flags

@ -8,7 +8,6 @@ CSMWorld::CellRef::CellRef()
mRefNum.mIndex = 0; mRefNum.mIndex = 0;
mRefNum.mContentFile = 0; mRefNum.mContentFile = 0;
} }
<<<<<<< HEAD
std::pair<int, int> CSMWorld::CellRef::getCellIndex() const std::pair<int, int> CSMWorld::CellRef::getCellIndex() const
{ {
@ -17,5 +16,3 @@ std::pair<int, int> CSMWorld::CellRef::getCellIndex() const
return std::make_pair ( return std::make_pair (
std::floor (mPos.pos[0]/cellSize), std::floor (mPos.pos[1]/cellSize)); std::floor (mPos.pos[0]/cellSize), std::floor (mPos.pos[1]/cellSize));
} }
=======
>>>>>>> master

@ -176,18 +176,12 @@ void CSVWorld::DialogueDelegateDispatcherProxy::tableMimeDataDropped(const std::
==============================DialogueDelegateDispatcher========================================== ==============================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, 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), mParent(parent),
mTable(model ? model : table), mTable(model ? model : table),
mDocument (document), mCommandDispatcher (commandDispatcher), mDocument (document),
>>>>>>> master
mNotEditableDelegate(table, parent) mNotEditableDelegate(table, parent)
{ {
} }
@ -350,10 +344,6 @@ CSVWorld::DialogueDelegateDispatcher::~DialogueDelegateDispatcher()
=============================================================EditWidget===================================================== =============================================================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() CSVWorld::EditWidget::~EditWidget()
{ {
for (unsigned i = 0; i < mNestedModels.size(); ++i) for (unsigned i = 0; i < mNestedModels.size(); ++i)
@ -363,15 +353,17 @@ CSVWorld::EditWidget::~EditWidget()
delete mNestedTableDispatcher; delete mNestedTableDispatcher;
} }
CSVWorld::EditWidget::EditWidget(QWidget *parent, int row, CSMWorld::IdTable* table, CSMDoc::Document& document, bool createAndDelete) : CSVWorld::EditWidget::EditWidget(QWidget *parent,
mDispatcher(this, table, document), int row, CSMWorld::IdTable* table, CSMWorld::CommandDispatcher& commandDispatcher,
CSMDoc::Document& document, bool createAndDelete) :
mDispatcher(this, table, commandDispatcher, document),
mNestedTableDispatcher(NULL), mNestedTableDispatcher(NULL),
>>>>>>> master
QScrollArea(parent), QScrollArea(parent),
mWidgetMapper(NULL), mWidgetMapper(NULL),
mNestedTableMapper(NULL), mNestedTableMapper(NULL),
mMainWidget(NULL), mMainWidget(NULL),
mCommandDispatcher (commandDispatcher), mCommandDispatcher (commandDispatcher),
mDocument (document),
mTable(table) mTable(table)
{ {
remake (row); 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))); 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 // FIXME: does not work well when enum delegates are used
//table->resizeColumnsToContents(); //table->resizeColumnsToContents();
table->setEditTriggers(QAbstractItemView::SelectedClicked | QAbstractItemView::CurrentChanged); table->setEditTriggers(QAbstractItemView::SelectedClicked | QAbstractItemView::CurrentChanged);
@ -511,7 +510,7 @@ void CSVWorld::EditWidget::remake(int row)
mNestedTableMapper->setModel(mNestedModels.back()); mNestedTableMapper->setModel(mNestedModels.back());
// FIXME: lack MIME support? // FIXME: lack MIME support?
mNestedTableDispatcher = mNestedTableDispatcher =
new DialogueDelegateDispatcher (this, mTable, mDocument, mNestedModels.back()); new DialogueDelegateDispatcher (this, mTable, mCommandDispatcher, mDocument, mNestedModels.back());
mNestedTableMapper->setItemDelegate(mNestedTableDispatcher); mNestedTableMapper->setItemDelegate(mNestedTableDispatcher);
int columnCount = int columnCount =
@ -638,11 +637,8 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSM
mMainLayout = new QVBoxLayout(mainWidget); mMainLayout = new QVBoxLayout(mainWidget);
<<<<<<< HEAD mEditWidget = new EditWidget(mainWidget,
mEditWidget = new EditWidget(mainWidget, mRow, mTable, mCommandDispatcher, document, false); mTable->getModelIndex(mCurrentId, 0).row(), mTable, mCommandDispatcher, document, false);
=======
mEditWidget = new EditWidget(mainWidget, mTable->getModelIndex(mCurrentId, 0).row(), mTable, document, false);
>>>>>>> master
connect(mEditWidget, SIGNAL(tableMimeDataDropped(QWidget*, const QModelIndex&, const CSMWorld::UniversalId&, const CSMDoc::Document*)), 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*))); this, SLOT(tableMimeDataDropped(QWidget*, const QModelIndex&, const CSMWorld::UniversalId&, const CSMDoc::Document*)));

@ -109,10 +109,7 @@ namespace CSVWorld
QAbstractItemModel* mTable; QAbstractItemModel* mTable;
<<<<<<< HEAD
CSMWorld::CommandDispatcher& mCommandDispatcher; CSMWorld::CommandDispatcher& mCommandDispatcher;
=======
>>>>>>> master
CSMDoc::Document& mDocument; CSMDoc::Document& mDocument;
NotEditableSubDelegate mNotEditableDelegate; NotEditableSubDelegate mNotEditableDelegate;
@ -121,15 +118,11 @@ namespace CSVWorld
//once we move to the C++11 we should use unique_ptr //once we move to the C++11 we should use unique_ptr
public: public:
<<<<<<< HEAD
DialogueDelegateDispatcher(QObject* parent, CSMWorld::IdTable* table,
CSMWorld::CommandDispatcher& commandDispatcher, CSMDoc::Document& document);
=======
DialogueDelegateDispatcher(QObject* parent, DialogueDelegateDispatcher(QObject* parent,
CSMWorld::IdTable* table, CSMWorld::IdTable* table,
CSMWorld::CommandDispatcher& commandDispatcher,
CSMDoc::Document& document, CSMDoc::Document& document,
QAbstractItemModel* model = 0); QAbstractItemModel* model = 0);
>>>>>>> master
~DialogueDelegateDispatcher(); ~DialogueDelegateDispatcher();
@ -176,23 +169,17 @@ namespace CSVWorld
DialogueDelegateDispatcher *mNestedTableDispatcher; DialogueDelegateDispatcher *mNestedTableDispatcher;
QWidget* mMainWidget; QWidget* mMainWidget;
CSMWorld::IdTable* mTable; CSMWorld::IdTable* mTable;
<<<<<<< HEAD
CSMWorld::CommandDispatcher& mCommandDispatcher; CSMWorld::CommandDispatcher& mCommandDispatcher;
public:
EditWidget (QWidget *parent, int row, CSMWorld::IdTable* table, CSMWorld::CommandDispatcher& commandDispatcher, CSMDoc::Document& document, bool createAndDelete = false);
=======
CSMDoc::Document& mDocument; CSMDoc::Document& mDocument;
std::vector<CSMWorld::NestedTableProxyModel*> mNestedModels; //Plain, raw C pointers, deleted in the dtor std::vector<CSMWorld::NestedTableProxyModel*> mNestedModels; //Plain, raw C pointers, deleted in the dtor
public: public:
EditWidget (QWidget *parent, int row, CSMWorld::IdTable* table, EditWidget (QWidget *parent, int row, CSMWorld::IdTable* table,
CSMWorld::CommandDispatcher& commandDispatcher,
CSMDoc::Document& document, bool createAndDelete = false); CSMDoc::Document& document, bool createAndDelete = false);
virtual ~EditWidget(); virtual ~EditWidget();
>>>>>>> master
void remake(int row); void remake(int row);

@ -2,6 +2,7 @@
#include "../../model/world/nestedtableproxymodel.hpp" #include "../../model/world/nestedtableproxymodel.hpp"
#include "../../model/world/universalid.hpp" #include "../../model/world/universalid.hpp"
#include "../../model/world/commands.hpp" #include "../../model/world/commands.hpp"
#include "../../model/world/commanddispatcher.hpp"
#include "util.hpp" #include "util.hpp"
#include <QHeaderView> #include <QHeaderView>
@ -10,12 +11,14 @@
#include <QDebug> #include <QDebug>
CSVWorld::NestedTable::NestedTable(CSMDoc::Document& document, CSVWorld::NestedTable::NestedTable(CSMDoc::Document& document,
CSMWorld::UniversalId id,
CSMWorld::NestedTableProxyModel* model, CSMWorld::NestedTableProxyModel* model,
QWidget* parent) QWidget* parent)
: QTableView(parent), : QTableView(parent),
mUndoStack(document.getUndoStack()), mUndoStack(document.getUndoStack()),
mModel(model) mModel(model)
{ {
mDispatcher = new CSMWorld::CommandDispatcher (document, id, this);
setSelectionBehavior (QAbstractItemView::SelectRows); setSelectionBehavior (QAbstractItemView::SelectRows);
setSelectionMode (QAbstractItemView::ExtendedSelection); setSelectionMode (QAbstractItemView::ExtendedSelection);
@ -31,6 +34,7 @@ CSVWorld::NestedTable::NestedTable(CSMDoc::Document& document,
model->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt()); model->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt());
CommandDelegate *delegate = CommandDelegateFactoryCollection::get().makeDelegate(display, CommandDelegate *delegate = CommandDelegateFactoryCollection::get().makeDelegate(display,
mDispatcher,
document, document,
this); this);

@ -12,6 +12,7 @@ namespace CSMWorld
{ {
class NestedTableProxyModel; class NestedTableProxyModel;
class UniversalId; class UniversalId;
class CommandDispatcher;
} }
namespace CSMDoc namespace CSMDoc
@ -29,9 +30,11 @@ namespace CSVWorld
QAction *mRemoveRowAction; QAction *mRemoveRowAction;
QUndoStack& mUndoStack; QUndoStack& mUndoStack;
CSMWorld::NestedTableProxyModel* mModel; CSMWorld::NestedTableProxyModel* mModel;
CSMWorld::CommandDispatcher *mDispatcher;
public: public:
NestedTable(CSMDoc::Document& document, NestedTable(CSMDoc::Document& document,
CSMWorld::UniversalId id,
CSMWorld::NestedTableProxyModel* model, CSMWorld::NestedTableProxyModel* model,
QWidget* parent = NULL); QWidget* parent = NULL);

@ -124,13 +124,9 @@ void CSVWorld::CommandDelegate::setModelDataImp (QWidget *editor, QAbstractItemM
QVariant new_ = hack.getData(); 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)) if ((model->data (index)!=new_) && (model->flags(index) & Qt::ItemIsEditable))
getUndoStack().push (new CSMWorld::ModifyCommand (*model, index, new_)); //getUndoStack().push (new CSMWorld::ModifyCommand (*model, index, new_)); // FIXME
>>>>>>> master mCommandDispatcher->executeModify (model, index, new_);
} }
CSVWorld::CommandDelegate::CommandDelegate (CSMWorld::CommandDispatcher *commandDispatcher, 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); esm.writeHNT (tag, *this, 8);
else else
{ {
int refNum = (mIndex & 0xffffff) | ((mContentFile==-1 ? 0xff : mContentFile)<<24); int refNum = (mIndex & 0xffffff) | ((hasContentFile() ? mContentFile<<24 : 0xff));
esm.writeHNT (tag, refNum, 4); 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) void ESM::CellRef::load (ESMReader& esm, bool wideRefNum, bool ignoreRefNum)
{ {
loadId(esm, wideRefNum); loadId(esm, wideRefNum, ignoreRefNum);
loadData(esm); 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 // 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. // 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 struct RefNum
{ {
<<<<<<< HEAD unsigned int mIndex;
int mIndex; int mContentFile;
int mContentFile; // -1 no content file
void load (ESMReader& esm, bool wide = false); void load (ESMReader& esm, bool wide = false);
void save (ESMWriter &esm, bool wide = false, const std::string& tag = "FRMR") const; void save (ESMWriter &esm, bool wide = false, const std::string& tag = "FRMR") const;
=======
unsigned int mIndex;
int mContentFile;
enum { RefNum_NoContentFile = -1 }; enum { RefNum_NoContentFile = -1 };
inline bool hasContentFile() const { return mContentFile != RefNum_NoContentFile; } inline bool hasContentFile() const { return mContentFile != RefNum_NoContentFile; }
inline void unset() { mIndex = 0; mContentFile = RefNum_NoContentFile; } inline void unset() { mIndex = 0; mContentFile = RefNum_NoContentFile; }
>>>>>>> master
}; };
/* Cell reference. This represents ONE object (of many) inside the /* Cell reference. This represents ONE object (of many) inside the
@ -105,9 +100,9 @@ namespace ESM
Position mPos; Position mPos;
/// Calls loadId and loadData /// 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 /// Implicitly called by load
void loadData (ESMReader& esm); void loadData (ESMReader& esm);

Loading…
Cancel
Save