- Timestamp:
- Jul 15, 2014 12:15:46 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r51931 r52035 110 110 const char* UIExtraDataDefs::GUI_MiniToolBarAlignment = "GUI/MiniToolBarAlignment"; 111 111 const char* UIExtraDataDefs::GUI_RestrictedStatusBarIndicators = "GUI/RestrictedStatusBarIndicators"; 112 const char* UIExtraDataDefs::GUI_StatusBar_IndicatorOrder = "GUI/StatusBar/IndicatorOrder"; 112 113 #ifdef Q_WS_MAC 113 114 const char* UIExtraDataDefs::GUI_PresentationModeEnabled = "GUI/PresentationModeEnabled"; -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r51992 r52035 203 203 /** Holds restricted Runtime UI status-bar indicators. */ 204 204 extern const char* GUI_RestrictedStatusBarIndicators; 205 /** Holds Runtime UI status-bar indicator order. */ 206 extern const char* GUI_StatusBar_IndicatorOrder; 205 207 #ifdef Q_WS_MAC 206 208 /** Mac OS X: Holds whether 'presentation mode' enabled. */ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r52013 r52035 1783 1783 << GUI_HiDPI_Optimization 1784 1784 << GUI_ShowMiniToolBar << GUI_MiniToolBarAutoHide << GUI_MiniToolBarAlignment 1785 << GUI_RestrictedStatusBarIndicators 1785 << GUI_RestrictedStatusBarIndicators << GUI_StatusBar_IndicatorOrder 1786 1786 #ifdef Q_WS_MAC 1787 1787 << GUI_PresentationModeEnabled … … 2810 2810 /* Prepare result: */ 2811 2811 QList<IndicatorType> result; 2812 /* Get restricted status-bar -indicators: */2812 /* Get restricted status-bar indicators: */ 2813 2813 foreach (const QString &strValue, extraDataStringList(GUI_RestrictedStatusBarIndicators, strID)) 2814 2814 { 2815 IndicatorType value = gpConverter->fromInternalString<IndicatorType>(strValue);2816 if (value != IndicatorType_Invalid )2815 const IndicatorType value = gpConverter->fromInternalString<IndicatorType>(strValue); 2816 if (value != IndicatorType_Invalid && !result.contains(value)) 2817 2817 result << value; 2818 2818 } … … 2830 2830 /* Re-cache corresponding extra-data: */ 2831 2831 setExtraDataStringList(GUI_RestrictedStatusBarIndicators, data, strID); 2832 } 2833 2834 QList<IndicatorType> UIExtraDataManager::statusBarIndicatorOrder(const QString &strID) 2835 { 2836 /* Prepare result: */ 2837 QList<IndicatorType> result; 2838 /* Get status-bar indicator order: */ 2839 foreach (const QString &strValue, extraDataStringList(GUI_StatusBar_IndicatorOrder, strID)) 2840 { 2841 const IndicatorType value = gpConverter->fromInternalString<IndicatorType>(strValue); 2842 if (value != IndicatorType_Invalid && !result.contains(value)) 2843 result << value; 2844 } 2845 /* Return result: */ 2846 return result; 2847 } 2848 2849 void UIExtraDataManager::setStatusBarIndicatorOrder(const QList<IndicatorType> &list, const QString &strID) 2850 { 2851 /* Parse passed list: */ 2852 QStringList data; 2853 foreach (const IndicatorType &indicatorType, list) 2854 data << gpConverter->toInternalString(indicatorType); 2855 2856 /* Re-cache corresponding extra-data: */ 2857 setExtraDataStringList(GUI_StatusBar_IndicatorOrder, data, strID); 2832 2858 } 2833 2859 … … 3139 3165 { 3140 3166 /* Status-bar configuration change: */ 3141 if (strKey == GUI_RestrictedStatusBarIndicators) 3167 if (strKey == GUI_RestrictedStatusBarIndicators || 3168 strKey == GUI_StatusBar_IndicatorOrder) 3142 3169 emit sigStatusBarConfigurationChange(); 3143 3170 /* HID LEDs sync state changed (allowed if not restricted)? */ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r52013 r52035 369 369 void setRestrictedStatusBarIndicators(const QList<IndicatorType> &list, const QString &strID); 370 370 371 /** Returns Runtime UI status-bar indicator order list. */ 372 QList<IndicatorType> statusBarIndicatorOrder(const QString &strID); 373 /** Defines Runtime UI status-bar indicator order @a list. */ 374 void setStatusBarIndicatorOrder(const QList<IndicatorType> &list, const QString &strID); 375 371 376 #ifdef Q_WS_MAC 372 377 /** Mac OS X: Returns whether 'presentation mode' enabled. */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp
r52014 r52035 1040 1040 void UIIndicatorsPool::updatePool() 1041 1041 { 1042 /* Recache the list of restricted indicators: */ 1043 m_configuration = gEDataManager->restrictedStatusBarIndicators(vboxGlobal().managedVMUuid()); 1044 1045 /* Update indicators: */ 1042 /* Recache status-bar configuration: */ 1043 m_restrictions = gEDataManager->restrictedStatusBarIndicators(vboxGlobal().managedVMUuid()); 1044 m_order = gEDataManager->statusBarIndicatorOrder(vboxGlobal().managedVMUuid()); 1045 1046 /* Make sure the order is complete taking restrictions into account: */ 1046 1047 for (int iType = IndicatorType_Invalid; iType < IndicatorType_Max; ++iType) 1047 1048 { 1048 /* Determine indicator presence: */ 1049 const IndicatorType indicatorType = static_cast<IndicatorType>(iType); 1050 bool fPresenceAllowed = !m_configuration.contains(indicatorType); 1051 1052 /* If presence restricted: */ 1053 if (!fPresenceAllowed && m_pool.contains(indicatorType)) 1054 { 1055 /* Cleanup indicator: */ 1049 /* Get iterated type: */ 1050 IndicatorType type = (IndicatorType)iType; 1051 /* Skip invalid type: */ 1052 if (type == IndicatorType_Invalid) 1053 continue; 1054 /* Take restriction/presence into account: */ 1055 bool fRestricted = m_restrictions.contains(type); 1056 bool fPresent = m_order.contains(type); 1057 if (fRestricted && fPresent) 1058 m_order.removeAll(type); 1059 else if (!fRestricted && !fPresent) 1060 m_order << type; 1061 } 1062 1063 /* Remove restricted indicators: */ 1064 foreach (const IndicatorType &indicatorType, m_restrictions) 1065 if (m_pool.contains(indicatorType)) 1066 { 1056 1067 delete m_pool.value(indicatorType); 1057 1068 m_pool.remove(indicatorType); 1058 1069 } 1059 /* If presence allowed: */ 1060 else if (fPresenceAllowed && !m_pool.contains(indicatorType)) 1070 1071 /* Add/Update allowed indicators: */ 1072 foreach (const IndicatorType &indicatorType, m_order) 1073 { 1074 /* Indicator exists: */ 1075 if (m_pool.contains(indicatorType)) 1076 { 1077 /* Get indicator: */ 1078 QIStatusBarIndicator *pIndicator = m_pool.value(indicatorType); 1079 /* Make sure it have valid position: */ 1080 const int iWantedIndex = indicatorPosition(indicatorType); 1081 const int iActualIndex = m_pMainLayout->indexOf(pIndicator); 1082 if (iActualIndex != iWantedIndex) 1083 { 1084 /* Re-inject indicator into main-layout at proper position: */ 1085 m_pMainLayout->removeWidget(pIndicator); 1086 m_pMainLayout->insertWidget(iWantedIndex, pIndicator); 1087 } 1088 } 1089 /* Indicator missed: */ 1090 else 1061 1091 { 1062 1092 /* Create indicator: */ … … 1079 1109 connect(m_pool.value(indicatorType), SIGNAL(sigContextMenuRequest(QIStatusBarIndicator*, QContextMenuEvent*)), 1080 1110 this, SLOT(sltContextMenuRequest(QIStatusBarIndicator*, QContextMenuEvent*))); 1081 /* Insert indicator into main-layout : */1111 /* Insert indicator into main-layout at proper position: */ 1082 1112 m_pMainLayout->insertWidget(indicatorPosition(indicatorType), m_pool.value(indicatorType)); 1083 1113 } … … 1118 1148 { 1119 1149 int iPosition = 0; 1120 foreach (const IndicatorType &iteratedIndicatorType, m_ pool.keys())1150 foreach (const IndicatorType &iteratedIndicatorType, m_order) 1121 1151 if (iteratedIndicatorType == indicatorType) 1122 1152 return iPosition; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.h
r51995 r52035 57 57 ~UIIndicatorsPool(); 58 58 59 /** Returns indicator corresponding to passed @a indicatorType. */60 QIStatusBarIndicator* indicator(IndicatorType indicatorType) const { return m_pool.value(indicatorType); }61 62 59 /** Updates appearance for passed @a indicatorType. */ 63 60 void updateAppearance(IndicatorType indicatorType); … … 108 105 /** Holds the session reference. */ 109 106 CSession &m_session; 110 /** Holds the cached configuration. */ 111 QList<IndicatorType> m_configuration; 107 /** Holds the cached restrictions. */ 108 QList<IndicatorType> m_restrictions; 109 /** Holds the cached order. */ 110 QList<IndicatorType> m_order; 112 111 /** Holds cached indicator instances. */ 113 112 QMap<IndicatorType, QIStatusBarIndicator*> m_pool;
Note:
See TracChangeset
for help on using the changeset viewer.