mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-25 11:26:37 +00:00 
			
		
		
		
	added 'view in table' action to region map
This commit is contained in:
		
							parent
							
								
									2eca9e72fd
								
							
						
					
					
						commit
						097c063b8a
					
				
					 2 changed files with 36 additions and 0 deletions
				
			
		|  | @ -56,6 +56,8 @@ void CSVWorld::RegionMap::contextMenuEvent (QContextMenuEvent *event) | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         menu.addAction (mUnsetRegionAction); |         menu.addAction (mUnsetRegionAction); | ||||||
|  | 
 | ||||||
|  |         menu.addAction (mViewInTableAction); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (selectionModel()->selectedIndexes().size()>0) |     if (selectionModel()->selectedIndexes().size()>0) | ||||||
|  | @ -217,6 +219,10 @@ CSVWorld::RegionMap::RegionMap (const CSMWorld::UniversalId& universalId, | ||||||
|     mViewAction = new QAction (tr ("View Cells"), this); |     mViewAction = new QAction (tr ("View Cells"), this); | ||||||
|     connect (mViewAction, SIGNAL (triggered()), this, SLOT (view())); |     connect (mViewAction, SIGNAL (triggered()), this, SLOT (view())); | ||||||
|     addAction (mViewAction); |     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) | void CSVWorld::RegionMap::setEditLock (bool locked) | ||||||
|  | @ -310,4 +316,31 @@ void CSVWorld::RegionMap::view() | ||||||
| 
 | 
 | ||||||
|     emit editRequest (CSMWorld::UniversalId (CSMWorld::UniversalId::Type_Scene, "sys::default"), |     emit editRequest (CSMWorld::UniversalId (CSMWorld::UniversalId::Type_Scene, "sys::default"), | ||||||
|         hint.str()); |         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 *mSetRegionAction; | ||||||
|             QAction *mUnsetRegionAction; |             QAction *mUnsetRegionAction; | ||||||
|             QAction *mViewAction; |             QAction *mViewAction; | ||||||
|  |             QAction *mViewInTableAction; | ||||||
|             bool mEditLock; |             bool mEditLock; | ||||||
|             CSMDoc::Document& mDocument; |             CSMDoc::Document& mDocument; | ||||||
|             std::string mRegionId; |             std::string mRegionId; | ||||||
|  | @ -75,6 +76,8 @@ namespace CSVWorld | ||||||
|             void unsetRegion(); |             void unsetRegion(); | ||||||
| 
 | 
 | ||||||
|             void view(); |             void view(); | ||||||
|  | 
 | ||||||
|  |             void viewInTable(); | ||||||
|     }; |     }; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue