moved editlock to the dragrecordtable

openmw-30
Marek Kochanowicz 11 years ago
parent d376efe30b
commit eeb18b533e

@ -18,5 +18,11 @@ void CSVWorld::DragRecordTable::startDrag (const CSVWorld::DragRecordTable& tabl
CSVWorld::DragRecordTable::DragRecordTable (CSMDoc::Document& document, QWidget* parent) :
mDocument(document),
QTableView(parent)
QTableView(parent),
mEditLock(false)
{}
void CSVWorld::DragRecordTable::setEditLock (bool locked)
{
mEditLock = locked;
}

@ -22,12 +22,15 @@ namespace CSVWorld
{
protected:
CSMDoc::Document& mDocument;
bool mEditLock;
public:
DragRecordTable(CSMDoc::Document& document, QWidget* parent = NULL);
virtual std::vector<CSMWorld::UniversalId> getDragedRecords() const = 0;
virtual void setEditLock(bool locked);
protected:
void startDrag(const DragRecordTable& table);
};

@ -181,7 +181,7 @@ void CSVWorld::RegionMap::setRegion (const std::string& regionId)
CSVWorld::RegionMap::RegionMap (const CSMWorld::UniversalId& universalId,
CSMDoc::Document& document, QWidget *parent)
: mEditLock (false), DragRecordTable(document, parent)
: DragRecordTable(document, parent)
{
verticalHeader()->hide();
horizontalHeader()->hide();
@ -226,11 +226,6 @@ CSVWorld::RegionMap::RegionMap (const CSMWorld::UniversalId& universalId,
addAction (mViewInTableAction);
}
void CSVWorld::RegionMap::setEditLock (bool locked)
{
mEditLock = locked;
}
void CSVWorld::RegionMap::selectAll()
{
QModelIndexList unselected = getUnselectedCells();

@ -35,7 +35,6 @@ namespace CSVWorld
QAction *mUnsetRegionAction;
QAction *mViewAction;
QAction *mViewInTableAction;
bool mEditLock;
std::string mRegionId;
private:
@ -62,8 +61,6 @@ namespace CSVWorld
RegionMap (const CSMWorld::UniversalId& universalId, CSMDoc::Document& document,
QWidget *parent = 0);
void setEditLock (bool locked);
virtual std::vector<CSMWorld::UniversalId> getDragedRecords() const;
signals:

@ -188,7 +188,7 @@ std::vector<std::string> CSVWorld::Table::listDeletableSelectedIds() const
CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
bool createAndDelete, bool sorting, CSMDoc::Document& document)
: mCreateAction (0), mCloneAction(0), mEditLock (false), mRecordStatusDisplay (0),
: mCreateAction (0), mCloneAction(0), mRecordStatusDisplay (0),
DragRecordTable(document)
{
mModel = &dynamic_cast<CSMWorld::IdTable&> (*mDocument.getData().getTableModel (id));
@ -282,7 +282,7 @@ void CSVWorld::Table::setEditLock (bool locked)
for (std::vector<CommandDelegate *>::iterator iter (mDelegates.begin()); iter!=mDelegates.end(); ++iter)
(*iter)->setEditLock (locked);
mEditLock = locked;
DragRecordTable::setEditLock(locked);
}
CSMWorld::UniversalId CSVWorld::Table::getUniversalId (int row) const

@ -47,7 +47,6 @@ namespace CSVWorld
QAction *mPreviewAction;
CSMWorld::IdTableProxyModel *mProxyModel;
CSMWorld::IdTable *mModel;
bool mEditLock;
int mRecordStatusDisplay;
private:
@ -73,7 +72,7 @@ namespace CSVWorld
///< \param createAndDelete Allow creation and deletion of records.
/// \param sorting Allow changing order of rows in the view via column headers.
void setEditLock (bool locked);
virtual void setEditLock (bool locked);
CSMWorld::UniversalId getUniversalId (int row) const;

Loading…
Cancel
Save