Changeset 74265 in vbox
- Timestamp:
- Sep 14, 2018 1:42:41 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r72030 r74265 92 92 const char *UIExtraDataDefs::GUI_Toolbar_MachineTools_Order = "GUI/Toolbar/MachineTools/Order"; 93 93 const char *UIExtraDataDefs::GUI_Toolbar_GlobalTools_Order = "GUI/Toolbar/GlobalTools/Order"; 94 const char *UIExtraDataDefs::GUI_Tools_LastItemsSelected = "GUI/Tools/LastItemsSelected"; 94 95 const char *UIExtraDataDefs::GUI_Statusbar = "GUI/Statusbar"; 95 96 const char *UIExtraDataDefs::GUI_GroupDefinitions = "GUI/GroupDefinitions"; -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r73841 r74265 151 151 /** Holds the selector-window global tools order. */ 152 152 SHARED_LIBRARY_STUFF extern const char *GUI_Toolbar_GlobalTools_Order; 153 /** Holds the last selected tool set of VirtualBox Manager. */ 154 SHARED_LIBRARY_STUFF extern const char *GUI_Tools_LastItemsSelected; 153 155 /** Holds whether selector-window status-bar visible. */ 154 156 SHARED_LIBRARY_STUFF extern const char *GUI_Statusbar; -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r73507 r74265 1973 1973 << GUI_Toolbar << GUI_Toolbar_Text 1974 1974 << GUI_Toolbar_MachineTools_Order << GUI_Toolbar_GlobalTools_Order 1975 << GUI_Tools_LastItemsSelected 1975 1976 << GUI_Statusbar 1976 1977 << GUI_GroupDefinitions << GUI_LastItemSelected … … 2796 2797 } 2797 2798 2799 QString UIExtraDataManager::toolsPaneLastItemsChosen() 2800 { 2801 return extraDataString(GUI_Tools_LastItemsSelected); 2802 } 2803 2804 void UIExtraDataManager::setToolsPaneLastItemsChosen(const QString &strSet) 2805 { 2806 setExtraDataString(GUI_Tools_LastItemsSelected, strSet); 2807 } 2808 2798 2809 bool UIExtraDataManager::selectorWindowStatusBarVisible() 2799 2810 { -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r72030 r74265 318 318 /** Defines selector-window global tools @a aOrder. */ 319 319 void setSelectorWindowToolsOrderGlobal(const QList<ToolTypeGlobal> &aOrder); 320 321 /** Returns last selected tool set of VirtualBox Manager. */ 322 QString toolsPaneLastItemsChosen(); 323 /** Defines last selected tool @a strSet of VirtualBox Manager. */ 324 void setToolsPaneLastItemsChosen(const QString &strSet); 320 325 321 326 /** Returns whether selector-window status-bar visible. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp
r74260 r74265 561 561 : Qt::ToolButtonIconOnly); 562 562 } 563 564 /* Open tool currently chosen in Tools-pane: */ 565 sltHandleToolsPaneIndexChange(); 563 566 } 564 567 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UITools.h
r74249 r74265 42 42 enum UIToolsType 43 43 { 44 UIToolsType_Invalid, 44 45 /* Global class: */ 45 46 UIToolsType_Media, … … 49 50 UIToolsType_Snapshots, 50 51 UIToolsType_Logs, 51 /* Max */52 UIToolsType_Max53 52 }; 54 53 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.cpp
r74264 r74265 152 152 /* Set this item to current if navigation list contains it: */ 153 153 if (navigationList().contains(pItem)) 154 { 154 155 m_pCurrentItem = pItem; 156 switch (m_pCurrentItem->itemClass()) 157 { 158 case UIToolsClass_Global: m_pLastItemGlobal = m_pCurrentItem; break; 159 case UIToolsClass_Machine: m_pLastItemMachine = m_pCurrentItem; break; 160 } 161 } 155 162 /* Otherwise it's error: */ 156 163 else … … 250 257 if (pItem->isVisible()) 251 258 m_navigationList << pItem; 259 260 /* Choose last selected item of current class: */ 261 UIToolsItem *pLastSelectedItem = m_enmCurrentClass == UIToolsClass_Global 262 ? m_pLastItemGlobal : m_pLastItemMachine; 263 if (navigationList().contains(pLastSelectedItem)) 264 setCurrentItem(pLastSelectedItem); 252 265 } 253 266 … … 418 431 void UIToolsModel::loadLastSelectedItems() 419 432 { 420 /// @todo implement 433 /* Load selected items data: */ 434 const QString strData = gEDataManager->toolsPaneLastItemsChosen(); 435 436 /* Split serialized data to pair of values: */ 437 const QStringList values = strData.split(","); 438 439 /* First of them is current global class item definition: */ 440 UIToolsType enmTypeGlobal = typeFromString(values.value(0)); 441 if (!isTypeOfClass(enmTypeGlobal, UIToolsClass_Global)) 442 enmTypeGlobal = UIToolsType_Media; 443 foreach (UIToolsItem *pItem, items()) 444 if (pItem->itemType() == enmTypeGlobal) 445 m_pLastItemGlobal = pItem; 446 AssertPtr(m_pLastItemGlobal.data()); 447 448 /* Second of them is current machine class item definition: */ 449 UIToolsType enmTypeMachine = typeFromString(values.value(1)); 450 if (!isTypeOfClass(enmTypeMachine, UIToolsClass_Machine)) 451 enmTypeMachine = UIToolsType_Details; 452 foreach (UIToolsItem *pItem, items()) 453 if (pItem->itemType() == enmTypeMachine) 454 m_pLastItemMachine = pItem; 455 AssertPtr(m_pLastItemMachine.data()); 421 456 } 422 457 423 458 void UIToolsModel::saveLastSelectedItems() 424 459 { 425 /// @todo implement 460 /* Prepare selected items data: */ 461 const QString strData = QString("%1,%2") 462 .arg(typeToString(m_pLastItemGlobal->itemType())) 463 .arg(typeToString(m_pLastItemMachine->itemType())); 464 465 /* Save selected items data: */ 466 gEDataManager->setToolsPaneLastItemsChosen(strData); 426 467 } 427 468 … … 456 497 cleanupScene(); 457 498 } 499 500 /* static */ 501 QString UIToolsModel::typeToString(UIToolsType enmType) 502 { 503 switch (enmType) 504 { 505 /* Global classes: */ 506 case UIToolsType_Media: return "Media"; 507 case UIToolsType_Network: return "Network"; 508 /* Machine classes: */ 509 case UIToolsType_Details: return "Details"; 510 case UIToolsType_Snapshots: return "Snapshots"; 511 case UIToolsType_Logs: return "Logs"; 512 default: break; 513 } 514 return QString(); 515 } 516 517 /* static */ 518 UIToolsType UIToolsModel::typeFromString(const QString &strType) 519 { 520 /* Global classes: */ 521 if (strType == "Media") return UIToolsType_Media; 522 else if (strType == "Network") return UIToolsType_Network; 523 /* Machine classes: */ 524 else if (strType == "Details") return UIToolsType_Details; 525 else if (strType == "Snapshots") return UIToolsType_Snapshots; 526 else if (strType == "Logs") return UIToolsType_Logs; 527 return UIToolsType_Invalid; 528 } 529 530 /* static */ 531 bool UIToolsModel::isTypeOfClass(UIToolsType enmType, UIToolsClass enmClass) 532 { 533 switch (enmClass) 534 { 535 case UIToolsClass_Global: 536 { 537 switch (enmType) 538 { 539 case UIToolsType_Media: 540 case UIToolsType_Network: 541 return true; 542 default: 543 break; 544 } 545 break; 546 } 547 case UIToolsClass_Machine: 548 { 549 switch (enmType) 550 { 551 case UIToolsType_Details: 552 case UIToolsType_Snapshots: 553 case UIToolsType_Logs: 554 return true; 555 default: 556 break; 557 } 558 break; 559 } 560 } 561 return false; 562 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.h
r74264 r74265 206 206 /** @name General stuff. 207 207 * @{ */ 208 /** Returns @a enmType string representation. 209 * @todo move to UIConverter one day .. */ 210 static QString typeToString(UIToolsType enmType); 211 /** Returns @a strType converted to corresponding UIToolsType. 212 * @todo move to UIConverter one day .. */ 213 static UIToolsType typeFromString(const QString &strType); 214 215 /** Returns whether passed @a enmType is of passed @a enmClass. */ 216 static bool isTypeOfClass(UIToolsType enmType, UIToolsClass enmClass); 217 /** @} */ 218 219 /** @name General stuff. 220 * @{ */ 208 221 /** Holds the Tools reference. */ 209 222 UITools *m_pTools; … … 239 252 /** Holds the navigation list. */ 240 253 QList<UIToolsItem*> m_navigationList; 254 255 /** Holds the last chosen navigation item of global class. */ 256 QPointer<UIToolsItem> m_pLastItemGlobal; 257 /** Holds the last chosen navigation item of machine class. */ 258 QPointer<UIToolsItem> m_pLastItemMachine; 241 259 /** @} */ 242 260 };
Note:
See TracChangeset
for help on using the changeset viewer.