Changeset 66579 in vbox
- Timestamp:
- Apr 14, 2017 4:02:52 PM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 10 edited
-
VBoxGlobalSettings.cpp (modified) (5 diffs)
-
VBoxGlobalSettings.h (modified) (3 diffs)
-
converter/UIConverterBackend.h (modified) (2 diffs)
-
converter/UIConverterBackendGlobal.cpp (modified) (2 diffs)
-
extradata/UIExtraDataDefs.cpp (modified) (1 diff)
-
extradata/UIExtraDataDefs.h (modified) (2 diffs)
-
extradata/UIExtraDataManager.cpp (modified) (1 diff)
-
extradata/UIExtraDataManager.h (modified) (1 diff)
-
globals/VBoxGlobal.cpp (modified) (1 diff)
-
runtime/UISession.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.cpp
r66571 r66579 51 51 { 52 52 /* default settings */ 53 guiFeatures = QString::null;54 53 languageId = QString::null; 55 54 maxGuestRes = QString::null; … … 61 60 VBoxGlobalSettingsData::VBoxGlobalSettingsData (const VBoxGlobalSettingsData &that) 62 61 { 63 guiFeatures = that.guiFeatures;64 62 languageId = that.languageId; 65 63 maxGuestRes = that.maxGuestRes; … … 76 74 { 77 75 return this == &that || 78 (guiFeatures == that.guiFeatures && 79 languageId == that.languageId && 76 (languageId == that.languageId && 80 77 maxGuestRes == that.maxGuestRes && 81 78 remapScancodes == that.remapScancodes && … … 103 100 gPropertyMap[] = 104 101 { 105 { "GUI/Customizations", "guiFeatures", "\\S+", true },106 102 { "GUI/LanguageID", "languageId", gVBoxLangIDRegExp, true }, 107 103 { "GUI/MaxGuestResolution", "maxGuestRes", "\\d*[1-9]\\d*,\\d*[1-9]\\d*|any|auto", true }, … … 110 106 { "GUI/HostScreenSaverDisabled", "hostScreenSaverDisabled", "true|false", true } 111 107 }; 112 113 bool VBoxGlobalSettings::isFeatureActive (const char *aFeature) const114 {115 QStringList featureList = data()->guiFeatures.split (',');116 return featureList.contains (aFeature);117 }118 108 119 109 /** -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobalSettings.h
r66571 r66579 37 37 private: 38 38 39 QString guiFeatures;40 39 QString languageId; 41 40 QString maxGuestRes; … … 52 51 { 53 52 Q_OBJECT 54 Q_PROPERTY (QString guiFeatures READ guiFeatures WRITE setGuiFeatures)55 53 Q_PROPERTY (QString languageId READ languageId WRITE setLanguageId) 56 54 Q_PROPERTY (QString maxGuestRes READ maxGuestRes WRITE setMaxGuestRes) … … 71 69 72 70 // Properties 73 74 QString guiFeatures() const { return data()->guiFeatures; }75 void setGuiFeatures (const QString &aFeatures)76 {77 mData()->guiFeatures = aFeatures;78 }79 bool isFeatureActive (const char*) const;80 71 81 72 QString languageId() const { return data()->languageId; } -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackend.h
r65206 r66579 90 90 template<> bool canConvert<PreviewUpdateIntervalType>(); 91 91 template<> bool canConvert<EventHandlingType>(); 92 template<> bool canConvert<GUIFeatureType>(); 92 93 template<> bool canConvert<GlobalSettingsPageType>(); 93 94 template<> bool canConvert<MachineSettingsPageType>(); … … 167 168 template<> PreviewUpdateIntervalType fromInternalInteger<PreviewUpdateIntervalType>(const int &iPreviewUpdateIntervalType); 168 169 template<> EventHandlingType fromInternalString<EventHandlingType>(const QString &strEventHandlingType); 170 template<> QString toInternalString(const GUIFeatureType &guiFeatureType); 171 template<> GUIFeatureType fromInternalString<GUIFeatureType>(const QString &strGuiFeatureType); 169 172 template<> QString toInternalString(const GlobalSettingsPageType &globalSettingsPageType); 170 173 template<> GlobalSettingsPageType fromInternalString<GlobalSettingsPageType>(const QString &strGlobalSettingsPageType); -
trunk/src/VBox/Frontends/VirtualBox/src/converter/UIConverterBackendGlobal.cpp
r65204 r66579 57 57 template<> bool canConvert<PreviewUpdateIntervalType>() { return true; } 58 58 template<> bool canConvert<EventHandlingType>() { return true; } 59 template<> bool canConvert<GUIFeatureType>() { return true; } 59 60 template<> bool canConvert<GlobalSettingsPageType>() { return true; } 60 61 template<> bool canConvert<MachineSettingsPageType>() { return true; } … … 1124 1125 } 1125 1126 1127 /* QString <= GUIFeatureType: */ 1128 template<> QString toInternalString(const GUIFeatureType &guiFeatureType) 1129 { 1130 QString strResult; 1131 switch (guiFeatureType) 1132 { 1133 case GUIFeatureType_NoSelector: strResult = "noSelector"; break; 1134 case GUIFeatureType_NoMenuBar: strResult = "noMenuBar"; break; 1135 case GUIFeatureType_NoStatusBar: strResult = "noStatusBar"; break; 1136 default: 1137 { 1138 AssertMsgFailed(("No text for GUI feature type=%d", guiFeatureType)); 1139 break; 1140 } 1141 } 1142 return strResult; 1143 } 1144 1145 /* GUIFeatureType <= QString: */ 1146 template<> GUIFeatureType fromInternalString<GUIFeatureType>(const QString &strGuiFeatureType) 1147 { 1148 /* Here we have some fancy stuff allowing us 1149 * to search through the keys using 'case-insensitive' rule: */ 1150 QStringList keys; QList<GUIFeatureType> values; 1151 keys << "noSelector"; values << GUIFeatureType_NoSelector; 1152 keys << "noMenuBar"; values << GUIFeatureType_NoMenuBar; 1153 keys << "noStatusBar"; values << GUIFeatureType_NoStatusBar; 1154 /* None type for unknown words: */ 1155 if (!keys.contains(strGuiFeatureType, Qt::CaseInsensitive)) 1156 return GUIFeatureType_None; 1157 /* Corresponding type for known words: */ 1158 return values.at(keys.indexOf(QRegExp(strGuiFeatureType, Qt::CaseInsensitive))); 1159 } 1160 1126 1161 /* QString <= GlobalSettingsPageType: */ 1127 1162 template<> QString toInternalString(const GlobalSettingsPageType &globalSettingsPageType) -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r66571 r66579 45 45 46 46 /* Settings: */ 47 const char* UIExtraDataDefs::GUI_Customizations = "GUI/Customizations"; 47 48 const char* UIExtraDataDefs::GUI_RestrictedGlobalSettingsPages = "GUI/RestrictedGlobalSettingsPages"; 48 49 const char* UIExtraDataDefs::GUI_RestrictedMachineSettingsPages = "GUI/RestrictedMachineSettingsPages"; -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r66571 r66579 65 65 /** @name Settings 66 66 * @{ */ 67 /** Holds GUI feature list. */ 68 extern const char* GUI_Customizations; 67 69 /** Holds restricted Global Settings pages. */ 68 70 extern const char* GUI_RestrictedGlobalSettingsPages; … … 500 502 }; 501 503 504 /** Common UI: GUI feature types. */ 505 enum GUIFeatureType 506 { 507 GUIFeatureType_None = 0, 508 GUIFeatureType_NoSelector = RT_BIT(0), 509 GUIFeatureType_NoMenuBar = RT_BIT(1), 510 GUIFeatureType_NoStatusBar = RT_BIT(2), 511 GUIFeatureType_All = 0xFF 512 }; 513 502 514 /** Common UI: Global settings page types. */ 503 515 enum GlobalSettingsPageType -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r66571 r66579 2297 2297 #endif /* VBOX_GUI_WITH_NETWORK_MANAGER */ 2298 2298 2299 bool UIExtraDataManager::guiFeatureEnabled(GUIFeatureType enmFeature) 2300 { 2301 /* Acquire GUI feature list: */ 2302 GUIFeatureType enmFeatures = GUIFeatureType_None; 2303 foreach (const QString &strValue, extraDataStringList(GUI_Customizations)) 2304 enmFeatures = static_cast<GUIFeatureType>(enmFeatures | gpConverter->fromInternalString<GUIFeatureType>(strValue)); 2305 /* Return whether the requested feature is enabled: */ 2306 return enmFeatures & enmFeature; 2307 } 2308 2299 2309 QList<GlobalSettingsPageType> UIExtraDataManager::restrictedGlobalSettingsPages() 2300 2310 { -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r66571 r66579 179 179 /** @name Settings 180 180 * @{ */ 181 /** Returns whether GUI @a enmFeature is enabled. */ 182 bool guiFeatureEnabled(GUIFeatureType enmFeature); 183 181 184 /** Returns restricted global settings pages. */ 182 185 QList<GlobalSettingsPageType> restrictedGlobalSettingsPages(); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r66516 r66579 4821 4821 void VBoxGlobal::showUI() 4822 4822 { 4823 /* Load application settings: */4824 VBoxGlobalSettings appSettings = settings();4825 4826 4823 /* Show Selector UI: */ 4827 4824 if (!isVMConsoleProcess()) 4828 4825 { 4829 4826 /* Make sure Selector UI is permitted, quit if not: */ 4830 if ( appSettings.isFeatureActive("noSelector"))4827 if (gEDataManager->guiFeatureEnabled(GUIFeatureType_NoSelector)) 4831 4828 { 4832 4829 msgCenter().cannotStartSelector(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r66571 r66579 1312 1312 /* Menu-bar options: */ 1313 1313 { 1314 const bool fEnabledGlobally = ! vboxGlobal().settings().isFeatureActive("noMenuBar");1314 const bool fEnabledGlobally = !gEDataManager->guiFeatureEnabled(GUIFeatureType_NoMenuBar); 1315 1315 const bool fEnabledForMachine = gEDataManager->menuBarEnabled(strMachineID); 1316 1316 const bool fEnabled = fEnabledGlobally && fEnabledForMachine; … … 1326 1326 /* Status-bar options: */ 1327 1327 { 1328 const bool fEnabledGlobally = ! vboxGlobal().settings().isFeatureActive("noStatusBar");1328 const bool fEnabledGlobally = !gEDataManager->guiFeatureEnabled(GUIFeatureType_NoStatusBar); 1329 1329 const bool fEnabledForMachine = gEDataManager->statusBarEnabled(strMachineID); 1330 1330 const bool fEnabled = fEnabledGlobally && fEnabledForMachine;
Note:
See TracChangeset
for help on using the changeset viewer.

