Changeset 84424 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 20, 2020 5:29:53 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp
r84423 r84424 189 189 // Currently we are not saving group descriptors 190 190 // (which reflecting group toggle-state) on-the-fly, 191 // so for now we are additionally save group orders191 // so for now we are additionally save group definitions 192 192 // when exiting application: 193 saveGroup Orders();193 saveGroupDefinitions(); 194 194 195 195 /* Make sure all saving steps complete: */ 196 196 makeSureGroupSettingsSaveIsFinished(); 197 makeSureGroup OrdersSaveIsFinished();197 makeSureGroupDefinitionsSaveIsFinished(); 198 198 199 199 /* Delete tree: */ … … 307 307 { 308 308 return UIThreadGroupSettingsSave::instance() 309 || UIThreadGroup OrderSave::instance();309 || UIThreadGroupDefinitionsSave::instance(); 310 310 } 311 311 … … 470 470 { 471 471 saveGroupSettings(); 472 saveGroup Orders();472 saveGroupDefinitions(); 473 473 } 474 474 … … 532 532 } 533 533 534 void UIChooserAbstractModel::sltGroup OrdersSaveComplete()535 { 536 makeSureGroup OrdersSaveIsFinished();534 void UIChooserAbstractModel::sltGroupDefinitionsSaveComplete() 535 { 536 makeSureGroupDefinitionsSaveIsFinished(); 537 537 emit sigGroupSavingStateChanged(); 538 538 } … … 1012 1012 } 1013 1013 1014 void UIChooserAbstractModel::saveGroup Orders()1015 { 1016 /* Make sure there is no group save activity: */1017 if (UIThreadGroup OrderSave::instance())1014 void UIChooserAbstractModel::saveGroupDefinitions() 1015 { 1016 /* Make sure there is no group definitions save activity: */ 1017 if (UIThreadGroupDefinitionsSave::instance()) 1018 1018 return; 1019 1019 1020 1020 /* Prepare full group map: */ 1021 1021 QMap<QString, QStringList> groups; 1022 gatherGroup Orders(groups, invisibleRoot());1022 gatherGroupDefinitions(groups, invisibleRoot()); 1023 1023 1024 1024 /* Save information in other thread: */ 1025 UIThreadGroup OrderSave::prepare();1025 UIThreadGroupDefinitionsSave::prepare(); 1026 1026 emit sigGroupSavingStateChanged(); 1027 UIThreadGroup OrderSave::instance()->configure(this, groups);1028 UIThreadGroup OrderSave::instance()->start();1027 UIThreadGroupDefinitionsSave::instance()->configure(this, groups); 1028 UIThreadGroupDefinitionsSave::instance()->start(); 1029 1029 } 1030 1030 … … 1049 1049 } 1050 1050 1051 void UIChooserAbstractModel::gatherGroup Orders(QMap<QString, QStringList> &orders,1052 UIChooserNode *pParentGroup)1051 void UIChooserAbstractModel::gatherGroupDefinitions(QMap<QString, QStringList> &definitions, 1052 UIChooserNode *pParentGroup) 1053 1053 { 1054 1054 /* Prepare extra-data key for current group: */ … … 1059 1059 /* Append node definition: */ 1060 1060 AssertPtrReturnVoid(pNode); 1061 orders[strExtraDataKey] << pNode->definition(true /* full */);1061 definitions[strExtraDataKey] << pNode->definition(true /* full */); 1062 1062 } 1063 1063 /* Iterate over all the group-nodes: */ … … 1066 1066 /* Append node definition: */ 1067 1067 AssertPtrReturnVoid(pNode); 1068 orders[strExtraDataKey] << pNode->definition(true /* full */);1068 definitions[strExtraDataKey] << pNode->definition(true /* full */); 1069 1069 /* Go recursively through children: */ 1070 gatherGroup Orders(orders, pNode);1070 gatherGroupDefinitions(definitions, pNode); 1071 1071 } 1072 1072 /* Iterate over all the machine-nodes: */ … … 1080 1080 if ( pMachineNode->cacheType() == UIVirtualMachineItemType_Local 1081 1081 || pMachineNode->cacheType() == UIVirtualMachineItemType_CloudReal) 1082 orders[strExtraDataKey] << pNode->definition(true /* full */);1082 definitions[strExtraDataKey] << pNode->definition(true /* full */); 1083 1083 } 1084 1084 } … … 1091 1091 } 1092 1092 1093 void UIChooserAbstractModel::makeSureGroup OrdersSaveIsFinished()1093 void UIChooserAbstractModel::makeSureGroupDefinitionsSaveIsFinished() 1094 1094 { 1095 1095 /* Cleanup if necessary: */ 1096 if (UIThreadGroup OrderSave::instance())1097 UIThreadGroup OrderSave::cleanup();1096 if (UIThreadGroupDefinitionsSave::instance()) 1097 UIThreadGroupDefinitionsSave::cleanup(); 1098 1098 } 1099 1099 … … 1140 1140 m_oldLists = oldLists; 1141 1141 m_newLists = newLists; 1142 UIChooserAbstractModel *pChooserAbstractModel = qobject_cast<UIChooserAbstractModel*>(pParent);1142 UIChooserAbstractModel *pChooserAbstractModel = qobject_cast<UIChooserAbstractModel*>(pParent); 1143 1143 AssertPtrReturnVoid(pChooserAbstractModel); 1144 1144 { … … 1232 1232 1233 1233 /********************************************************************************************************************************* 1234 * Class UIThreadGroup OrderSave implementation.*1234 * Class UIThreadGroupDefinitionsSave implementation. * 1235 1235 *********************************************************************************************************************************/ 1236 1236 1237 1237 /* static */ 1238 UIThreadGroup OrderSave *UIThreadGroupOrderSave::s_pInstance = 0;1238 UIThreadGroupDefinitionsSave *UIThreadGroupDefinitionsSave::s_pInstance = 0; 1239 1239 1240 1240 /* static */ 1241 UIThreadGroup OrderSave *UIThreadGroupOrderSave::instance()1241 UIThreadGroupDefinitionsSave *UIThreadGroupDefinitionsSave::instance() 1242 1242 { 1243 1243 return s_pInstance; … … 1245 1245 1246 1246 /* static */ 1247 void UIThreadGroup OrderSave::prepare()1248 { 1249 /* Make sure instance not prepared: */1247 void UIThreadGroupDefinitionsSave::prepare() 1248 { 1249 /* Make sure instance is not prepared: */ 1250 1250 if (s_pInstance) 1251 1251 return; 1252 1252 1253 1253 /* Crate instance: */ 1254 new UIThreadGroup OrderSave;1254 new UIThreadGroupDefinitionsSave; 1255 1255 } 1256 1256 1257 1257 /* static */ 1258 void UIThreadGroup OrderSave::cleanup()1259 { 1260 /* Make sure instance prepared: */1258 void UIThreadGroupDefinitionsSave::cleanup() 1259 { 1260 /* Make sure instance is prepared: */ 1261 1261 if (!s_pInstance) 1262 1262 return; 1263 1263 1264 /* Crate instance: */1264 /* Delete instance: */ 1265 1265 delete s_pInstance; 1266 1266 } 1267 1267 1268 void UIThreadGroup OrderSave::configure(QObject *pParent,1269 const QMap<QString, QStringList> &groups)1270 { 1271 m_ groups = groups;1268 void UIThreadGroupDefinitionsSave::configure(QObject *pParent, 1269 const QMap<QString, QStringList> &groups) 1270 { 1271 m_lists = groups; 1272 1272 UIChooserAbstractModel *pChooserAbstractModel = qobject_cast<UIChooserAbstractModel*>(pParent); 1273 1273 AssertPtrReturnVoid(pChooserAbstractModel); 1274 1274 { 1275 connect(this, &UIThreadGroup OrderSave::sigComplete,1276 pChooserAbstractModel, &UIChooserAbstractModel::sltGroup OrdersSaveComplete);1277 } 1278 } 1279 1280 UIThreadGroup OrderSave::UIThreadGroupOrderSave()1275 connect(this, &UIThreadGroupDefinitionsSave::sigComplete, 1276 pChooserAbstractModel, &UIChooserAbstractModel::sltGroupDefinitionsSaveComplete); 1277 } 1278 } 1279 1280 UIThreadGroupDefinitionsSave::UIThreadGroupDefinitionsSave() 1281 1281 { 1282 1282 /* Assign instance: */ … … 1284 1284 } 1285 1285 1286 UIThreadGroup OrderSave::~UIThreadGroupOrderSave()1287 { 1288 /* Wait: */1286 UIThreadGroupDefinitionsSave::~UIThreadGroupDefinitionsSave() 1287 { 1288 /* Make sure thread work is complete: */ 1289 1289 wait(); 1290 1290 … … 1293 1293 } 1294 1294 1295 void UIThreadGroup OrderSave::run()1295 void UIThreadGroupDefinitionsSave::run() 1296 1296 { 1297 1297 /* COM prepare: */ … … 1301 1301 gEDataManager->clearSelectorWindowGroupsDefinitions(); 1302 1302 /* For every particular group definition: */ 1303 foreach (const QString &strId, m_ groups.keys())1304 gEDataManager->setSelectorWindowGroupsDefinitions(strId, m_ groups[strId]);1303 foreach (const QString &strId, m_lists.keys()) 1304 gEDataManager->setSelectorWindowGroupsDefinitions(strId, m_lists[strId]); 1305 1305 1306 1306 /* Notify listeners about completeness: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.h
r84423 r84424 130 130 /** Handles group settings saving complete. */ 131 131 void sltGroupSettingsSaveComplete(); 132 /** Handles group ordersaving complete. */133 void sltGroup OrdersSaveComplete();132 /** Handles group definitions saving complete. */ 133 void sltGroupDefinitionsSaveComplete(); 134 134 /** @} */ 135 135 … … 227 227 /** Saves group settings. */ 228 228 void saveGroupSettings(); 229 /** Saves group orders. */230 void saveGroup Orders();229 /** Saves group definitions. */ 230 void saveGroupDefinitions(); 231 231 232 232 /** Gathers group @a settings of @a pParentGroup. */ 233 233 void gatherGroupSettings(QMap<QString, QStringList> &settings, UIChooserNode *pParentGroup); 234 /** Gathers group @a orders of @a pParentGroup. */235 void gatherGroup Orders(QMap<QString, QStringList> &orders, UIChooserNode *pParentGroup);234 /** Gathers group @a definitions of @a pParentGroup. */ 235 void gatherGroupDefinitions(QMap<QString, QStringList> &definitions, UIChooserNode *pParentGroup); 236 236 237 237 /** Makes sure group settings saving is finished. */ 238 238 void makeSureGroupSettingsSaveIsFinished(); 239 /** Makes sure group orders saving is finished. */240 void makeSureGroup OrdersSaveIsFinished();239 /** Makes sure group definitions saving is finished. */ 240 void makeSureGroupDefinitionsSaveIsFinished(); 241 241 /** @} */ 242 242 … … 261 261 /** @name Group saving stuff. 262 262 * @{ */ 263 /** Holds the consolidated map of group settings/ orders. */263 /** Holds the consolidated map of group settings/definitions. */ 264 264 QMap<QString, QStringList> m_groups; 265 265 /** @} */ … … 316 316 317 317 318 /** QThread subclass allowing to save group orderasynchronously. */319 class UIThreadGroup OrderSave : public QThread318 /** QThread subclass allowing to save group definitions asynchronously. */ 319 class UIThreadGroupDefinitionsSave : public QThread 320 320 { 321 321 Q_OBJECT; … … 328 328 public: 329 329 330 /** Returns group saving thread instance. */331 static UIThreadGroup OrderSave *instance();332 /** Prepares group saving thread instance. */330 /** Returns group definitions saving thread instance. */ 331 static UIThreadGroupDefinitionsSave *instance(); 332 /** Prepares group definitions saving thread instance. */ 333 333 static void prepare(); 334 /** Cleanups group saving thread instance. */334 /** Cleanups group definitions saving thread instance. */ 335 335 static void cleanup(); 336 336 337 /** Configures group saving thread with corresponding @a pListener.338 * @param groups Brings the groups to be saved. */337 /** Configures group definitions saving thread with corresponding @a pListener. 338 * @param lists Brings definitions lists to be saved. */ 339 339 void configure(QObject *pListener, 340 const QMap<QString, QStringList> & groups);340 const QMap<QString, QStringList> &lists); 341 341 342 342 protected: 343 343 344 /** Constructs group saving thread. */345 UIThreadGroup OrderSave();346 /** Destructs group saving thread. */347 virtual ~UIThreadGroup OrderSave() /* override */;344 /** Constructs group definitions saving thread. */ 345 UIThreadGroupDefinitionsSave(); 346 /** Destructs group definitions saving thread. */ 347 virtual ~UIThreadGroupDefinitionsSave() /* override */; 348 348 349 349 /** Contains a thread task to be executed. */ … … 351 351 352 352 /** Holds the singleton instance. */ 353 static UIThreadGroup OrderSave *s_pInstance;354 355 /** Holds the map of group s to be saved. */356 QMap<QString, QStringList> m_ groups;353 static UIThreadGroupDefinitionsSave *s_pInstance; 354 355 /** Holds the map of group definitions to be saved. */ 356 QMap<QString, QStringList> m_lists; 357 357 }; 358 358
Note:
See TracChangeset
for help on using the changeset viewer.