Changeset 75016 in vbox for trunk/src/VBox
- Timestamp:
- Oct 23, 2018 7:42:38 PM (6 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r73716 r75016 89 89 template<> SHARED_LIBRARY_STUFF bool canConvert<UIExtraDataMetaDefs::MenuWindowActionType>(); 90 90 #endif /* VBOX_WS_MAC */ 91 template<> SHARED_LIBRARY_STUFF bool canConvert<ToolTypeMachine>(); 92 template<> SHARED_LIBRARY_STUFF bool canConvert<ToolTypeGlobal>(); 91 template<> SHARED_LIBRARY_STUFF bool canConvert<UIToolType>(); 93 92 template<> SHARED_LIBRARY_STUFF bool canConvert<UIVisualStateType>(); 94 93 template<> SHARED_LIBRARY_STUFF bool canConvert<DetailsElementType>(); … … 165 164 template<> SHARED_LIBRARY_STUFF UIExtraDataMetaDefs::MenuWindowActionType fromInternalString<UIExtraDataMetaDefs::MenuWindowActionType>(const QString &strMenuWindowActionType); 166 165 #endif /* VBOX_WS_MAC */ 167 template<> SHARED_LIBRARY_STUFF QString toInternalString(const ToolTypeMachine &enmToolTypeMachine); 168 template<> SHARED_LIBRARY_STUFF ToolTypeMachine fromInternalString<ToolTypeMachine>(const QString &strToolTypeMachine); 169 template<> SHARED_LIBRARY_STUFF QString toInternalString(const ToolTypeGlobal &enmToolTypeGlobal); 170 template<> SHARED_LIBRARY_STUFF ToolTypeGlobal fromInternalString<ToolTypeGlobal>(const QString &strToolTypeGlobal); 166 template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIToolType &enmToolType); 167 template<> SHARED_LIBRARY_STUFF UIToolType fromInternalString<UIToolType>(const QString &strToolType); 171 168 template<> SHARED_LIBRARY_STUFF QString toInternalString(const UIVisualStateType &visualStateType); 172 169 template<> SHARED_LIBRARY_STUFF UIVisualStateType fromInternalString<UIVisualStateType>(const QString &strVisualStateType); -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r75012 r75016 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 template<> bool canConvert<UIToolType>() { return true; } 57 56 template<> bool canConvert<UIVisualStateType>() { return true; } 58 57 template<> bool canConvert<DetailsElementType>() { return true; } … … 867 866 #endif /* VBOX_WS_MAC */ 868 867 869 /* QString <= ToolTypeMachine: */ 870 template<> QString toInternalString(const ToolTypeMachine &enmToolTypeMachine) 871 { 872 QString strResult; 873 switch (enmToolTypeMachine) 874 { 875 case ToolTypeMachine_Details: strResult = "Details"; break; 876 case ToolTypeMachine_Snapshots: strResult = "Snapshots"; break; 877 case ToolTypeMachine_Logs: strResult = "Logs"; break; 878 default: 879 { 880 AssertMsgFailed(("No text for machine tool type=%d", enmToolTypeMachine)); 881 break; 882 } 883 } 884 return strResult; 885 } 886 887 /* ToolTypeMachine <= QString: */ 888 template<> ToolTypeMachine fromInternalString<ToolTypeMachine>(const QString &strToolTypeMachine) 889 { 890 /* Here we have some fancy stuff allowing us 891 * to search through the keys using 'case-insensitive' rule: */ 892 QStringList keys; QList<ToolTypeMachine> values; 893 keys << "Details"; values << ToolTypeMachine_Details; 894 keys << "Snapshots"; values << ToolTypeMachine_Snapshots; 895 keys << "Logs"; values << ToolTypeMachine_Logs; 896 /* Invalid type for unknown words: */ 897 if (!keys.contains(strToolTypeMachine, Qt::CaseInsensitive)) 898 return ToolTypeMachine_Invalid; 899 /* Corresponding type for known words: */ 900 return values.at(keys.indexOf(QRegExp(strToolTypeMachine, Qt::CaseInsensitive))); 901 } 902 903 /* QString <= ToolTypeGlobal: */ 904 template<> QString toInternalString(const ToolTypeGlobal &enmToolTypeGlobal) 905 { 906 QString strResult; 907 switch (enmToolTypeGlobal) 908 { 909 case ToolTypeGlobal_Welcome: strResult = "Welcome"; break; 910 case ToolTypeGlobal_Media: strResult = "Media"; break; 911 case ToolTypeGlobal_Network: strResult = "Network"; break; 912 case ToolTypeGlobal_Cloud: strResult = "Cloud"; break; 913 default: 914 { 915 AssertMsgFailed(("No text for global tool type=%d", enmToolTypeGlobal)); 916 break; 917 } 918 } 919 return strResult; 920 } 921 922 /* ToolTypeGlobal <= QString: */ 923 template<> ToolTypeGlobal fromInternalString<ToolTypeGlobal>(const QString &strToolTypeGlobal) 924 { 925 /* Here we have some fancy stuff allowing us 926 * to search through the keys using 'case-insensitive' rule: */ 927 QStringList keys; QList<ToolTypeGlobal> values; 928 keys << "Welcome"; values << ToolTypeGlobal_Welcome; 929 keys << "Media"; values << ToolTypeGlobal_Media; 930 keys << "Network"; values << ToolTypeGlobal_Network; 931 keys << "Cloud"; values << ToolTypeGlobal_Cloud; 932 /* Invalid type for unknown words: */ 933 if (!keys.contains(strToolTypeGlobal, Qt::CaseInsensitive)) 934 return ToolTypeGlobal_Invalid; 935 /* Corresponding type for known words: */ 936 return values.at(keys.indexOf(QRegExp(strToolTypeGlobal, Qt::CaseInsensitive))); 868 /* QString <= UIToolType: */ 869 template<> QString toInternalString(const UIToolType &enmToolType) 870 { 871 QString strResult; 872 switch (enmToolType) 873 { 874 case UIToolType_Welcome: strResult = "Welcome"; break; 875 case UIToolType_Media: strResult = "Media"; break; 876 case UIToolType_Network: strResult = "Network"; break; 877 case UIToolType_Cloud: strResult = "Cloud"; break; 878 case UIToolType_Details: strResult = "Details"; break; 879 case UIToolType_Snapshots: strResult = "Snapshots"; break; 880 case UIToolType_Logs: strResult = "Logs"; break; 881 default: 882 { 883 AssertMsgFailed(("No text for tool type=%d", enmToolType)); 884 break; 885 } 886 } 887 return strResult; 888 } 889 890 /* UIToolType <= QString: */ 891 template<> UIToolType fromInternalString<UIToolType>(const QString &strToolType) 892 { 893 /* Here we have some fancy stuff allowing us 894 * to search through the keys using 'case-insensitive' rule: */ 895 QStringList keys; QList<UIToolType> values; 896 keys << "Welcome"; values << UIToolType_Welcome; 897 keys << "Media"; values << UIToolType_Media; 898 keys << "Network"; values << UIToolType_Network; 899 keys << "Cloud"; values << UIToolType_Cloud; 900 keys << "Details"; values << UIToolType_Details; 901 keys << "Snapshots"; values << UIToolType_Snapshots; 902 keys << "Logs"; values << UIToolType_Logs; 903 /* Invalid type for unknown words: */ 904 if (!keys.contains(strToolType, Qt::CaseInsensitive)) 905 return UIToolType_Invalid; 906 /* Corresponding type for known words: */ 907 return values.at(keys.indexOf(QRegExp(strToolType, Qt::CaseInsensitive))); 937 908 } 938 909 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r75012 r75016 660 660 661 661 /** Tool item classes. */ 662 enum UITool sClass663 { 664 UITool sClass_Invalid,665 UITool sClass_Global,666 UITool sClass_Machine662 enum UIToolClass 663 { 664 UIToolClass_Invalid, 665 UIToolClass_Global, 666 UIToolClass_Machine 667 667 }; 668 668 669 669 670 670 /** Tool item types. */ 671 enum UITool sType672 { 673 UITool sType_Invalid,671 enum UIToolType 672 { 673 UIToolType_Invalid, 674 674 /* Global types: */ 675 UITool sType_Welcome,676 UITool sType_Media,677 UITool sType_Network,678 UITool sType_Cloud,675 UIToolType_Welcome, 676 UIToolType_Media, 677 UIToolType_Network, 678 UIToolType_Cloud, 679 679 /* Machine types: */ 680 UIToolsType_Details, 681 UIToolsType_Snapshots, 682 UIToolsType_Logs, 683 }; 684 685 686 /** Selector UI: Global tool types. */ 687 enum ToolTypeGlobal 688 { 689 ToolTypeGlobal_Invalid, 690 ToolTypeGlobal_Welcome, 691 ToolTypeGlobal_Media, 692 ToolTypeGlobal_Network, 693 ToolTypeGlobal_Cloud, 694 }; 695 Q_DECLARE_METATYPE(ToolTypeGlobal); 696 697 698 /** Selector UI: Machine tool types. */ 699 enum ToolTypeMachine 700 { 701 ToolTypeMachine_Invalid, 702 ToolTypeMachine_Error, 703 ToolTypeMachine_Details, 704 ToolTypeMachine_Snapshots, 705 ToolTypeMachine_Logs 706 }; 707 Q_DECLARE_METATYPE(ToolTypeMachine); 680 UIToolType_Error, 681 UIToolType_Details, 682 UIToolType_Snapshots, 683 UIToolType_Logs, 684 }; 685 Q_DECLARE_METATYPE(UIToolType); 708 686 709 687 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r74942 r75016 2737 2737 } 2738 2738 2739 QList<ToolTypeMachine> UIExtraDataManager::selectorWindowToolsOrderMachine()2740 {2741 /* Prepare result: */2742 QList<ToolTypeMachine> aLoadedOrder;2743 /* Get machine tools order: */2744 foreach (const QString &strValue, extraDataStringList(GUI_Toolbar_MachineTools_Order))2745 {2746 const ToolTypeMachine enmValue = gpConverter->fromInternalString<ToolTypeMachine>(strValue);2747 if (!aLoadedOrder.contains(enmValue))2748 aLoadedOrder << enmValue;2749 }2750 2751 /* If the list is empty => add 'Details' at least: */2752 if (aLoadedOrder.isEmpty())2753 aLoadedOrder << ToolTypeMachine_Details;2754 2755 /* Return result: */2756 return aLoadedOrder;2757 }2758 2759 void UIExtraDataManager::setSelectorWindowToolsOrderMachine(const QList<ToolTypeMachine> &aOrder)2760 {2761 /* Parse passed list: */2762 QStringList aSavedOrder;2763 foreach (const ToolTypeMachine &enmToolType, aOrder)2764 aSavedOrder << gpConverter->toInternalString(enmToolType);2765 2766 /* If the list is empty => add 'None' at least: */2767 if (aSavedOrder.isEmpty())2768 aSavedOrder << gpConverter->toInternalString(ToolTypeMachine_Invalid);2769 2770 /* Re-cache corresponding extra-data: */2771 setExtraDataStringList(GUI_Toolbar_MachineTools_Order, aSavedOrder);2772 }2773 2774 QList<ToolTypeGlobal> UIExtraDataManager::selectorWindowToolsOrderGlobal()2775 {2776 /* Prepare result: */2777 QList<ToolTypeGlobal> aLoadedOrder;2778 /* Get global tools order: */2779 foreach (const QString &strValue, extraDataStringList(GUI_Toolbar_GlobalTools_Order))2780 {2781 const ToolTypeGlobal enmValue = gpConverter->fromInternalString<ToolTypeGlobal>(strValue);2782 if (enmValue != ToolTypeGlobal_Invalid && !aLoadedOrder.contains(enmValue))2783 aLoadedOrder << enmValue;2784 }2785 2786 /* Return result: */2787 return aLoadedOrder;2788 }2789 2790 void UIExtraDataManager::setSelectorWindowToolsOrderGlobal(const QList<ToolTypeGlobal> &aOrder)2791 {2792 /* Parse passed list: */2793 QStringList aSavedOrder;2794 foreach (const ToolTypeGlobal &enmToolType, aOrder)2795 aSavedOrder << gpConverter->toInternalString(enmToolType);2796 2797 /* Re-cache corresponding extra-data: */2798 setExtraDataStringList(GUI_Toolbar_GlobalTools_Order, aSavedOrder);2799 }2800 2801 2739 QString UIExtraDataManager::toolsPaneLastItemsChosen() 2802 2740 { -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r74942 r75016 309 309 /** Defines whether selector-window tool-bar text @a fVisible. */ 310 310 void setSelectorWindowToolBarTextVisible(bool fVisible); 311 312 /** Returns selector-window machine tools order. */313 QList<ToolTypeMachine> selectorWindowToolsOrderMachine();314 /** Defines selector-window machine tools @a aOrder. */315 void setSelectorWindowToolsOrderMachine(const QList<ToolTypeMachine> &aOrder);316 317 /** Returns selector-window global tools order. */318 QList<ToolTypeGlobal> selectorWindowToolsOrderGlobal();319 /** Defines selector-window global tools @a aOrder. */320 void setSelectorWindowToolsOrderGlobal(const QList<ToolTypeGlobal> &aOrder);321 311 322 312 /** Returns last selected tool set of VirtualBox Manager. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.cpp
r74870 r75016 60 60 } 61 61 62 ToolTypeGlobalUIToolPaneGlobal::currentTool() const63 { 64 return m_pLayout->currentWidget()->property("ToolType").value< ToolTypeGlobal>();65 } 66 67 bool UIToolPaneGlobal::isToolOpened( ToolTypeGlobalenmType) const62 UIToolType UIToolPaneGlobal::currentTool() const 63 { 64 return m_pLayout->currentWidget()->property("ToolType").value<UIToolType>(); 65 } 66 67 bool UIToolPaneGlobal::isToolOpened(UIToolType enmType) const 68 68 { 69 69 /* Search through the stacked widgets: */ 70 70 for (int iIndex = 0; iIndex < m_pLayout->count(); ++iIndex) 71 if (m_pLayout->widget(iIndex)->property("ToolType").value< ToolTypeGlobal>() == enmType)71 if (m_pLayout->widget(iIndex)->property("ToolType").value<UIToolType>() == enmType) 72 72 return true; 73 73 return false; 74 74 } 75 75 76 void UIToolPaneGlobal::openTool( ToolTypeGlobalenmType)76 void UIToolPaneGlobal::openTool(UIToolType enmType) 77 77 { 78 78 /* Search through the stacked widgets: */ 79 79 int iActualIndex = -1; 80 80 for (int iIndex = 0; iIndex < m_pLayout->count(); ++iIndex) 81 if (m_pLayout->widget(iIndex)->property("ToolType").value< ToolTypeGlobal>() == enmType)81 if (m_pLayout->widget(iIndex)->property("ToolType").value<UIToolType>() == enmType) 82 82 iActualIndex = iIndex; 83 83 … … 94 94 switch (enmType) 95 95 { 96 case ToolTypeGlobal_Welcome:96 case UIToolType_Welcome: 97 97 { 98 98 /* Create Desktop pane: */ … … 101 101 { 102 102 /* Configure pane: */ 103 m_pPaneWelcome->setProperty("ToolType", QVariant::fromValue( ToolTypeGlobal_Welcome));103 m_pPaneWelcome->setProperty("ToolType", QVariant::fromValue(UIToolType_Welcome)); 104 104 105 105 /* Add into layout: */ … … 109 109 break; 110 110 } 111 case ToolTypeGlobal_Media:111 case UIToolType_Media: 112 112 { 113 113 /* Create Virtual Media Manager: */ … … 121 121 122 122 /* Configure pane: */ 123 m_pPaneMedia->setProperty("ToolType", QVariant::fromValue( ToolTypeGlobal_Media));123 m_pPaneMedia->setProperty("ToolType", QVariant::fromValue(UIToolType_Media)); 124 124 125 125 /* Add into layout: */ … … 129 129 break; 130 130 } 131 case ToolTypeGlobal_Network:131 case UIToolType_Network: 132 132 { 133 133 /* Create Host Network Manager: */ … … 141 141 142 142 /* Configure pane: */ 143 m_pPaneNetwork->setProperty("ToolType", QVariant::fromValue( ToolTypeGlobal_Network));143 m_pPaneNetwork->setProperty("ToolType", QVariant::fromValue(UIToolType_Network)); 144 144 145 145 /* Add into layout: */ … … 149 149 break; 150 150 } 151 case ToolTypeGlobal_Cloud:151 case UIToolType_Cloud: 152 152 { 153 153 /* Create Cloud Profile Manager: */ … … 161 161 162 162 /* Configure pane: */ 163 m_pPaneCloud->setProperty("ToolType", QVariant::fromValue( ToolTypeGlobal_Cloud));163 m_pPaneCloud->setProperty("ToolType", QVariant::fromValue(UIToolType_Cloud)); 164 164 165 165 /* Add into layout: */ … … 175 175 } 176 176 177 void UIToolPaneGlobal::closeTool( ToolTypeGlobalenmType)177 void UIToolPaneGlobal::closeTool(UIToolType enmType) 178 178 { 179 179 /* Search through the stacked widgets: */ 180 180 int iActualIndex = -1; 181 181 for (int iIndex = 0; iIndex < m_pLayout->count(); ++iIndex) 182 if (m_pLayout->widget(iIndex)->property("ToolType").value< ToolTypeGlobal>() == enmType)182 if (m_pLayout->widget(iIndex)->property("ToolType").value<UIToolType>() == enmType) 183 183 iActualIndex = iIndex; 184 184 … … 189 189 switch (enmType) 190 190 { 191 case ToolTypeGlobal_Welcome: m_pPaneWelcome = 0; break;192 case ToolTypeGlobal_Media: m_pPaneMedia = 0; break;193 case ToolTypeGlobal_Network: m_pPaneNetwork = 0; break;194 case ToolTypeGlobal_Cloud: m_pPaneCloud = 0; break;191 case UIToolType_Welcome: m_pPaneWelcome = 0; break; 192 case UIToolType_Media: m_pPaneMedia = 0; break; 193 case UIToolType_Network: m_pPaneNetwork = 0; break; 194 case UIToolType_Cloud: m_pPaneCloud = 0; break; 195 195 default: break; 196 196 } … … 208 208 209 209 /* Create desktop pane: */ 210 openTool( ToolTypeGlobal_Welcome);210 openTool(UIToolType_Welcome); 211 211 } 212 212 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneGlobal.h
r74870 r75016 51 51 52 52 /** Returns type of tool currently opened. */ 53 ToolTypeGlobalcurrentTool() const;53 UIToolType currentTool() const; 54 54 /** Returns whether tool of particular @a enmType is opened. */ 55 bool isToolOpened( ToolTypeGlobalenmType) const;55 bool isToolOpened(UIToolType enmType) const; 56 56 /** Activates tool of passed @a enmType, creates new one if necessary. */ 57 void openTool( ToolTypeGlobalenmType);57 void openTool(UIToolType enmType); 58 58 /** Closes tool of passed @a enmType, deletes one if exists. */ 59 void closeTool( ToolTypeGlobalenmType);59 void closeTool(UIToolType enmType); 60 60 61 61 private: -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneMachine.cpp
r74557 r75016 63 63 } 64 64 65 ToolTypeMachine UIToolPaneMachine::currentTool() const66 { 67 return m_pLayout->currentWidget()->property("ToolType").value< ToolTypeMachine>();68 } 69 70 bool UIToolPaneMachine::isToolOpened( ToolTypeMachine enmType) const65 UIToolType UIToolPaneMachine::currentTool() const 66 { 67 return m_pLayout->currentWidget()->property("ToolType").value<UIToolType>(); 68 } 69 70 bool UIToolPaneMachine::isToolOpened(UIToolType enmType) const 71 71 { 72 72 /* Search through the stacked widgets: */ 73 73 for (int iIndex = 0; iIndex < m_pLayout->count(); ++iIndex) 74 if (m_pLayout->widget(iIndex)->property("ToolType").value< ToolTypeMachine>() == enmType)74 if (m_pLayout->widget(iIndex)->property("ToolType").value<UIToolType>() == enmType) 75 75 return true; 76 76 return false; 77 77 } 78 78 79 void UIToolPaneMachine::openTool( ToolTypeMachine enmType)79 void UIToolPaneMachine::openTool(UIToolType enmType) 80 80 { 81 81 /* Search through the stacked widgets: */ 82 82 int iActualIndex = -1; 83 83 for (int iIndex = 0; iIndex < m_pLayout->count(); ++iIndex) 84 if (m_pLayout->widget(iIndex)->property("ToolType").value< ToolTypeMachine>() == enmType)84 if (m_pLayout->widget(iIndex)->property("ToolType").value<UIToolType>() == enmType) 85 85 iActualIndex = iIndex; 86 86 … … 97 97 switch (enmType) 98 98 { 99 case ToolTypeMachine_Error:99 case UIToolType_Error: 100 100 { 101 101 /* Create Desktop pane: */ … … 104 104 { 105 105 /* Configure pane: */ 106 m_pPaneError->setProperty("ToolType", QVariant::fromValue( ToolTypeMachine_Error));106 m_pPaneError->setProperty("ToolType", QVariant::fromValue(UIToolType_Error)); 107 107 108 108 /* Add into layout: */ … … 112 112 break; 113 113 } 114 case ToolTypeMachine_Details:114 case UIToolType_Details: 115 115 { 116 116 /* Create Details pane: */ … … 119 119 { 120 120 /* Configure pane: */ 121 m_pPaneDetails->setProperty("ToolType", QVariant::fromValue( ToolTypeMachine_Details));121 m_pPaneDetails->setProperty("ToolType", QVariant::fromValue(UIToolType_Details)); 122 122 connect(this, &UIToolPaneMachine::sigSlidingStarted, m_pPaneDetails, &UIDetails::sigSlidingStarted); 123 123 connect(this, &UIToolPaneMachine::sigToggleStarted, m_pPaneDetails, &UIDetails::sigToggleStarted); … … 131 131 break; 132 132 } 133 case ToolTypeMachine_Snapshots:133 case UIToolType_Snapshots: 134 134 { 135 135 /* Create Snapshots pane: */ … … 143 143 144 144 /* Configure pane: */ 145 m_pPaneSnapshots->setProperty("ToolType", QVariant::fromValue( ToolTypeMachine_Snapshots));145 m_pPaneSnapshots->setProperty("ToolType", QVariant::fromValue(UIToolType_Snapshots)); 146 146 147 147 /* Add into layout: */ … … 151 151 break; 152 152 } 153 case ToolTypeMachine_Logs:153 case UIToolType_Logs: 154 154 { 155 155 /* Create the Logviewer pane: */ … … 163 163 164 164 /* Configure pane: */ 165 m_pPaneLogViewer->setProperty("ToolType", QVariant::fromValue( ToolTypeMachine_Logs));165 m_pPaneLogViewer->setProperty("ToolType", QVariant::fromValue(UIToolType_Logs)); 166 166 167 167 /* Add into layout: */ … … 177 177 } 178 178 179 void UIToolPaneMachine::closeTool( ToolTypeMachine enmType)179 void UIToolPaneMachine::closeTool(UIToolType enmType) 180 180 { 181 181 /* Search through the stacked widgets: */ 182 182 int iActualIndex = -1; 183 183 for (int iIndex = 0; iIndex < m_pLayout->count(); ++iIndex) 184 if (m_pLayout->widget(iIndex)->property("ToolType").value< ToolTypeMachine>() == enmType)184 if (m_pLayout->widget(iIndex)->property("ToolType").value<UIToolType>() == enmType) 185 185 iActualIndex = iIndex; 186 186 … … 191 191 switch (enmType) 192 192 { 193 case ToolTypeMachine_Error: m_pPaneError = 0; break;194 case ToolTypeMachine_Details: m_pPaneDetails = 0; break;195 case ToolTypeMachine_Snapshots: m_pPaneSnapshots = 0; break;196 case ToolTypeMachine_Logs: m_pPaneLogViewer = 0; break;193 case UIToolType_Error: m_pPaneError = 0; break; 194 case UIToolType_Details: m_pPaneDetails = 0; break; 195 case UIToolType_Snapshots: m_pPaneSnapshots = 0; break; 196 case UIToolType_Logs: m_pPaneLogViewer = 0; break; 197 197 default: break; 198 198 } … … 222 222 void UIToolPaneMachine::setItems(const QList<UIVirtualMachineItem*> &items) 223 223 { 224 /* Update details pane: */ 225 AssertPtrReturnVoid(m_pPaneDetails); 226 m_pPaneDetails->setItems(items); 224 /* Update details pane is it is open: */ 225 if (isToolOpened(UIToolType_Details)) 226 { 227 AssertPtrReturnVoid(m_pPaneDetails); 228 m_pPaneDetails->setItems(items); 229 } 227 230 } 228 231 … … 230 233 { 231 234 /* Update snapshots pane is it is open: */ 232 if (isToolOpened( ToolTypeMachine_Snapshots))235 if (isToolOpened(UIToolType_Snapshots)) 233 236 { 234 237 AssertPtrReturnVoid(m_pPaneSnapshots); … … 236 239 } 237 240 /* Update logviewer pane is it is open: */ 238 if (isToolOpened( ToolTypeMachine_Logs))241 if (isToolOpened(UIToolType_Logs)) 239 242 { 240 243 AssertPtrReturnVoid(m_pPaneLogViewer); … … 249 252 250 253 /* Create Details pane: */ 251 openTool( ToolTypeMachine_Details);254 openTool(UIToolType_Details); 252 255 } 253 256 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIToolPaneMachine.h
r74942 r75016 62 62 63 63 /** Returns type of tool currently opened. */ 64 ToolTypeMachine currentTool() const;64 UIToolType currentTool() const; 65 65 /** Returns whether tool of particular @a enmType is opened. */ 66 bool isToolOpened( ToolTypeMachine enmType) const;66 bool isToolOpened(UIToolType enmType) const; 67 67 /** Activates tool of passed @a enmType, creates new one if necessary. */ 68 void openTool( ToolTypeMachine enmType);68 void openTool(UIToolType enmType); 69 69 /** Closes tool of passed @a enmType, deletes one if exists. */ 70 void closeTool( ToolTypeMachine enmType);70 void closeTool(UIToolType enmType); 71 71 72 72 /** Defines error @a strDetails and switches to Error pane. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r74985 r75016 291 291 * otherwise user sees everything himself: */ 292 292 if ( m_pManagerVirtualMedia 293 || m_pWidget->is ToolOpened(ToolTypeGlobal_Media))293 || m_pWidget->isGlobalToolOpened(UIToolType_Media)) 294 294 return; 295 295 … … 386 386 switch (m_pWidget->toolsType()) 387 387 { 388 case UITool sType_Media: sltCloseVirtualMediumManagerWindow(); break;389 case UITool sType_Network: sltCloseHostNetworkManagerWindow(); break;390 case UITool sType_Cloud: sltCloseCloudProfileManagerWindow(); break;391 case UITool sType_Logs: sltCloseLogViewerWindow(); break;388 case UIToolType_Media: sltCloseVirtualMediumManagerWindow(); break; 389 case UIToolType_Network: sltCloseHostNetworkManagerWindow(); break; 390 case UIToolType_Cloud: sltCloseCloudProfileManagerWindow(); break; 391 case UIToolType_Logs: sltCloseLogViewerWindow(); break; 392 392 default: break; 393 393 } … … 402 402 { 403 403 /* First check if instance of widget opened the embedded way: */ 404 if (m_pWidget->is ToolOpened(ToolTypeGlobal_Media))405 { 406 m_pWidget->setToolsType(UITool sType_Welcome);407 m_pWidget->close Tool(ToolTypeGlobal_Media);404 if (m_pWidget->isGlobalToolOpened(UIToolType_Media)) 405 { 406 m_pWidget->setToolsType(UIToolType_Welcome); 407 m_pWidget->closeGlobalTool(UIToolType_Media); 408 408 } 409 409 … … 432 432 { 433 433 /* First check if instance of widget opened the embedded way: */ 434 if (m_pWidget->is ToolOpened(ToolTypeGlobal_Network))435 { 436 m_pWidget->setToolsType(UITool sType_Welcome);437 m_pWidget->close Tool(ToolTypeGlobal_Network);434 if (m_pWidget->isGlobalToolOpened(UIToolType_Network)) 435 { 436 m_pWidget->setToolsType(UIToolType_Welcome); 437 m_pWidget->closeGlobalTool(UIToolType_Network); 438 438 } 439 439 … … 462 462 { 463 463 /* First check if instance of widget opened the embedded way: */ 464 if (m_pWidget->is ToolOpened(ToolTypeGlobal_Cloud))465 { 466 m_pWidget->setToolsType(UITool sType_Welcome);467 m_pWidget->close Tool(ToolTypeGlobal_Cloud);464 if (m_pWidget->isGlobalToolOpened(UIToolType_Cloud)) 465 { 466 m_pWidget->setToolsType(UIToolType_Welcome); 467 m_pWidget->closeGlobalTool(UIToolType_Cloud); 468 468 } 469 469 … … 1062 1062 1063 1063 /* First check if instance of widget opened the embedded way: */ 1064 if (m_pWidget->is ToolOpened(ToolTypeMachine_Logs))1065 { 1066 m_pWidget->setToolsType(UITool sType_Details);1067 m_pWidget->close Tool(ToolTypeMachine_Logs);1064 if (m_pWidget->isMachineToolOpened(UIToolType_Logs)) 1065 { 1066 m_pWidget->setToolsType(UIToolType_Details); 1067 m_pWidget->closeMachineTool(UIToolType_Logs); 1068 1068 } 1069 1069 … … 2127 2127 2128 2128 /* Determine whether Media menu should be visible: */ 2129 const bool fMediumMenuShown = fGlobalMenuShown && m_pWidget->currentGlobalTool() == ToolTypeGlobal_Media;2129 const bool fMediumMenuShown = fGlobalMenuShown && m_pWidget->currentGlobalTool() == UIToolType_Media; 2130 2130 m_pVirtualMediaManagerMenuAction->setVisible(fMediumMenuShown); 2131 2131 2132 2132 /* Determine whether Network menu should be visible: */ 2133 const bool fNetworkMenuShown = fGlobalMenuShown && m_pWidget->currentGlobalTool() == ToolTypeGlobal_Network;2133 const bool fNetworkMenuShown = fGlobalMenuShown && m_pWidget->currentGlobalTool() == UIToolType_Network; 2134 2134 m_pHostNetworkManagerMenuAction->setVisible(fNetworkMenuShown); 2135 2135 2136 2136 /* Determine whether Cloud menu should be visible: */ 2137 const bool fCloudMenuShown = fGlobalMenuShown && m_pWidget->currentGlobalTool() == ToolTypeGlobal_Cloud;2137 const bool fCloudMenuShown = fGlobalMenuShown && m_pWidget->currentGlobalTool() == UIToolType_Cloud; 2138 2138 m_pCloudProfileManagerMenuAction->setVisible(fCloudMenuShown); 2139 2139 2140 2140 /* Determine whether Snapshots menu should be visible: */ 2141 2141 const bool fSnapshotMenuShown = (fMachineMenuShown || fGroupMenuShown) && 2142 m_pWidget->currentMachineTool() == ToolTypeMachine_Snapshots;2142 m_pWidget->currentMachineTool() == UIToolType_Snapshots; 2143 2143 m_pSnapshotMenuAction->setVisible(fSnapshotMenuShown); 2144 2144 2145 2145 /* Determine whether Logs menu should be visible: */ 2146 2146 const bool fLogViewerMenuShown = (fMachineMenuShown || fGroupMenuShown) && 2147 m_pWidget->currentMachineTool() == ToolTypeMachine_Logs;2147 m_pWidget->currentMachineTool() == UIToolType_Logs; 2148 2148 m_pLogViewerMenuAction->setVisible(fLogViewerMenuShown); 2149 2149 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.cpp
r74975 r75016 104 104 } 105 105 106 void UIVirtualBoxManagerWidget::setToolsType(UITool sType enmType)106 void UIVirtualBoxManagerWidget::setToolsType(UIToolType enmType) 107 107 { 108 108 m_pPaneTools->setToolsType(enmType); 109 109 } 110 110 111 UITool sType UIVirtualBoxManagerWidget::toolsType() const111 UIToolType UIVirtualBoxManagerWidget::toolsType() const 112 112 { 113 113 return m_pPaneTools->toolsType(); 114 114 } 115 115 116 ToolTypeMachine UIVirtualBoxManagerWidget::currentMachineTool() const116 UIToolType UIVirtualBoxManagerWidget::currentMachineTool() const 117 117 { 118 118 return m_pPaneToolsMachine->currentTool(); 119 119 } 120 120 121 ToolTypeGlobalUIVirtualBoxManagerWidget::currentGlobalTool() const121 UIToolType UIVirtualBoxManagerWidget::currentGlobalTool() const 122 122 { 123 123 return m_pPaneToolsGlobal->currentTool(); 124 124 } 125 125 126 bool UIVirtualBoxManagerWidget::is ToolOpened(ToolTypeMachine enmType) const126 bool UIVirtualBoxManagerWidget::isMachineToolOpened(UIToolType enmType) const 127 127 { 128 128 return m_pPaneToolsMachine ? m_pPaneToolsMachine->isToolOpened(enmType) : false; 129 129 } 130 130 131 bool UIVirtualBoxManagerWidget::is ToolOpened(ToolTypeGlobalenmType) const131 bool UIVirtualBoxManagerWidget::isGlobalToolOpened(UIToolType enmType) const 132 132 { 133 133 return m_pPaneToolsGlobal ? m_pPaneToolsGlobal->isToolOpened(enmType) : false; 134 134 } 135 135 136 void UIVirtualBoxManagerWidget::switchTo Tool(ToolTypeMachine enmType)136 void UIVirtualBoxManagerWidget::switchToMachineTool(UIToolType enmType) 137 137 { 138 138 /* Open corresponding tool: */ … … 140 140 141 141 /* If that was 'Details' => pass there current items: */ 142 if ( enmType == ToolTypeMachine_Details 143 && m_pPaneToolsMachine->isToolOpened(ToolTypeMachine_Details)) 142 if (enmType == UIToolType_Details) 144 143 m_pPaneToolsMachine->setItems(currentItems()); 145 144 /* If that was 'Snapshot' or 'LogViewer' => pass there current or null machine: */ 146 if (enmType == ToolTypeMachine_Snapshots || enmType == ToolTypeMachine_Logs)145 if (enmType == UIToolType_Snapshots || enmType == UIToolType_Logs) 147 146 { 148 147 UIVirtualMachineItem *pItem = currentItem(); … … 157 156 } 158 157 159 void UIVirtualBoxManagerWidget::switchTo Tool(ToolTypeGlobalenmType)158 void UIVirtualBoxManagerWidget::switchToGlobalTool(UIToolType enmType) 160 159 { 161 160 /* Open corresponding tool: */ … … 169 168 } 170 169 171 void UIVirtualBoxManagerWidget::close Tool(ToolTypeMachine enmType)170 void UIVirtualBoxManagerWidget::closeMachineTool(UIToolType enmType) 172 171 { 173 172 m_pPaneToolsMachine->closeTool(enmType); 174 173 } 175 174 176 void UIVirtualBoxManagerWidget::close Tool(ToolTypeGlobalenmType)175 void UIVirtualBoxManagerWidget::closeGlobalTool(UIToolType enmType) 177 176 { 178 177 m_pPaneToolsGlobal->closeTool(enmType); … … 269 268 270 269 /* Update Machine Tools availability: */ 271 m_pPaneTools->setToolsEnabled(UITool sClass_Machine, pItem && pItem->accessible());270 m_pPaneTools->setToolsEnabled(UIToolClass_Machine, pItem && pItem->accessible()); 272 271 273 272 /* If current item exists & accessible: */ … … 275 274 { 276 275 /* If Error pane is chosen currently => open tool currently chosen in Tools-pane: */ 277 if (m_pPaneToolsMachine->currentTool() == ToolTypeMachine_Error)276 if (m_pPaneToolsMachine->currentTool() == UIToolType_Error) 278 277 sltHandleToolsPaneIndexChange(); 279 278 280 279 /* Update Details-pane (if requested): */ 281 if ( fUpdateDetails 282 && m_pPaneToolsMachine->isToolOpened(ToolTypeMachine_Details)) 280 if (fUpdateDetails) 283 281 m_pPaneToolsMachine->setItems(currentItems()); 284 282 /* Update the Snapshots-pane or/and Logviewer-pane (if requested): */ … … 289 287 { 290 288 /* Make sure Error pane raised: */ 291 m_pPaneToolsMachine->openTool( ToolTypeMachine_Error);289 m_pPaneToolsMachine->openTool(UIToolType_Error); 292 290 293 291 /* Note that the machine becomes inaccessible (or if the last VM gets … … 300 298 301 299 /* Update Details-pane (in any case): */ 302 if (m_pPaneToolsMachine->isToolOpened(ToolTypeMachine_Details)) 303 m_pPaneToolsMachine->setItems(currentItems()); 300 m_pPaneToolsMachine->setItems(currentItems()); 304 301 /* Update Snapshots-pane and Logviewer-pane (in any case): */ 305 302 m_pPaneToolsMachine->setMachine(CMachine()); … … 315 312 case SlidingDirection_Forward: 316 313 { 317 m_pPaneTools->setToolsClass(UITool sClass_Machine);314 m_pPaneTools->setToolsClass(UIToolClass_Machine); 318 315 m_pStackedWidget->setCurrentWidget(m_pPaneToolsMachine); 319 316 break; … … 321 318 case SlidingDirection_Reverse: 322 319 { 323 m_pPaneTools->setToolsClass(UITool sClass_Global);320 m_pPaneTools->setToolsClass(UIToolClass_Global); 324 321 m_pStackedWidget->setCurrentWidget(m_pPaneToolsGlobal); 325 322 break; … … 330 327 } 331 328 332 void UIVirtualBoxManagerWidget::sltHandleToolMenuRequested(UITool sClass enmClass, const QPoint &position)329 void UIVirtualBoxManagerWidget::sltHandleToolMenuRequested(UIToolClass enmClass, const QPoint &position) 333 330 { 334 331 /* Define current tools class: */ … … 348 345 switch (m_pPaneTools->toolsClass()) 349 346 { 350 case UIToolsClass_Global: 351 { 352 ToolTypeGlobal enmType = ToolTypeGlobal_Invalid; 353 if (!m_pPaneTools->areToolsEnabled(UIToolsClass_Global)) 354 enmType = ToolTypeGlobal_Welcome; 355 else 356 { 357 switch (m_pPaneTools->toolsType()) 358 { 359 case UIToolsType_Welcome: enmType = ToolTypeGlobal_Welcome; break; 360 case UIToolsType_Media: enmType = ToolTypeGlobal_Media; break; 361 case UIToolsType_Network: enmType = ToolTypeGlobal_Network; break; 362 case UIToolsType_Cloud: enmType = ToolTypeGlobal_Cloud; break; 363 default: break; 364 } 365 } 366 if (enmType != ToolTypeGlobal_Invalid) 367 switchToTool(enmType); 347 case UIToolClass_Global: 348 { 349 const UIToolType enmType = m_pPaneTools->areToolsEnabled(UIToolClass_Global) 350 ? m_pPaneTools->toolsType() 351 : UIToolType_Welcome; 352 switchToGlobalTool(enmType); 368 353 break; 369 354 } 370 case UIToolsClass_Machine: 371 { 372 ToolTypeMachine enmType = ToolTypeMachine_Invalid; 373 if (!m_pPaneTools->areToolsEnabled(UIToolsClass_Machine)) 374 enmType = ToolTypeMachine_Details; 375 else 376 { 377 switch (m_pPaneTools->toolsType()) 378 { 379 case UIToolsType_Details: enmType = ToolTypeMachine_Details; break; 380 case UIToolsType_Snapshots: enmType = ToolTypeMachine_Snapshots; break; 381 case UIToolsType_Logs: enmType = ToolTypeMachine_Logs; break; 382 default: break; 383 } 384 } 385 if (enmType != ToolTypeMachine_Invalid) 386 switchToTool(enmType); 355 case UIToolClass_Machine: 356 { 357 const UIToolType enmType = m_pPaneTools->areToolsEnabled(UIToolClass_Machine) 358 ? m_pPaneTools->toolsType() 359 : UIToolType_Details; 360 switchToMachineTool(enmType); 387 361 break; 388 362 } … … 540 514 /* Choose which pane should be active initially: */ 541 515 if (m_pPaneChooser->isGlobalItemSelected()) 542 m_pPaneTools->setToolsClass(UITool sClass_Global);516 m_pPaneTools->setToolsClass(UIToolClass_Global); 543 517 else 544 m_pPaneTools->setToolsClass(UITool sClass_Machine);518 m_pPaneTools->setToolsClass(UIToolClass_Machine); 545 519 } 546 520 } … … 624 598 { 625 599 /* Global toolbar: */ 626 case UITool sClass_Global:600 case UIToolClass_Global: 627 601 { 628 602 switch (currentGlobalTool()) 629 603 { 630 case ToolTypeGlobal_Welcome:604 case UIToolType_Welcome: 631 605 { 632 606 m_pToolBar->addAction(actionPool()->action(UIActionIndex_M_Application_S_Preferences)); … … 639 613 break; 640 614 } 641 case ToolTypeGlobal_Media:615 case UIToolType_Media: 642 616 { 643 617 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Medium_S_Add)); … … 652 626 break; 653 627 } 654 case ToolTypeGlobal_Network:628 case UIToolType_Network: 655 629 { 656 630 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Network_S_Create)); … … 661 635 break; 662 636 } 663 case ToolTypeGlobal_Cloud:637 case UIToolType_Cloud: 664 638 { 665 639 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Cloud_S_Add)); … … 678 652 } 679 653 /* Machine toolbar: */ 680 case UITool sClass_Machine:654 case UIToolClass_Machine: 681 655 { 682 656 switch (currentMachineTool()) 683 657 { 684 case ToolTypeMachine_Details:658 case UIToolType_Details: 685 659 { 686 660 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_New)); … … 690 664 break; 691 665 } 692 case ToolTypeMachine_Snapshots:666 case UIToolType_Snapshots: 693 667 { 694 668 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_New)); … … 704 678 break; 705 679 } 706 case ToolTypeMachine_Logs:680 case UIToolType_Logs: 707 681 { 708 682 m_pToolBar->addAction(actionPool()->action(UIActionIndexST_M_Machine_S_New)); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManagerWidget.h
r74975 r75016 88 88 89 89 /** Defines tools @a enmType. */ 90 void setToolsType(UITool sType enmType);90 void setToolsType(UIToolType enmType); 91 91 /** Returns tools type. */ 92 UITool sType toolsType() const;92 UIToolType toolsType() const; 93 93 94 94 /** Returns a type of curent Machine tool. */ 95 ToolTypeMachine currentMachineTool() const;95 UIToolType currentMachineTool() const; 96 96 /** Returns a type of curent Global tool. */ 97 ToolTypeGlobalcurrentGlobalTool() const;97 UIToolType currentGlobalTool() const; 98 98 /** Returns whether Machine tool of passed @a enmType is opened. */ 99 bool is ToolOpened(ToolTypeMachine enmType) const;99 bool isMachineToolOpened(UIToolType enmType) const; 100 100 /** Returns whether Global tool of passed @a enmType is opened. */ 101 bool is ToolOpened(ToolTypeGlobalenmType) const;101 bool isGlobalToolOpened(UIToolType enmType) const; 102 102 /** Switches to Machine tool of passed @a enmType. */ 103 void switchTo Tool(ToolTypeMachine enmType);103 void switchToMachineTool(UIToolType enmType); 104 104 /** Switches to Global tool of passed @a enmType. */ 105 void switchTo Tool(ToolTypeGlobalenmType);105 void switchToGlobalTool(UIToolType enmType); 106 106 /** Closes Machine tool of passed @a enmType. */ 107 void close Tool(ToolTypeMachine enmType);107 void closeMachineTool(UIToolType enmType); 108 108 /** Closes Global tool of passed @a enmType. */ 109 void close Tool(ToolTypeGlobalenmType);109 void closeGlobalTool(UIToolType enmType); 110 110 /** @} */ 111 111 … … 148 148 * @{ */ 149 149 /** Handles tool menu request. */ 150 void sltHandleToolMenuRequested(UITool sClass enmClass, const QPoint &position);150 void sltHandleToolMenuRequested(UIToolClass enmClass, const QPoint &position); 151 151 152 152 /** Handles signal abour Tools-pane index change. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.cpp
r74827 r75016 101 101 } 102 102 103 void UIChooser::sltToolMenuRequested(UITool sClass enmClass, const QPoint &position)103 void UIChooser::sltToolMenuRequested(UIToolClass enmClass, const QPoint &position) 104 104 { 105 105 /* Translate scene coordinates to global one: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooser.h
r74827 r75016 54 54 55 55 /** Notifies listeners about tool popup-menu request for certain tool @a enmClass and in specified @a position. */ 56 void sigToolMenuRequested(UITool sClass enmClass, const QPoint &position);56 void sigToolMenuRequested(UIToolClass enmClass, const QPoint &position); 57 57 /** @} */ 58 58 … … 123 123 * @{ */ 124 124 /** Handles signal about tool popup-menu request for certain tool @a enmClass and in specified @a position. */ 125 void sltToolMenuRequested(UITool sClass enmClass, const QPoint &position);125 void sltToolMenuRequested(UIToolClass enmClass, const QPoint &position); 126 126 /** @} */ 127 127 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r74950 r75016 158 158 { 159 159 case UIChooserItemType_Global: 160 emit sigToolMenuRequested(UITool sClass_Global, pItem->geometry().topRight().toPoint());160 emit sigToolMenuRequested(UIToolClass_Global, pItem->geometry().topRight().toPoint()); 161 161 break; 162 162 case UIChooserItemType_Group: 163 163 case UIChooserItemType_Machine: 164 emit sigToolMenuRequested(UITool sClass_Machine, pItem->geometry().topRight().toPoint());164 emit sigToolMenuRequested(UIToolClass_Machine, pItem->geometry().topRight().toPoint()); 165 165 break; 166 166 default: -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h
r74942 r75016 69 69 * @{ */ 70 70 /** Notify listeners about tool menu popup request for certain @a enmClass and @a position. */ 71 void sigToolMenuRequested(UITool sClass enmClass, const QPoint &position);71 void sigToolMenuRequested(UIToolClass enmClass, const QPoint &position); 72 72 /** @} */ 73 73 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UITools.cpp
r74975 r75016 55 55 } 56 56 57 void UITools::setToolsClass(UITool sClass enmClass)57 void UITools::setToolsClass(UIToolClass enmClass) 58 58 { 59 59 m_pToolsModel->setToolsClass(enmClass); 60 60 } 61 61 62 UITool sClass UITools::toolsClass() const62 UIToolClass UITools::toolsClass() const 63 63 { 64 64 return m_pToolsModel->toolsClass(); 65 65 } 66 66 67 void UITools::setToolsType(UITool sType enmType)67 void UITools::setToolsType(UIToolType enmType) 68 68 { 69 69 m_pToolsModel->setToolsType(enmType); 70 70 } 71 71 72 UITool sType UITools::toolsType() const72 UIToolType UITools::toolsType() const 73 73 { 74 74 return m_pToolsModel->toolsType(); 75 75 } 76 76 77 void UITools::setToolsEnabled(UITool sClass enmClass, bool fEnabled)77 void UITools::setToolsEnabled(UIToolClass enmClass, bool fEnabled) 78 78 { 79 79 m_pToolsModel->setToolsEnabled(enmClass, fEnabled); 80 80 } 81 81 82 bool UITools::areToolsEnabled(UITool sClass enmClass) const82 bool UITools::areToolsEnabled(UIToolClass enmClass) const 83 83 { 84 84 return m_pToolsModel->areToolsEnabled(enmClass); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UITools.h
r74975 r75016 72 72 73 73 /** Defines current tools @a enmClass. */ 74 void setToolsClass(UITool sClass enmClass);74 void setToolsClass(UIToolClass enmClass); 75 75 /** Returns current tools class. */ 76 UITool sClass toolsClass() const;76 UIToolClass toolsClass() const; 77 77 78 78 /** Defines current tools @a enmType. */ 79 void setToolsType(UITool sType enmType);79 void setToolsType(UIToolType enmType); 80 80 /** Returns current tools type. */ 81 UITool sType toolsType() const;81 UIToolType toolsType() const; 82 82 83 83 /** Defines whether certain @a enmClass of tools is @a fEnabled.*/ 84 void setToolsEnabled(UITool sClass enmClass, bool fEnabled);84 void setToolsEnabled(UIToolClass enmClass, bool fEnabled); 85 85 /** Returns whether certain class of tools is enabled.*/ 86 bool areToolsEnabled(UITool sClass enmClass) const;86 bool areToolsEnabled(UIToolClass enmClass) const; 87 87 /** @} */ 88 88 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.cpp
r74977 r75016 180 180 181 181 UIToolsItem::UIToolsItem(QGraphicsScene *pScene, 182 UITool sClass enmClass, UIToolsType enmType,182 UIToolClass enmClass, UIToolType enmType, 183 183 const QIcon &icon, const QString &strName) 184 184 : m_pScene(pScene) … … 222 222 } 223 223 224 void UIToolsItem::reconfigure(UITool sClass enmClass, UIToolsType enmType,224 void UIToolsItem::reconfigure(UIToolClass enmClass, UIToolType enmType, 225 225 const QIcon &icon, const QString &strName) 226 226 { … … 253 253 } 254 254 255 UITool sClass UIToolsItem::itemClass() const255 UIToolClass UIToolsItem::itemClass() const 256 256 { 257 257 return m_enmClass; 258 258 } 259 259 260 UITool sType UIToolsItem::itemType() const260 UIToolType UIToolsItem::itemType() const 261 261 { 262 262 return m_enmType; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsItem.h
r74599 r75016 78 78 * @param strName Brings the item name. */ 79 79 UIToolsItem(QGraphicsScene *pScene, 80 UITool sClass enmClass, UIToolsType enmType,80 UIToolClass enmClass, UIToolType enmType, 81 81 const QIcon &icon, const QString &strName); 82 82 /** Destructs item. */ … … 89 89 90 90 /** Reconfigures icon with new @a enmClass, @a enmType, @a icon and @a strName. */ 91 void reconfigure(UITool sClass enmClass, UIToolsType enmType,91 void reconfigure(UIToolClass enmClass, UIToolType enmType, 92 92 const QIcon &icon, const QString &strName); 93 93 94 94 /** Returns item class. */ 95 UITool sClass itemClass() const;95 UIToolClass itemClass() const; 96 96 /** Returns item type. */ 97 UITool sType itemType() const;97 UIToolType itemType() const; 98 98 /** Returns item icon. */ 99 99 const QIcon &icon() const; … … 246 246 QGraphicsScene *m_pScene; 247 247 /** Holds the item class. */ 248 UITool sClassm_enmClass;248 UIToolClass m_enmClass; 249 249 /** Holds the item type. */ 250 UITool sTypem_enmType;250 UIToolType m_enmType; 251 251 /** Holds the item icon. */ 252 252 QIcon m_icon; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.cpp
r74975 r75016 62 62 , m_pMouseHandler(0) 63 63 , m_pKeyboardHandler(0) 64 , m_enmCurrentClass(UITool sClass_Global)64 , m_enmCurrentClass(UIToolClass_Global) 65 65 { 66 66 /* Prepare: */ … … 119 119 } 120 120 121 void UIToolsModel::setToolsClass(UITool sClass enmClass)121 void UIToolsModel::setToolsClass(UIToolClass enmClass) 122 122 { 123 123 /* Update linked values: */ … … 131 131 } 132 132 133 UITool sClass UIToolsModel::toolsClass() const133 UIToolClass UIToolsModel::toolsClass() const 134 134 { 135 135 return m_enmCurrentClass; 136 136 } 137 137 138 void UIToolsModel::setToolsType(UITool sType enmType)138 void UIToolsModel::setToolsType(UIToolType enmType) 139 139 { 140 140 /* Update linked values: */ … … 150 150 } 151 151 152 UITool sType UIToolsModel::toolsType() const152 UIToolType UIToolsModel::toolsType() const 153 153 { 154 154 return currentItem()->itemType(); 155 155 } 156 156 157 void UIToolsModel::setToolsEnabled(UITool sClass enmClass, bool fEnabled)157 void UIToolsModel::setToolsEnabled(UIToolClass enmClass, bool fEnabled) 158 158 { 159 159 /* Update linked values: */ … … 164 164 } 165 165 166 bool UIToolsModel::areToolsEnabled(UITool sClass enmClass) const166 bool UIToolsModel::areToolsEnabled(UIToolClass enmClass) const 167 167 { 168 168 return m_statesToolsEnabled.value(enmClass); … … 192 192 switch (m_pCurrentItem->itemClass()) 193 193 { 194 case UITool sClass_Global: m_pLastItemGlobal = m_pCurrentItem; break;195 case UITool sClass_Machine: m_pLastItemMachine = m_pCurrentItem; break;194 case UIToolClass_Global: m_pLastItemGlobal = m_pCurrentItem; break; 195 case UIToolClass_Machine: m_pLastItemMachine = m_pCurrentItem; break; 196 196 default: break; 197 197 } … … 296 296 297 297 /* Choose last selected item of current class: */ 298 UIToolsItem *pLastSelectedItem = m_enmCurrentClass == UITool sClass_Global298 UIToolsItem *pLastSelectedItem = m_enmCurrentClass == UIToolClass_Global 299 299 ? m_pLastItemGlobal : m_pLastItemMachine; 300 300 if (navigationList().contains(pLastSelectedItem)) … … 438 438 { 439 439 /* Enable all classes of tools initially: */ 440 m_statesToolsEnabled[UITool sClass_Global] = true;441 m_statesToolsEnabled[UITool sClass_Machine] = true;440 m_statesToolsEnabled[UIToolClass_Global] = true; 441 m_statesToolsEnabled[UIToolClass_Machine] = true; 442 442 443 443 /* Prepare classes: */ 444 QList<UITool sClass> classes;445 classes << UITool sClass_Global;446 classes << UITool sClass_Global;447 classes << UITool sClass_Global;448 classes << UITool sClass_Global;449 classes << UITool sClass_Machine;450 classes << UITool sClass_Machine;451 classes << UITool sClass_Machine;444 QList<UIToolClass> classes; 445 classes << UIToolClass_Global; 446 classes << UIToolClass_Global; 447 classes << UIToolClass_Global; 448 classes << UIToolClass_Global; 449 classes << UIToolClass_Machine; 450 classes << UIToolClass_Machine; 451 classes << UIToolClass_Machine; 452 452 453 453 /* Prepare types: */ 454 QList<UITool sType> types;455 types << UITool sType_Welcome;456 types << UITool sType_Media;457 types << UITool sType_Network;458 types << UITool sType_Cloud;459 types << UITool sType_Details;460 types << UITool sType_Snapshots;461 types << UITool sType_Logs;454 QList<UIToolType> types; 455 types << UIToolType_Welcome; 456 types << UIToolType_Media; 457 types << UIToolType_Network; 458 types << UIToolType_Cloud; 459 types << UIToolType_Details; 460 types << UIToolType_Snapshots; 461 types << UIToolType_Logs; 462 462 463 463 /* Prepare icons: */ … … 516 516 517 517 /* First of them is current global class item definition: */ 518 UITool sType enmTypeGlobal = typeFromString(values.value(0));519 if (!isTypeOfClass(enmTypeGlobal, UITool sClass_Global))520 enmTypeGlobal = UITool sType_Welcome;518 UIToolType enmTypeGlobal = typeFromString(values.value(0)); 519 if (!isTypeOfClass(enmTypeGlobal, UIToolClass_Global)) 520 enmTypeGlobal = UIToolType_Welcome; 521 521 foreach (UIToolsItem *pItem, items()) 522 522 if (pItem->itemType() == enmTypeGlobal) … … 525 525 526 526 /* Second of them is current machine class item definition: */ 527 UITool sType enmTypeMachine = typeFromString(values.value(1));528 if (!isTypeOfClass(enmTypeMachine, UITool sClass_Machine))529 enmTypeMachine = UITool sType_Details;527 UIToolType enmTypeMachine = typeFromString(values.value(1)); 528 if (!isTypeOfClass(enmTypeMachine, UIToolClass_Machine)) 529 enmTypeMachine = UIToolType_Details; 530 530 foreach (UIToolsItem *pItem, items()) 531 531 if (pItem->itemType() == enmTypeMachine) … … 592 592 593 593 /* static */ 594 QString UIToolsModel::typeToString(UITool sType enmType)595 { 596 QMap<UITool sType, QString> values;594 QString UIToolsModel::typeToString(UIToolType enmType) 595 { 596 QMap<UIToolType, QString> values; 597 597 /* Global classes: */ 598 values[UITool sType_Welcome] = "Welcome";599 values[UITool sType_Media] = "Media";600 values[UITool sType_Network] = "Network";601 values[UITool sType_Cloud] = "Cloud";598 values[UIToolType_Welcome] = "Welcome"; 599 values[UIToolType_Media] = "Media"; 600 values[UIToolType_Network] = "Network"; 601 values[UIToolType_Cloud] = "Cloud"; 602 602 /* Machine classes: */ 603 values[UITool sType_Details] = "Details";604 values[UITool sType_Snapshots] = "Snapshots";605 values[UITool sType_Logs] = "Logs";603 values[UIToolType_Details] = "Details"; 604 values[UIToolType_Snapshots] = "Snapshots"; 605 values[UIToolType_Logs] = "Logs"; 606 606 /* Return value, null-string by default: */ 607 607 return values.value(enmType, QString()); … … 609 609 610 610 /* static */ 611 UITool sType UIToolsModel::typeFromString(const QString &strType)612 { 613 QMap<QString, UITool sType> values;611 UIToolType UIToolsModel::typeFromString(const QString &strType) 612 { 613 QMap<QString, UIToolType> values; 614 614 /* Global classes: */ 615 values["Welcome"] = UITool sType_Welcome;616 values["Media"] = UITool sType_Media;617 values["Network"] = UITool sType_Network;618 values["Cloud"] = UITool sType_Cloud;615 values["Welcome"] = UIToolType_Welcome; 616 values["Media"] = UIToolType_Media; 617 values["Network"] = UIToolType_Network; 618 values["Cloud"] = UIToolType_Cloud; 619 619 /* Machine classes: */ 620 values["Details"] = UITool sType_Details;621 values["Snapshots"] = UITool sType_Snapshots;622 values["Logs"] = UITool sType_Logs;623 /* Return value, UITool sType_Invalid by default: */624 return values.value(strType, UITool sType_Invalid);620 values["Details"] = UIToolType_Details; 621 values["Snapshots"] = UIToolType_Snapshots; 622 values["Logs"] = UIToolType_Logs; 623 /* Return value, UIToolType_Invalid by default: */ 624 return values.value(strType, UIToolType_Invalid); 625 625 } 626 626 627 627 /* static */ 628 bool UIToolsModel::isTypeOfClass(UITool sType enmType, UIToolsClass enmClass)628 bool UIToolsModel::isTypeOfClass(UIToolType enmType, UIToolClass enmClass) 629 629 { 630 630 switch (enmClass) 631 631 { 632 case UITool sClass_Global:632 case UIToolClass_Global: 633 633 { 634 634 switch (enmType) 635 635 { 636 case UITool sType_Welcome:637 case UITool sType_Media:638 case UITool sType_Network:639 case UITool sType_Cloud:636 case UIToolType_Welcome: 637 case UIToolType_Media: 638 case UIToolType_Network: 639 case UIToolType_Cloud: 640 640 return true; 641 641 default: … … 644 644 break; 645 645 } 646 case UITool sClass_Machine:646 case UIToolClass_Machine: 647 647 { 648 648 switch (enmType) 649 649 { 650 case UITool sType_Details:651 case UITool sType_Snapshots:652 case UITool sType_Logs:650 case UIToolType_Details: 651 case UIToolType_Snapshots: 652 case UIToolType_Logs: 653 653 return true; 654 654 default: -
trunk/src/VBox/Frontends/VirtualBox/src/manager/tools/UIToolsModel.h
r74975 r75016 98 98 99 99 /** Defines current tools @a enmClass. */ 100 void setToolsClass(UITool sClass enmClass);100 void setToolsClass(UIToolClass enmClass); 101 101 /** Returns current tools class. */ 102 UITool sClass toolsClass() const;102 UIToolClass toolsClass() const; 103 103 104 104 /** Defines current tools @a enmType. */ 105 void setToolsType(UITool sType enmType);105 void setToolsType(UIToolType enmType); 106 106 /** Returns current tools type. */ 107 UITool sType toolsType() const;107 UIToolType toolsType() const; 108 108 109 109 /** Defines whether certain @a enmClass of tools is @a fEnabled.*/ 110 void setToolsEnabled(UITool sClass enmClass, bool fEnabled);110 void setToolsEnabled(UIToolClass enmClass, bool fEnabled); 111 111 /** Returns whether certain class of tools is enabled.*/ 112 bool areToolsEnabled(UITool sClass enmClass) const;112 bool areToolsEnabled(UIToolClass enmClass) const; 113 113 114 114 /** Closes parent. */ … … 230 230 /** Returns @a enmType string representation. 231 231 * @todo move to UIConverter one day .. */ 232 static QString typeToString(UITool sType enmType);233 /** Returns @a strType converted to corresponding UITool sType.232 static QString typeToString(UIToolType enmType); 233 /** Returns @a strType converted to corresponding UIToolType. 234 234 * @todo move to UIConverter one day .. */ 235 static UITool sType typeFromString(const QString &strType);235 static UIToolType typeFromString(const QString &strType); 236 236 237 237 /** Returns whether passed @a enmType is of passed @a enmClass. */ 238 static bool isTypeOfClass(UITool sType enmType, UIToolsClass enmClass);238 static bool isTypeOfClass(UIToolType enmType, UIToolClass enmClass); 239 239 /** @} */ 240 240 … … 253 253 254 254 /** Holds current tools class. */ 255 UITool sClass m_enmCurrentClass;255 UIToolClass m_enmCurrentClass; 256 256 257 257 /** Holds whether tools of particular class are enabled. */ 258 QMap<UITool sClass, bool> m_statesToolsEnabled;258 QMap<UIToolClass, bool> m_statesToolsEnabled; 259 259 /** @} */ 260 260
Note:
See TracChangeset
for help on using the changeset viewer.