Changeset 66593 in vbox
- Timestamp:
- Apr 17, 2017 3:18:57 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 114620
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 2 deleted
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk
r66279 r66593 295 295 src/UIMediumTypeChangeDialog.h \ 296 296 src/VBoxAboutDlg.h \ 297 src/VBoxGlobalSettings.h \298 297 src/VBoxLicenseViewer.h \ 299 298 src/VBoxSnapshotDetailsDlg.h \ … … 592 591 src/UIMediumTypeChangeDialog.cpp \ 593 592 src/VBoxAboutDlg.cpp \ 594 src/VBoxGlobalSettings.cpp \595 593 src/VBoxLicenseViewer.cpp \ 596 594 src/VBoxSnapshotDetailsDlg.cpp \ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.cpp
r66590 r66593 47 47 const char* UIExtraDataDefs::GUI_RestrictedGlobalSettingsPages = "GUI/RestrictedGlobalSettingsPages"; 48 48 const char* UIExtraDataDefs::GUI_RestrictedMachineSettingsPages = "GUI/RestrictedMachineSettingsPages"; 49 50 /* Settings: General: */ 51 const char* UIExtraDataDefs::GUI_HostScreenSaverDisabled = "GUI/HostScreenSaverDisabled"; 49 52 50 53 /* Settings: Language: */ -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h
r66590 r66593 68 68 /** Holds restricted Machine Settings pages. */ 69 69 extern const char* GUI_RestrictedMachineSettingsPages; 70 /** @} */ 71 72 /** @name Settings: General 73 * @{ */ 74 /** Holds whether host screen-saver should be disabled. */ 75 extern const char* GUI_HostScreenSaverDisabled; 70 76 /** @} */ 71 77 -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp
r66590 r66593 43 43 # include "UIHostComboEditor.h" 44 44 # include "UIMainEventListener.h" 45 # include "VBoxGlobalSettings.h"46 45 # include "VBoxGlobal.h" 47 46 # include "UIActionPool.h" … … 238 237 } 239 238 240 void UIExtraDataEventHandler::sltPreprocessExtraDataCanChange(QString strMachineID, QString strKey, QString strValue, bool &fVeto, QString &strVetoReason)239 void UIExtraDataEventHandler::sltPreprocessExtraDataCanChange(QString strMachineID, QString strKey, QString /* strValue */, bool & /* fVeto */, QString & /* strVetoReason */) 241 240 { 242 241 /* Preprocess global 'extra-data can change' event: */ … … 245 244 if (strKey.startsWith("GUI/")) 246 245 { 247 /* Try to set the global setting to check its syntax: */ 248 VBoxGlobalSettings gs(false /* non-null */); 249 /* Known GUI property key? */ 250 if (gs.setPublicProperty(strKey, strValue)) 251 { 252 /* But invalid GUI property value? */ 253 if (!gs) 254 { 255 /* Remember veto reason: */ 256 strVetoReason = gs.lastError(); 257 /* And disallow that change: */ 258 fVeto = true; 259 } 260 } 246 /* Check whether global extra-data property can be applied: */ 247 // TODO: Here can be various extra-data flags handling. 248 // Generally we should check whether one or another flag feats some rule (like reg-exp). 249 // For each required strValue we should set fVeto = true; and fill strVetoReason = "with some text". 261 250 } 262 251 } … … 270 259 if (strKey.startsWith("GUI/")) 271 260 { 272 /* Apply global property: */273 m_mutex.lock();274 vboxGlobal().settings().setPublicProperty(strKey, strValue);275 m_mutex.unlock();276 AssertMsgReturnVoid(!!vboxGlobal().settings(), ("Failed to apply global property.\n"));261 /* Apply global extra-data property: */ 262 // TODO: Here can be various extra-data flags handling. 263 // Generally we should push one or another flag to various instances which want to handle 264 // those flags independently from UIExtraDataManager. Remember to process each required strValue 265 // from under the m_mutex lock (since we are in another thread) and unlock that m_mutex afterwards. 277 266 } 278 267 } … … 2337 2326 } 2338 2327 2328 bool UIExtraDataManager::hostScreenSaverDisabled() 2329 { 2330 /* 'False' unless feature allowed: */ 2331 return isFeatureAllowed(GUI_HostScreenSaverDisabled); 2332 } 2333 2334 void UIExtraDataManager::setHostScreenSaverDisabled(bool fDisabled) 2335 { 2336 /* 'True' if feature allowed, null-string otherwise: */ 2337 setExtraDataString(GUI_HostScreenSaverDisabled, toFeatureAllowed(fDisabled)); 2338 } 2339 2339 2340 QString UIExtraDataManager::languageId() 2340 2341 { -
trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h
r66590 r66593 187 187 /** Returns restricted machine settings pages. */ 188 188 QList<MachineSettingsPageType> restrictedMachineSettingsPages(const QString &strID); 189 /** @} */ 190 191 /** @name Settings: General 192 * @{ */ 193 /** Returns whether the host screen-saver should be disabled. */ 194 bool hostScreenSaverDisabled(); 195 /** Defines whether the host screen-saver should be @a fDisabled. */ 196 void setHostScreenSaverDisabled(bool fDisabled); 189 197 /** @} */ 190 198 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r66569 r66593 479 479 "VirtualBox Manager window, and select one of the existing languages on the <b>Language</b> page.</p>") 480 480 .arg(strLangFile)); 481 }482 483 void UIMessageCenter::cannotLoadGlobalConfig(const CVirtualBox &vbox, const QString &strError) const484 {485 error(0, MessageType_Critical,486 tr("<p>Failed to load the global GUI configuration from <b><nobr>%1</nobr></b>.</p>"487 "<p>The application will now terminate.</p>")488 .arg(CVirtualBox(vbox).GetSettingsFilePath()),489 !vbox.isOk() ? formatErrorInfo(vbox) : QString("<!--EOM--><p>%1</p>").arg(vboxGlobal().emphasize(strError)));490 481 } 491 482 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r66566 r66593 165 165 void cannotFindLanguage(const QString &strLangId, const QString &strNlsPath) const; 166 166 void cannotLoadLanguage(const QString &strLangFile) const; 167 void cannotLoadGlobalConfig(const CVirtualBox &vbox, const QString &strError) const;168 167 void cannotSaveGlobalConfig(const CVirtualBox &vbox) const; 169 168 void cannotFindMachineByName(const CVirtualBox &vbox, const QString &strName) const; -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp
r66587 r66593 341 341 #endif /* VBOX_WS_MAC */ 342 342 343 /**344 * Sets the new global settings and saves them to the VirtualBox server.345 */346 bool VBoxGlobal::setSettings (VBoxGlobalSettings &gs)347 {348 gs.save(m_vbox);349 350 if (!m_vbox.isOk())351 {352 msgCenter().cannotSaveGlobalConfig(m_vbox);353 return false;354 }355 356 /* We don't assign gs to our gset member here, because VBoxCallback357 * will update gset as necessary when new settings are successfully358 * sent to the VirtualBox server by gs.save(). */359 360 return true;361 }362 363 343 QWidget* VBoxGlobal::activeMachineWindow() const 364 344 { … … 2190 2170 /** 2191 2171 * Returns the loaded (active) language ID. 2192 * Note that it may not match with VBoxGlobalSettings::languageId() if the2172 * Note that it may not match with UIExtraDataManager::languageId() if the 2193 2173 * specified language cannot be loaded. 2194 2174 * If the built-in language is active, this method returns "C". … … 4117 4097 m_pThreadPool = new UIThreadPool(3 /* worker count */, 5000 /* worker timeout */); 4118 4098 4119 /* create default non-null global settings */4120 gset = VBoxGlobalSettings (false);4121 4122 /* try to load global settings */4123 gset.load(m_vbox);4124 if (!m_vbox.isOk() || !gset)4125 {4126 msgCenter().cannotLoadGlobalConfig(m_vbox, gset.lastError());4127 return;4128 }4129 4130 4099 /* Load translation based on the user settings: */ 4131 4100 QString sLanguageId = gEDataManager->languageId(); -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h
r66397 r66593 34 34 #include "UIDefs.h" 35 35 #include "UIMediumDefs.h" 36 #include "VBoxGlobalSettings.h"37 36 #ifdef VBOX_WS_X11 38 37 # include "VBoxX11Helper.h" … … 144 143 UIThreadPool* threadPool() const { return m_pThreadPool; } 145 144 146 VBoxGlobalSettings &settings() { return gset; }147 bool setSettings (VBoxGlobalSettings &gs);148 149 145 /** Returns currently active virtual machine window. */ 150 146 QWidget* activeMachineWindow() const; … … 547 543 /** Holds whether VBoxSVC is currently available. */ 548 544 bool m_fVBoxSVCAvailable; 549 550 VBoxGlobalSettings gset;551 545 552 546 /** Holds whether GUI is separate (from VM) process. */ -
trunk/src/VBox/Frontends/VirtualBox/src/precomp.h
r65381 r66593 647 647 #include "UIFilePathSelector.h" 648 648 #include "VBoxGlobal.h" 649 #include "VBoxGlobalSettings.h"650 649 #include "VBoxGuestRAMSlider.h" 651 650 //#include "VBoxIChatTheaterWrapper.h" -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r66355 r66593 205 205 void UISettingsDialogGlobal::loadOwnData() 206 206 { 207 /* Get properties and settings: */207 /* Get properties: */ 208 208 CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties(); 209 VBoxGlobalSettings settings = vboxGlobal().settings();210 209 /* Prepare global data: */ 211 210 qRegisterMetaType<UISettingsDataGlobal>(); 212 UISettingsDataGlobal data(properties , settings);211 UISettingsDataGlobal data(properties); 213 212 QVariant varData = QVariant::fromValue(data); 214 213 … … 219 218 void UISettingsDialogGlobal::saveOwnData() 220 219 { 221 /* Get properties and settings: */220 /* Get properties: */ 222 221 CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties(); 223 VBoxGlobalSettings settings = vboxGlobal().settings();224 222 /* Prepare global data: */ 225 223 qRegisterMetaType<UISettingsDataGlobal>(); 226 UISettingsDataGlobal data(properties , settings);224 UISettingsDataGlobal data(properties); 227 225 QVariant varData = QVariant::fromValue(data); 228 226 … … 230 228 UISettingsDialog::saveData(varData); 231 229 232 /* Get updated properties & settings: */230 /* Get updated properties: */ 233 231 CSystemProperties newProperties = varData.value<UISettingsDataGlobal>().m_properties; 234 VBoxGlobalSettings newSettings = varData.value<UISettingsDataGlobal>().m_settings;235 232 /* If properties are not OK => show the error: */ 236 233 if (!newProperties.isOk()) 237 234 msgCenter().cannotSetSystemProperties(newProperties, this); 238 /* Else save the new settings if they were changed: */239 else if (!(newSettings == settings))240 vboxGlobal().setSettings(newSettings);241 235 242 236 /* Mark as saved: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.cpp
r62493 r66593 80 80 } 81 81 82 /* Fetch data to m_properties & m_settings: */82 /* Fetch data to m_properties: */ 83 83 void UISettingsPageGlobal::fetchData(const QVariant &data) 84 84 { 85 85 m_properties = data.value<UISettingsDataGlobal>().m_properties; 86 m_settings = data.value<UISettingsDataGlobal>().m_settings;87 86 } 88 87 89 /* Upload m_properties & m_settingsto data: */88 /* Upload m_properties to data: */ 90 89 void UISettingsPageGlobal::uploadData(QVariant &data) const 91 90 { 92 data = QVariant::fromValue(UISettingsDataGlobal(m_properties , m_settings));91 data = QVariant::fromValue(UISettingsDataGlobal(m_properties)); 93 92 } 94 93 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h
r66163 r66593 27 27 #include "UISettingsDefs.h" 28 28 #include "UIExtraDataDefs.h" 29 #include "VBoxGlobalSettings.h"30 29 31 30 /* COM includes: */ … … 53 52 { 54 53 UISettingsDataGlobal() {} 55 UISettingsDataGlobal(const CSystemProperties &properties , const VBoxGlobalSettings &settings)56 : m_properties(properties) , m_settings(settings){}54 UISettingsDataGlobal(const CSystemProperties &properties) 55 : m_properties(properties) {} 57 56 CSystemProperties m_properties; 58 VBoxGlobalSettings m_settings;59 57 }; 60 58 Q_DECLARE_METATYPE(UISettingsDataGlobal); … … 207 205 /* Global data source: */ 208 206 CSystemProperties m_properties; 209 VBoxGlobalSettings m_settings;210 207 }; 211 208 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.cpp
r66588 r66593 76 76 void UIGlobalSettingsDisplay::loadToCacheFrom(QVariant &data) 77 77 { 78 /* Fetch data to properties & settings: */78 /* Fetch data to properties: */ 79 79 UISettingsPageGlobal::fetchData(data); 80 80 … … 94 94 m_pCache->cacheInitialData(oldDisplayData); 95 95 96 /* Upload properties & settingsto data: */96 /* Upload properties to data: */ 97 97 UISettingsPageGlobal::uploadData(data); 98 98 } … … 130 130 void UIGlobalSettingsDisplay::saveFromCacheTo(QVariant &data) 131 131 { 132 /* Fetch data to properties & settings: */132 /* Fetch data to properties: */ 133 133 UISettingsPageGlobal::fetchData(data); 134 134 … … 144 144 } 145 145 146 /* Upload properties & settingsto data: */146 /* Upload properties to data: */ 147 147 UISettingsPageGlobal::uploadData(data); 148 148 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp
r66568 r66593 271 271 void UIGlobalSettingsExtension::loadToCacheFrom(QVariant &data) 272 272 { 273 /* Fetch data to properties & settings: */273 /* Fetch data to properties: */ 274 274 UISettingsPageGlobal::fetchData(data); 275 275 … … 293 293 m_pCache->cacheInitialData(oldExtensionData); 294 294 295 /* Upload properties & settingsto data: */295 /* Upload properties to data: */ 296 296 UISettingsPageGlobal::uploadData(data); 297 297 } … … 319 319 void UIGlobalSettingsExtension::saveFromCacheTo(QVariant &data) 320 320 { 321 /* Fetch data to properties & settings: */321 /* Fetch data to properties: */ 322 322 UISettingsPageGlobal::fetchData(data); 323 323 324 324 /* Nothing to save from the cache... */ 325 325 326 /* Upload properties & settingsto data: */326 /* Upload properties to data: */ 327 327 UISettingsPageGlobal::uploadData(data); 328 328 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp
r66568 r66593 25 25 /* GUI includes: */ 26 26 # include "UIGlobalSettingsGeneral.h" 27 # include "UIExtraDataManager.h" 27 28 # include "VBoxGlobal.h" 28 29 … … 79 80 void UIGlobalSettingsGeneral::loadToCacheFrom(QVariant &data) 80 81 { 81 /* Fetch data to properties & settings: */82 /* Fetch data to properties: */ 82 83 UISettingsPageGlobal::fetchData(data); 83 84 … … 91 92 oldGeneralData.m_strDefaultMachineFolder = m_properties.GetDefaultMachineFolder(); 92 93 oldGeneralData.m_strVRDEAuthLibrary = m_properties.GetVRDEAuthLibrary(); 93 oldGeneralData.m_fHostScreenSaverDisabled = m_settings.hostScreenSaverDisabled();94 oldGeneralData.m_fHostScreenSaverDisabled = gEDataManager->hostScreenSaverDisabled(); 94 95 95 96 /* Cache old general data: */ 96 97 m_pCache->cacheInitialData(oldGeneralData); 97 98 98 /* Upload properties & settingsto data: */99 /* Upload properties to data: */ 99 100 UISettingsPageGlobal::uploadData(data); 100 101 } … … 127 128 void UIGlobalSettingsGeneral::saveFromCacheTo(QVariant &data) 128 129 { 129 /* Fetch data to properties & settings: */130 /* Fetch data to properties: */ 130 131 UISettingsPageGlobal::fetchData(data); 131 132 … … 141 142 m_properties.SetVRDEAuthLibrary(m_pCache->data().m_strVRDEAuthLibrary); 142 143 if (m_pCache->data().m_fHostScreenSaverDisabled != m_pCache->base().m_fHostScreenSaverDisabled) 143 m_settings.setHostScreenSaverDisabled(m_pCache->data().m_fHostScreenSaverDisabled);144 gEDataManager->setHostScreenSaverDisabled(m_pCache->data().m_fHostScreenSaverDisabled); 144 145 } 145 146 146 /* Upload properties & settingsto data: */147 /* Upload properties to data: */ 147 148 UISettingsPageGlobal::uploadData(data); 148 149 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
r66571 r66593 882 882 void UIGlobalSettingsInput::loadToCacheFrom(QVariant &data) 883 883 { 884 /* Fetch data to properties & settings: */884 /* Fetch data to properties: */ 885 885 UISettingsPageGlobal::fetchData(data); 886 886 … … 910 910 m_pCache->cacheInitialData(oldInputData); 911 911 912 /* Upload properties & settingsto data: */912 /* Upload properties to data: */ 913 913 UISettingsPageGlobal::uploadData(data); 914 914 } … … 944 944 void UIGlobalSettingsInput::saveFromCacheTo(QVariant &data) 945 945 { 946 /* Fetch data to properties & settings: */946 /* Fetch data to properties: */ 947 947 UISettingsPageGlobal::fetchData(data); 948 948 … … 974 974 } 975 975 976 /* Upload properties & settingsto data: */976 /* Upload properties to data: */ 977 977 UISettingsPageGlobal::uploadData(data); 978 978 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.cpp
r66587 r66593 221 221 void UIGlobalSettingsLanguage::loadToCacheFrom(QVariant &data) 222 222 { 223 /* Fetch data to properties & settings: */223 /* Fetch data to properties: */ 224 224 UISettingsPageGlobal::fetchData(data); 225 225 … … 236 236 m_pCache->cacheInitialData(oldLanguageData); 237 237 238 /* Upload properties & settingsto data: */238 /* Upload properties to data: */ 239 239 UISettingsPageGlobal::uploadData(data); 240 240 } … … 266 266 void UIGlobalSettingsLanguage::saveFromCacheTo(QVariant &data) 267 267 { 268 /* Fetch data to properties & settings: */268 /* Fetch data to properties: */ 269 269 UISettingsPageGlobal::fetchData(data); 270 270 … … 277 277 } 278 278 279 /* Upload properties & settingsto data: */279 /* Upload properties to data: */ 280 280 UISettingsPageGlobal::uploadData(data); 281 281 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp
r66568 r66593 437 437 void UIGlobalSettingsNetwork::loadToCacheFrom(QVariant &data) 438 438 { 439 /* Fetch data to properties & settings: */439 /* Fetch data to properties: */ 440 440 UISettingsPageGlobal::fetchData(data); 441 441 … … 464 464 m_pCache->cacheInitialData(oldNetworkData); 465 465 466 /* Upload properties & settingsto data: */466 /* Upload properties to data: */ 467 467 UISettingsPageGlobal::uploadData(data); 468 468 } … … 518 518 void UIGlobalSettingsNetwork::saveFromCacheTo(QVariant &data) 519 519 { 520 /* Fetch data to properties & settings: */520 /* Fetch data to properties: */ 521 521 UISettingsPageGlobal::fetchData(data); 522 522 … … 533 533 } 534 534 535 /* Upload properties & settingsto data: */535 /* Upload properties to data: */ 536 536 UISettingsPageGlobal::uploadData(data); 537 537 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.cpp
r66590 r66593 81 81 void UIGlobalSettingsProxy::loadToCacheFrom(QVariant &data) 82 82 { 83 /* Fetch data to properties & settings: */83 /* Fetch data to properties: */ 84 84 UISettingsPageGlobal::fetchData(data); 85 85 … … 99 99 m_pCache->cacheInitialData(oldProxyData); 100 100 101 /* Upload properties & settingsto data: */101 /* Upload properties to data: */ 102 102 UISettingsPageGlobal::uploadData(data); 103 103 } … … 141 141 void UIGlobalSettingsProxy::saveFromCacheTo(QVariant &data) 142 142 { 143 /* Fetch data to properties & settings: */143 /* Fetch data to properties: */ 144 144 UISettingsPageGlobal::fetchData(data); 145 145 … … 155 155 } 156 156 157 /* Upload properties & settingsto data: */157 /* Upload properties to data: */ 158 158 UISettingsPageGlobal::uploadData(data); 159 159 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.cpp
r66568 r66593 82 82 void UIGlobalSettingsUpdate::loadToCacheFrom(QVariant &data) 83 83 { 84 /* Fetch data to properties & settings: */84 /* Fetch data to properties: */ 85 85 UISettingsPageGlobal::fetchData(data); 86 86 … … 101 101 m_pCache->cacheInitialData(oldUpdateData); 102 102 103 /* Upload properties & settingsto data: */103 /* Upload properties to data: */ 104 104 UISettingsPageGlobal::uploadData(data); 105 105 } … … 141 141 void UIGlobalSettingsUpdate::saveFromCacheTo(QVariant &data) 142 142 { 143 /* Fetch data to properties & settings: */143 /* Fetch data to properties: */ 144 144 UISettingsPageGlobal::fetchData(data); 145 145 … … 152 152 } 153 153 154 /* Upload properties & settingsto data: */154 /* Upload properties to data: */ 155 155 UISettingsPageGlobal::uploadData(data); 156 156 }
Note:
See TracChangeset
for help on using the changeset viewer.