Changeset 68304 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 4, 2017 4:15:21 PM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r66588 r68304 85 85 template<> bool canConvert<UIExtraDataMetaDefs::MenuWindowActionType>(); 86 86 #endif /* VBOX_WS_MAC */ 87 template<> bool canConvert<ToolTypeMachine>(); 88 template<> bool canConvert<ToolTypeGlobal>(); 87 89 template<> bool canConvert<UIVisualStateType>(); 88 90 template<> bool canConvert<DetailsElementType>(); … … 157 159 template<> UIExtraDataMetaDefs::MenuWindowActionType fromInternalString<UIExtraDataMetaDefs::MenuWindowActionType>(const QString &strMenuWindowActionType); 158 160 #endif /* VBOX_WS_MAC */ 161 template<> QString toInternalString(const ToolTypeMachine &enmToolTypeMachine); 162 template<> ToolTypeMachine fromInternalString<ToolTypeMachine>(const QString &strToolTypeMachine); 163 template<> QString toInternalString(const ToolTypeGlobal &enmToolTypeGlobal); 164 template<> ToolTypeGlobal fromInternalString<ToolTypeGlobal>(const QString &strToolTypeGlobal); 159 165 template<> QString toInternalString(const UIVisualStateType &visualStateType); 160 166 template<> UIVisualStateType fromInternalString<UIVisualStateType>(const QString &strVisualStateType); -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r66588 r68304 53 53 template<> bool canConvert<UIExtraDataMetaDefs::MenuWindowActionType>() { return true; } 54 54 #endif /* VBOX_WS_MAC */ 55 template<> bool canConvert<ToolTypeMachine>() { return true; } 56 template<> bool canConvert<ToolTypeGlobal>() { return true; } 55 57 template<> bool canConvert<UIVisualStateType>() { return true; } 56 58 template<> bool canConvert<DetailsElementType>() { return true; } … … 856 858 #endif /* VBOX_WS_MAC */ 857 859 860 /* QString <= ToolTypeMachine: */ 861 template<> QString toInternalString(const ToolTypeMachine &enmToolTypeMachine) 862 { 863 QString strResult; 864 switch (enmToolTypeMachine) 865 { 866 case ToolTypeMachine_Details: strResult = "Details"; break; 867 case ToolTypeMachine_Snapshots: strResult = "Snapshots"; break; 868 default: 869 { 870 AssertMsgFailed(("No text for machine tool type=%d", enmToolTypeMachine)); 871 break; 872 } 873 } 874 return strResult; 875 } 876 877 /* ToolTypeMachine <= QString: */ 878 template<> ToolTypeMachine fromInternalString<ToolTypeMachine>(const QString &strToolTypeMachine) 879 { 880 /* Here we have some fancy stuff allowing us 881 * to search through the keys using 'case-insensitive' rule: */ 882 QStringList keys; QList<ToolTypeMachine> values; 883 keys << "Details"; values << ToolTypeMachine_Details; 884 keys << "Snapshots"; values << ToolTypeMachine_Snapshots; 885 /* Invalid type for unknown words: */ 886 if (!keys.contains(strToolTypeMachine, Qt::CaseInsensitive)) 887 return ToolTypeMachine_Invalid; 888 /* Corresponding type for known words: */ 889 return values.at(keys.indexOf(QRegExp(strToolTypeMachine, Qt::CaseInsensitive))); 890 } 891 892 /* QString <= ToolTypeGlobal: */ 893 template<> QString toInternalString(const ToolTypeGlobal &enmToolTypeGlobal) 894 { 895 QString strResult; 896 switch (enmToolTypeGlobal) 897 { 898 case ToolTypeGlobal_VirtualMedia: strResult = "VirtualMedia"; break; 899 case ToolTypeGlobal_HostNetwork: strResult = "HostNetwork"; break; 900 default: 901 { 902 AssertMsgFailed(("No text for global tool type=%d", enmToolTypeGlobal)); 903 break; 904 } 905 } 906 return strResult; 907 } 908 909 /* ToolTypeGlobal <= QString: */ 910 template<> ToolTypeGlobal fromInternalString<ToolTypeGlobal>(const QString &strToolTypeGlobal) 911 { 912 /* Here we have some fancy stuff allowing us 913 * to search through the keys using 'case-insensitive' rule: */ 914 QStringList keys; QList<ToolTypeGlobal> values; 915 keys << "VirtualMedia"; values << ToolTypeGlobal_VirtualMedia; 916 keys << "HostNetwork"; values << ToolTypeGlobal_HostNetwork; 917 /* Invalid type for unknown words: */ 918 if (!keys.contains(strToolTypeGlobal, Qt::CaseInsensitive)) 919 return ToolTypeGlobal_Invalid; 920 /* Corresponding type for known words: */ 921 return values.at(keys.indexOf(QRegExp(strToolTypeGlobal, Qt::CaseInsensitive))); 922 } 923 858 924 /* QString <= UIVisualStateType: */ 859 925 template<> QString toInternalString(const UIVisualStateType &visualStateType) -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r68212 r68304 81 81 const char* UIExtraDataDefs::GUI_Toolbar = "GUI/Toolbar"; 82 82 const char* UIExtraDataDefs::GUI_Toolbar_Text = "GUI/Toolbar/Text"; 83 const char* UIExtraDataDefs::GUI_Toolbar_MachineTools_Order = "GUI/Toolbar/MachineTools/Order"; 84 const char* UIExtraDataDefs::GUI_Toolbar_GlobalTools_Order = "GUI/Toolbar/GlobalTools/Order"; 83 85 const char* UIExtraDataDefs::GUI_Statusbar = "GUI/Statusbar"; 84 86 const char* UIExtraDataDefs::GUI_GroupDefinitions = "GUI/GroupDefinitions"; -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r68212 r68304 136 136 /** Holds whether selector-window tool-bar text visible. */ 137 137 extern const char* GUI_Toolbar_Text; 138 /** Holds the selector-window machine tools order. */ 139 extern const char* GUI_Toolbar_MachineTools_Order; 140 /** Holds the selector-window global tools order. */ 141 extern const char* GUI_Toolbar_GlobalTools_Order; 138 142 /** Holds whether selector-window status-bar visible. */ 139 143 extern const char* GUI_Statusbar; … … 599 603 600 604 605 /** Selector UI: Machine tool types. */ 606 enum ToolTypeMachine 607 { 608 ToolTypeMachine_Invalid, 609 ToolTypeMachine_Desktop, 610 ToolTypeMachine_Details, 611 ToolTypeMachine_Snapshots, 612 }; 613 Q_DECLARE_METATYPE(ToolTypeMachine); 614 615 /** Selector UI: Global tool types. */ 616 enum ToolTypeGlobal 617 { 618 ToolTypeGlobal_Invalid, 619 ToolTypeGlobal_Desktop, 620 ToolTypeGlobal_VirtualMedia, 621 ToolTypeGlobal_HostNetwork, 622 }; 623 Q_DECLARE_METATYPE(ToolTypeGlobal); 624 601 625 /** Selector UI: Details-element types. */ 602 626 enum DetailsElementType -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r68212 r68304 1948 1948 << GUI_RecentListHD << GUI_RecentListCD << GUI_RecentListFD 1949 1949 << GUI_LastSelectorWindowPosition << GUI_SplitterSizes 1950 << GUI_Toolbar << GUI_Toolbar_Text << GUI_Statusbar 1950 << GUI_Toolbar << GUI_Toolbar_Text 1951 << GUI_Toolbar_MachineTools_Order << GUI_Toolbar_GlobalTools_Order 1952 << GUI_Statusbar 1951 1953 << GUI_GroupDefinitions << GUI_LastItemSelected 1952 1954 << GUI_DetailsPageBoxes << GUI_PreviewUpdate … … 2687 2689 } 2688 2690 2691 QList<ToolTypeMachine> UIExtraDataManager::selectorWindowToolsOrderMachine() 2692 { 2693 /* Prepare result: */ 2694 QList<ToolTypeMachine> result; 2695 /* Get machine tools order: */ 2696 foreach (const QString &strValue, extraDataStringList(GUI_Toolbar_MachineTools_Order)) 2697 { 2698 const ToolTypeMachine enmValue = gpConverter->fromInternalString<ToolTypeMachine>(strValue); 2699 if (enmValue != ToolTypeMachine_Invalid && !result.contains(enmValue)) 2700 result << enmValue; 2701 } 2702 /* Return result: */ 2703 return result; 2704 } 2705 2706 void UIExtraDataManager::setSelectorWindowToolsOrderMachine(const QList<ToolTypeMachine> &aOrder) 2707 { 2708 /* Parse passed list: */ 2709 QStringList aSerializedOrder; 2710 foreach (const ToolTypeMachine &enmToolType, aOrder) 2711 aSerializedOrder << gpConverter->toInternalString(enmToolType); 2712 2713 /* Re-cache corresponding extra-data: */ 2714 setExtraDataStringList(GUI_Toolbar_MachineTools_Order, aSerializedOrder); 2715 } 2716 2717 QList<ToolTypeGlobal> UIExtraDataManager::selectorWindowToolsOrderGlobal() 2718 { 2719 /* Prepare result: */ 2720 QList<ToolTypeGlobal> result; 2721 /* Get global tools order: */ 2722 foreach (const QString &strValue, extraDataStringList(GUI_Toolbar_GlobalTools_Order)) 2723 { 2724 const ToolTypeGlobal enmValue = gpConverter->fromInternalString<ToolTypeGlobal>(strValue); 2725 if (enmValue != ToolTypeGlobal_Invalid && !result.contains(enmValue)) 2726 result << enmValue; 2727 } 2728 /* Return result: */ 2729 return result; 2730 } 2731 2732 void UIExtraDataManager::setSelectorWindowToolsOrderGlobal(const QList<ToolTypeGlobal> &aOrder) 2733 { 2734 /* Parse passed list: */ 2735 QStringList aSerializedOrder; 2736 foreach (const ToolTypeGlobal &enmToolType, aOrder) 2737 aSerializedOrder << gpConverter->toInternalString(enmToolType); 2738 2739 /* Re-cache corresponding extra-data: */ 2740 setExtraDataStringList(GUI_Toolbar_GlobalTools_Order, aSerializedOrder); 2741 } 2742 2689 2743 bool UIExtraDataManager::selectorWindowStatusBarVisible() 2690 2744 { -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r68212 r68304 301 301 /** Defines whether selector-window tool-bar text @a fVisible. */ 302 302 void setSelectorWindowToolBarTextVisible(bool fVisible); 303 304 /** Returns selector-window machine tools order. */ 305 QList<ToolTypeMachine> selectorWindowToolsOrderMachine(); 306 /** Defines selector-window machine tools @a aOrder. */ 307 void setSelectorWindowToolsOrderMachine(const QList<ToolTypeMachine> &aOrder); 308 309 /** Returns selector-window global tools order. */ 310 QList<ToolTypeGlobal> selectorWindowToolsOrderGlobal(); 311 /** Defines selector-window global tools @a aOrder. */ 312 void setSelectorWindowToolsOrderGlobal(const QList<ToolTypeGlobal> &aOrder); 303 313 304 314 /** Returns whether selector-window status-bar visible. */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r68285 r68304 154 154 { 155 155 // WORKAROUND: 156 // By some reason some of X11 DEs unable to update() 157 // tab-bars on startup. Let's try to _create_ them instead. 158 /* Make sure 'Details' and 'Snapshots' Machine tools ares opened at startup for now: */ 159 actionPool()->action(UIActionIndexST_M_Tools_M_Machine_Snapshots)->trigger(); 160 actionPool()->action(UIActionIndexST_M_Tools_M_Machine_Details)->trigger(); 156 // By some reason some of X11 DEs unable to update() tab-bars on startup. 157 // Let's just _create_ them later, asynchronously after the showEvent(). 158 /* Restore previously opened Machine tools at startup: */ 159 QMap<ToolTypeMachine, QAction*> mapActionsMachine; 160 mapActionsMachine[ToolTypeMachine_Details] = actionPool()->action(UIActionIndexST_M_Tools_M_Machine_Details); 161 mapActionsMachine[ToolTypeMachine_Snapshots] = actionPool()->action(UIActionIndexST_M_Tools_M_Machine_Snapshots); 162 for (int i = m_orderMachine.size() - 1; i >= 0; --i) 163 mapActionsMachine.value(m_orderMachine.at(i))->trigger(); 164 /* Make sure further action triggering cause tool type switch as well: */ 165 actionPool()->action(UIActionIndexST_M_Tools_T_Machine)->setProperty("watch_child_activation", true); 161 166 } 162 167 } … … 1106 1111 { 1107 1112 /* First, make sure corresponding tool set opened: */ 1108 if (!actionPool()->action(UIActionIndexST_M_Tools_T_Machine)->isChecked()) 1113 if ( !actionPool()->action(UIActionIndexST_M_Tools_T_Machine)->isChecked() 1114 && actionPool()->action(UIActionIndexST_M_Tools_T_Machine)->property("watch_child_activation").toBool()) 1109 1115 actionPool()->action(UIActionIndexST_M_Tools_T_Machine)->setChecked(true); 1110 1116 … … 1127 1133 { 1128 1134 /* First, make sure corresponding tool set opened: */ 1129 if (!actionPool()->action(UIActionIndexST_M_Tools_T_Global)->isChecked()) 1135 if ( !actionPool()->action(UIActionIndexST_M_Tools_T_Global)->isChecked() 1136 && actionPool()->action(UIActionIndexST_M_Tools_T_Global)->property("watch_child_activation").toBool()) 1130 1137 actionPool()->action(UIActionIndexST_M_Tools_T_Global)->setChecked(true); 1131 1138 … … 2115 2122 statusBar()->setHidden(!gEDataManager->selectorWindowStatusBarVisible()); 2116 2123 } 2124 2125 /* Restore toolbar Machine/Global tools orders: */ 2126 { 2127 m_orderMachine = gEDataManager->selectorWindowToolsOrderMachine(); 2128 m_orderGlobal = gEDataManager->selectorWindowToolsOrderGlobal(); 2129 2130 /* We can restore previously opened Global tools right here: */ 2131 QMap<ToolTypeGlobal, QAction*> mapActionsGlobal; 2132 mapActionsGlobal[ToolTypeGlobal_VirtualMedia] = actionPool()->action(UIActionIndexST_M_Tools_M_Global_VirtualMediaManager); 2133 mapActionsGlobal[ToolTypeGlobal_HostNetwork] = actionPool()->action(UIActionIndexST_M_Tools_M_Global_HostNetworkManager); 2134 for (int i = m_orderGlobal.size() - 1; i >= 0; --i) 2135 mapActionsGlobal.value(m_orderGlobal.at(i))->trigger(); 2136 /* Make sure further action triggering cause tool type switch as well: */ 2137 actionPool()->action(UIActionIndexST_M_Tools_T_Global)->setProperty("watch_child_activation", true); 2138 2139 /* But we can't restore previously opened Machine tools here, 2140 * see the reason in corresponding async sltHandlePolishEvent slot. */ 2141 } 2117 2142 } 2118 2143 2119 2144 void UISelectorWindow::saveSettings() 2120 2145 { 2146 /* Save toolbar Machine/Global tools orders: */ 2147 { 2148 gEDataManager->setSelectorWindowToolsOrderMachine(m_pToolbarTools->tabOrderMachine()); 2149 gEDataManager->setSelectorWindowToolsOrderGlobal(m_pToolbarTools->tabOrderGlobal()); 2150 } 2151 2121 2152 /* Save toolbar and statusbar visibility: */ 2122 2153 { -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.h
r68282 r68304 356 356 UIToolsToolbar *m_pToolbarTools; 357 357 358 /** Holds the Machine Tools order. */ 359 QList<ToolTypeMachine> m_orderMachine; 360 /** Holds the Global Tools order. */ 361 QList<ToolTypeGlobal> m_orderGlobal; 362 358 363 /** Holds the Chooser-pane instance. */ 359 364 UIGChooser *m_pPaneChooser; -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneGlobal.h
r68285 r68304 24 24 /* GUI includes: */ 25 25 #include "QIWithRetranslateUI.h" 26 #include "UIExtraDataDefs.h" 26 27 27 28 /* Forward declarations: */ … … 35 36 class UIVMItem; 36 37 class CMachine; 37 38 39 /** Global tool types. */40 enum ToolTypeGlobal41 {42 ToolTypeGlobal_Invalid,43 ToolTypeGlobal_Desktop,44 ToolTypeGlobal_VirtualMedia,45 ToolTypeGlobal_HostNetwork,46 };47 48 /* Make sure QVariant can eat ToolTypeGlobal: */49 Q_DECLARE_METATYPE(ToolTypeGlobal);50 38 51 39 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsPaneMachine.h
r68285 r68304 24 24 /* GUI includes: */ 25 25 #include "QIWithRetranslateUI.h" 26 #include "UIExtraDataDefs.h" 26 27 27 28 /* Forward declarations: */ … … 35 36 class UIVMItem; 36 37 class CMachine; 37 38 39 /** Machine tool types. */40 enum ToolTypeMachine41 {42 ToolTypeMachine_Invalid,43 ToolTypeMachine_Desktop,44 ToolTypeMachine_Details,45 ToolTypeMachine_Snapshots,46 };47 48 /* Make sure QVariant can eat ToolTypeMachine: */49 Q_DECLARE_METATYPE(ToolTypeMachine);50 38 51 39 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsToolbar.cpp
r68230 r68304 76 76 } 77 77 78 QList<ToolTypeMachine> UIToolsToolbar::tabOrderMachine() const 79 { 80 QList<ToolTypeMachine> list; 81 foreach (const QUuid &uuid, m_pTabBarMachine->tabOrder()) 82 list << m_mapTabIdsMachine.key(uuid); 83 return list; 84 } 85 86 QList<ToolTypeGlobal> UIToolsToolbar::tabOrderGlobal() const 87 { 88 QList<ToolTypeGlobal> list; 89 foreach (const QUuid &uuid, m_pTabBarGlobal->tabOrder()) 90 list << m_mapTabIdsGlobal.key(uuid); 91 return list; 92 } 93 78 94 void UIToolsToolbar::sltHandleOpenToolMachine() 79 95 { -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UIToolsToolbar.h
r68230 r68304 72 72 void setToolButtonStyle(Qt::ToolButtonStyle enmStyle); 73 73 74 /** Returns Machine tab-bar order. */ 75 QList<ToolTypeMachine> tabOrderMachine() const; 76 /** Returns Global tab-bar order. */ 77 QList<ToolTypeGlobal> tabOrderGlobal() const; 78 74 79 private slots: 75 80 -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UITabBar.cpp
r68299 r68304 543 543 } 544 544 545 QList<QUuid> UITabBar::tabOrder() const 546 { 547 QList<QUuid> list; 548 foreach (UITabBarItem *pItem, m_aItems) 549 list << pItem->uuid(); 550 return list; 551 } 552 545 553 void UITabBar::paintEvent(QPaintEvent *pEvent) 546 554 { -
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UITabBar.h
r68298 r68304 67 67 bool setCurrent(const QUuid &uuid); 68 68 69 /** Return tab-bar order ID list. */ 70 QList<QUuid> tabOrder() const; 71 69 72 protected: 70 73
Note:
See TracChangeset
for help on using the changeset viewer.