added 'view in table' action to region map

actorid
Marc Zinnschlag 11 years ago
parent 2eca9e72fd
commit 097c063b8a

@ -56,6 +56,8 @@ void CSVWorld::RegionMap::contextMenuEvent (QContextMenuEvent *event)
}
menu.addAction (mUnsetRegionAction);
menu.addAction (mViewInTableAction);
}
if (selectionModel()->selectedIndexes().size()>0)
@ -217,6 +219,10 @@ CSVWorld::RegionMap::RegionMap (const CSMWorld::UniversalId& universalId,
mViewAction = new QAction (tr ("View Cells"), this);
connect (mViewAction, SIGNAL (triggered()), this, SLOT (view()));
addAction (mViewAction);
mViewInTableAction = new QAction (tr ("View Cells in Table"), this);
connect (mViewInTableAction, SIGNAL (triggered()), this, SLOT (viewInTable()));
addAction (mViewInTableAction);
}
void CSVWorld::RegionMap::setEditLock (bool locked)
@ -310,4 +316,31 @@ void CSVWorld::RegionMap::view()
emit editRequest (CSMWorld::UniversalId (CSMWorld::UniversalId::Type_Scene, "sys::default"),
hint.str());
}
void CSVWorld::RegionMap::viewInTable()
{
std::ostringstream hint;
hint << "f:!or(";
QModelIndexList selected = getSelectedCells();
bool first = true;
for (QModelIndexList::const_iterator iter (selected.begin()); iter!=selected.end(); ++iter)
{
std::string cellId = model()->data (*iter, CSMWorld::RegionMap::Role_CellId).
toString().toUtf8().constData();
if (first)
first = false;
else
hint << ",";
hint << "string(ID,\"" << cellId << "\")";
}
hint << ")";
emit editRequest (CSMWorld::UniversalId::Type_Cells, hint.str());
}

@ -28,6 +28,7 @@ namespace CSVWorld
QAction *mSetRegionAction;
QAction *mUnsetRegionAction;
QAction *mViewAction;
QAction *mViewInTableAction;
bool mEditLock;
CSMDoc::Document& mDocument;
std::string mRegionId;
@ -75,6 +76,8 @@ namespace CSVWorld
void unsetRegion();
void view();
void viewInTable();
};
}

Loading…
Cancel
Save