- Timestamp:
- Apr 18, 2017 9:25:33 AM (8 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r66593 r66600 1067 1067 tr("Failed to set global VirtualBox properties."), 1068 1068 formatErrorInfo(properties)); 1069 } 1070 1071 void UIMessageCenter::cannotSaveDisplaySettings(const CSystemProperties &comProperties, QWidget *pParent /* = 0 */) 1072 { 1073 error(pParent, MessageType_Error, 1074 tr("Cannot save display settings."), 1075 formatErrorInfo(comProperties)); 1076 } 1077 1078 void UIMessageCenter::cannotSaveGeneralSettings(const CSystemProperties &comProperties, QWidget *pParent /* = 0 */) 1079 { 1080 error(pParent, MessageType_Error, 1081 tr("Cannot save general settings."), 1082 formatErrorInfo(comProperties)); 1083 } 1084 1085 void UIMessageCenter::cannotSaveInputSettings(const CSystemProperties &comProperties, QWidget *pParent /* = 0 */) 1086 { 1087 error(pParent, MessageType_Error, 1088 tr("Cannot save input settings."), 1089 formatErrorInfo(comProperties)); 1090 } 1091 1092 void UIMessageCenter::cannotSaveLanguageSettings(const CSystemProperties &comProperties, QWidget *pParent /* = 0 */) 1093 { 1094 error(pParent, MessageType_Error, 1095 tr("Cannot save language settings."), 1096 formatErrorInfo(comProperties)); 1097 } 1098 1099 void UIMessageCenter::cannotSaveProxySettings(const CSystemProperties &comProperties, QWidget *pParent /* = 0 */) 1100 { 1101 error(pParent, MessageType_Error, 1102 tr("Cannot save proxy settings."), 1103 formatErrorInfo(comProperties)); 1104 } 1105 1106 void UIMessageCenter::cannotSaveUpdateSettings(const CSystemProperties &comProperties, QWidget *pParent /* = 0 */) 1107 { 1108 error(pParent, MessageType_Error, 1109 tr("Cannot save update settings."), 1110 formatErrorInfo(comProperties)); 1069 1111 } 1070 1112 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r66593 r66600 229 229 void cannotRemoveHostInterface(const CProgress &progress, const QString &strInterfaceName, QWidget *pParent = 0); 230 230 void cannotSetSystemProperties(const CSystemProperties &properties, QWidget *pParent = 0) const; 231 void cannotSaveDisplaySettings(const CSystemProperties &comProperties, QWidget *pParent = 0); 232 void cannotSaveGeneralSettings(const CSystemProperties &comProperties, QWidget *pParent = 0); 233 void cannotSaveInputSettings(const CSystemProperties &comProperties, QWidget *pParent = 0); 234 void cannotSaveLanguageSettings(const CSystemProperties &comProperties, QWidget *pParent = 0); 235 void cannotSaveProxySettings(const CSystemProperties &comProperties, QWidget *pParent = 0); 236 void cannotSaveUpdateSettings(const CSystemProperties &comProperties, QWidget *pParent = 0); 231 237 232 238 /* API: Machine settings warnings: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.cpp
r66593 r66600 23 23 # include "UIExtraDataManager.h" 24 24 # include "UIGlobalSettingsDisplay.h" 25 # include "UIMessageCenter.h" 25 26 26 27 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ … … 133 134 UISettingsPageGlobal::fetchData(data); 134 135 135 /* Make sure display data was changed: */ 136 if (m_pCache->wasChanged()) 137 { 138 /* Save new display data from the cache: */ 139 if ( m_pCache->data().m_enmMaxGuestResolution != m_pCache->base().m_enmMaxGuestResolution 140 || m_pCache->data().m_maxGuestResolution != m_pCache->base().m_maxGuestResolution) 141 gEDataManager->setMaxGuestScreenResolution(m_pCache->data().m_enmMaxGuestResolution, m_pCache->data().m_maxGuestResolution); 142 if (m_pCache->data().m_fActivateHoveredMachineWindow != m_pCache->base().m_fActivateHoveredMachineWindow) 143 gEDataManager->setActivateHoveredMachineWindow(m_pCache->data().m_fActivateHoveredMachineWindow); 144 } 136 /* Update display data and failing state: */ 137 setFailed(!saveDisplayData()); 145 138 146 139 /* Upload properties to data: */ … … 245 238 } 246 239 240 bool UIGlobalSettingsDisplay::saveDisplayData() 241 { 242 /* Prepare result: */ 243 bool fSuccess = true; 244 /* Save display settings from the cache: */ 245 if (fSuccess && m_pCache->wasChanged()) 246 { 247 /* Get old display data from the cache: */ 248 const UIDataSettingsGlobalDisplay &oldDisplayData = m_pCache->base(); 249 /* Get new display data from the cache: */ 250 const UIDataSettingsGlobalDisplay &newDisplayData = m_pCache->data(); 251 252 // Here could go changes for m_properties. 253 254 /* Show error message if necessary: */ 255 if (!fSuccess) 256 msgCenter().cannotSaveDisplaySettings(m_properties, this); 257 258 /* Save maximum guest resolution policy and/or value: */ 259 if ( fSuccess 260 && ( newDisplayData.m_enmMaxGuestResolution != oldDisplayData.m_enmMaxGuestResolution 261 || newDisplayData.m_maxGuestResolution != oldDisplayData.m_maxGuestResolution)) 262 gEDataManager->setMaxGuestScreenResolution(newDisplayData.m_enmMaxGuestResolution, newDisplayData.m_maxGuestResolution); 263 /* Save whether hovered machine-window should be activated automatically: */ 264 if (fSuccess && newDisplayData.m_fActivateHoveredMachineWindow != oldDisplayData.m_fActivateHoveredMachineWindow) 265 gEDataManager->setActivateHoveredMachineWindow(newDisplayData.m_fActivateHoveredMachineWindow); 266 } 267 /* Return result: */ 268 return fSuccess; 269 } 270 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsDisplay.h
r66290 r66600 75 75 void reloadMaximumGuestScreenSizePolicyComboBox(); 76 76 77 /** Saves existing display data from the cache. */ 78 bool saveDisplayData(); 79 77 80 /** Holds the page data cache instance. */ 78 81 UISettingsCacheGlobalDisplay *m_pCache; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp
r66593 r66600 26 26 # include "UIGlobalSettingsGeneral.h" 27 27 # include "UIExtraDataManager.h" 28 # include "UIMessageCenter.h" 28 29 # include "VBoxGlobal.h" 29 30 … … 131 132 UISettingsPageGlobal::fetchData(data); 132 133 133 /* Make sure general data was changed: */ 134 if (m_pCache->wasChanged()) 135 { 136 /* Save new general data from the cache: */ 137 if ( m_properties.isOk() 138 && m_pCache->data().m_strDefaultMachineFolder != m_pCache->base().m_strDefaultMachineFolder) 139 m_properties.SetDefaultMachineFolder(m_pCache->data().m_strDefaultMachineFolder); 140 if ( m_properties.isOk() 141 && m_pCache->data().m_strVRDEAuthLibrary != m_pCache->base().m_strVRDEAuthLibrary) 142 m_properties.SetVRDEAuthLibrary(m_pCache->data().m_strVRDEAuthLibrary); 143 if (m_pCache->data().m_fHostScreenSaverDisabled != m_pCache->base().m_fHostScreenSaverDisabled) 144 gEDataManager->setHostScreenSaverDisabled(m_pCache->data().m_fHostScreenSaverDisabled); 145 } 134 /* Update general data and failing state: */ 135 setFailed(!saveGeneralData()); 146 136 147 137 /* Upload properties to data: */ … … 192 182 } 193 183 184 bool UIGlobalSettingsGeneral::saveGeneralData() 185 { 186 /* Prepare result: */ 187 bool fSuccess = true; 188 /* Save general settings from the cache: */ 189 if (fSuccess && m_pCache->wasChanged()) 190 { 191 /* Get old general data from the cache: */ 192 const UIDataSettingsGlobalGeneral &oldGeneralData = m_pCache->base(); 193 /* Get new general data from the cache: */ 194 const UIDataSettingsGlobalGeneral &newGeneralData = m_pCache->data(); 195 196 /* Save default machine folder: */ 197 if ( fSuccess 198 && newGeneralData.m_strDefaultMachineFolder != oldGeneralData.m_strDefaultMachineFolder) 199 { 200 m_properties.SetDefaultMachineFolder(newGeneralData.m_strDefaultMachineFolder); 201 fSuccess = m_properties.isOk(); 202 } 203 /* Save VRDE auth library: */ 204 if ( fSuccess 205 && newGeneralData.m_strVRDEAuthLibrary != oldGeneralData.m_strVRDEAuthLibrary) 206 { 207 m_properties.SetVRDEAuthLibrary(newGeneralData.m_strVRDEAuthLibrary); 208 fSuccess = m_properties.isOk(); 209 } 210 211 /* Show error message if necessary: */ 212 if (!fSuccess) 213 msgCenter().cannotSaveGeneralSettings(m_properties, this); 214 215 /* Save new general data from the cache: */ 216 if (newGeneralData.m_fHostScreenSaverDisabled != oldGeneralData.m_fHostScreenSaverDisabled) 217 gEDataManager->setHostScreenSaverDisabled(newGeneralData.m_fHostScreenSaverDisabled); 218 } 219 /* Return result: */ 220 return fSuccess; 221 } 222 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.h
r66290 r66600 67 67 void cleanup(); 68 68 69 /** Saves existing general data from the cache. */ 70 bool saveGeneralData(); 71 69 72 /** Holds the page data cache instance. */ 70 73 UISettingsCacheGlobalGeneral *m_pCache; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.cpp
r66593 r66600 36 36 # include "UIShortcutPool.h" 37 37 # include "UIExtraDataManager.h" 38 # include "UIMessageCenter.h" 38 39 39 40 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ … … 947 948 UISettingsPageGlobal::fetchData(data); 948 949 949 /* Make sure input data was changed: */ 950 if (m_pCache->wasChanged()) 951 { 952 /* Save new host-combo shortcut from the cache: */ 953 const UIDataShortcutRow fakeHostComboItem(0, UIHostCombo::hostComboCacheKey(), QString(), QString(), QString()); 954 const int iHostComboItemBase = UIFunctorFindShortcut(UIFunctorFindShortcut::Base)(m_pCache->base().shortcuts(), fakeHostComboItem); 955 const int iHostComboItemData = UIFunctorFindShortcut(UIFunctorFindShortcut::Base)(m_pCache->data().shortcuts(), fakeHostComboItem); 956 const QString strHostComboBase = iHostComboItemBase != -1 ? m_pCache->base().shortcuts().at(iHostComboItemBase).currentSequence() : QString(); 957 const QString strHostComboData = iHostComboItemData != -1 ? m_pCache->data().shortcuts().at(iHostComboItemData).currentSequence() : QString(); 958 if (strHostComboData != strHostComboBase) 959 gEDataManager->setHostKeyCombination(strHostComboData); 960 961 /* Save other new shortcuts from the cache: */ 962 QMap<QString, QString> sequencesBase; 963 QMap<QString, QString> sequencesData; 964 foreach (const UIDataShortcutRow &item, m_pCache->base().shortcuts()) 965 sequencesBase.insert(item.key(), item.currentSequence()); 966 foreach (const UIDataShortcutRow &item, m_pCache->data().shortcuts()) 967 sequencesData.insert(item.key(), item.currentSequence()); 968 if (sequencesData != sequencesBase) 969 gShortcutPool->setOverrides(sequencesData); 970 971 /* Save other new things from the cache: */ 972 if (m_pCache->data().autoCapture() != m_pCache->base().autoCapture()) 973 gEDataManager->setAutoCaptureEnabled(m_pCache->data().autoCapture()); 974 } 950 /* Update input data and failing state: */ 951 setFailed(!saveInputData()); 975 952 976 953 /* Upload properties to data: */ … … 1170 1147 } 1171 1148 1149 bool UIGlobalSettingsInput::saveInputData() 1150 { 1151 /* Prepare result: */ 1152 bool fSuccess = true; 1153 /* Save input settings from the cache: */ 1154 if (fSuccess && m_pCache->wasChanged()) 1155 { 1156 /* Get old input data from the cache: */ 1157 const UIDataSettingsGlobalInput &oldInputData = m_pCache->base(); 1158 /* Get new input data from the cache: */ 1159 const UIDataSettingsGlobalInput &newInputData = m_pCache->data(); 1160 1161 // Here could go changes for m_properties. 1162 1163 /* Show error message if necessary: */ 1164 if (!fSuccess) 1165 msgCenter().cannotSaveInputSettings(m_properties, this); 1166 1167 /* Save new host-combo shortcut from the cache: */ 1168 const UIDataShortcutRow fakeHostComboItem(0, UIHostCombo::hostComboCacheKey(), QString(), QString(), QString()); 1169 const int iHostComboItemBase = UIFunctorFindShortcut(UIFunctorFindShortcut::Base)(oldInputData.shortcuts(), fakeHostComboItem); 1170 const int iHostComboItemData = UIFunctorFindShortcut(UIFunctorFindShortcut::Base)(newInputData.shortcuts(), fakeHostComboItem); 1171 const QString strHostComboBase = iHostComboItemBase != -1 ? oldInputData.shortcuts().at(iHostComboItemBase).currentSequence() : QString(); 1172 const QString strHostComboData = iHostComboItemData != -1 ? newInputData.shortcuts().at(iHostComboItemData).currentSequence() : QString(); 1173 if (strHostComboData != strHostComboBase) 1174 gEDataManager->setHostKeyCombination(strHostComboData); 1175 1176 /* Save other new shortcuts from the cache: */ 1177 QMap<QString, QString> sequencesBase; 1178 QMap<QString, QString> sequencesData; 1179 foreach (const UIDataShortcutRow &item, oldInputData.shortcuts()) 1180 sequencesBase.insert(item.key(), item.currentSequence()); 1181 foreach (const UIDataShortcutRow &item, newInputData.shortcuts()) 1182 sequencesData.insert(item.key(), item.currentSequence()); 1183 if (sequencesData != sequencesBase) 1184 gShortcutPool->setOverrides(sequencesData); 1185 1186 /* Save other new things from the cache: */ 1187 if (newInputData.autoCapture() != oldInputData.autoCapture()) 1188 gEDataManager->setAutoCaptureEnabled(newInputData.autoCapture()); 1189 } 1190 /* Return result: */ 1191 return fSuccess; 1192 } 1193 1172 1194 # include "UIGlobalSettingsInput.moc" 1173 1195 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsInput.h
r66343 r66600 86 86 void cleanup(); 87 87 88 /** Saves existing input data from the cache. */ 89 bool saveInputData(); 90 88 91 /** Holds the tab-widget instance. */ 89 92 QTabWidget *m_pTabWidget; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.cpp
r66593 r66600 29 29 # include "UIGlobalSettingsLanguage.h" 30 30 # include "UIExtraDataManager.h" 31 # include "UIMessageCenter.h" 31 32 # include "VBoxGlobal.h" 32 33 … … 269 270 UISettingsPageGlobal::fetchData(data); 270 271 271 /* Make sure language data was changed: */ 272 if (m_pCache->wasChanged()) 273 { 274 /* Save new language data from the cache: */ 275 if (m_pCache->data().m_strLanguageId != m_pCache->base().m_strLanguageId) 276 gEDataManager->setLanguageId(m_pCache->data().m_strLanguageId); 277 } 272 /* Update language data and failing state: */ 273 setFailed(!saveLanguageData()); 278 274 279 275 /* Upload properties to data: */ … … 449 445 } 450 446 447 bool UIGlobalSettingsLanguage::saveLanguageData() 448 { 449 /* Prepare result: */ 450 bool fSuccess = true; 451 /* Save language settings from the cache: */ 452 if (fSuccess && m_pCache->wasChanged()) 453 { 454 /* Get old language data from the cache: */ 455 const UIDataSettingsGlobalLanguage &oldLanguageData = m_pCache->base(); 456 /* Get new language data from the cache: */ 457 const UIDataSettingsGlobalLanguage &newLanguageData = m_pCache->data(); 458 459 // Here could go changes for m_properties. 460 461 /* Show error message if necessary: */ 462 if (!fSuccess) 463 msgCenter().cannotSaveLanguageSettings(m_properties, this); 464 465 /* Save new language data from the cache: */ 466 if (newLanguageData.m_strLanguageId != oldLanguageData.m_strLanguageId) 467 gEDataManager->setLanguageId(newLanguageData.m_strLanguageId); 468 } 469 /* Return result: */ 470 return fSuccess; 471 } 472 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.h
r66290 r66600 83 83 void reloadLanguageTree(const QString &strLanguageId); 84 84 85 /** Saves existing language data from the cache. */ 86 bool saveLanguageData(); 87 85 88 /** Holds whether the page is polished. */ 86 89 bool m_fPolished; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.cpp
r66593 r66600 27 27 # include "UIGlobalSettingsProxy.h" 28 28 # include "UIExtraDataManager.h" 29 # include "UIMessageCenter.h" 29 30 # include "VBoxUtils.h" 30 31 … … 144 145 UISettingsPageGlobal::fetchData(data); 145 146 146 /* Make sure proxy data was changed: */ 147 if (m_pCache->wasChanged()) 148 { 149 /* Save new proxy data from the cache: */ 150 UIProxyManager proxyManager; 151 proxyManager.setProxyState(m_pCache->data().m_enmProxyState); 152 proxyManager.setProxyHost(m_pCache->data().m_strProxyHost); 153 proxyManager.setProxyPort(m_pCache->data().m_strProxyPort); 154 gEDataManager->setProxySettings(proxyManager.toString()); 155 } 147 /* Update proxy data and failing state: */ 148 setFailed(!saveProxyData()); 156 149 157 150 /* Upload properties to data: */ … … 259 252 } 260 253 254 bool UIGlobalSettingsProxy::saveProxyData() 255 { 256 /* Prepare result: */ 257 bool fSuccess = true; 258 /* Save proxy settings from the cache: */ 259 if (fSuccess && m_pCache->wasChanged()) 260 { 261 /* Get old proxy data from the cache: */ 262 //const UIDataSettingsGlobalProxy &oldProxyData = m_pCache->base(); 263 /* Get new proxy data from the cache: */ 264 const UIDataSettingsGlobalProxy &newProxyData = m_pCache->data(); 265 266 // Here could go changes for m_properties. 267 268 /* Show error message if necessary: */ 269 if (!fSuccess) 270 msgCenter().cannotSaveProxySettings(m_properties, this); 271 272 /* Save new proxy data from the cache: */ 273 UIProxyManager proxyManager; 274 proxyManager.setProxyState(newProxyData.m_enmProxyState); 275 proxyManager.setProxyHost(newProxyData.m_strProxyHost); 276 proxyManager.setProxyPort(newProxyData.m_strProxyPort); 277 gEDataManager->setProxySettings(proxyManager.toString()); 278 } 279 /* Return result: */ 280 return fSuccess; 281 } 282 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsProxy.h
r66290 r66600 76 76 void cleanup(); 77 77 78 /** Saves existing proxy data from the cache. */ 79 bool saveProxyData(); 80 78 81 /** Holds the page data cache instance. */ 79 82 UISettingsCacheGlobalProxy *m_pCache; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.cpp
r66593 r66600 23 23 # include "UIGlobalSettingsUpdate.h" 24 24 # include "UIExtraDataManager.h" 25 # include "UIMessageCenter.h" 25 26 # include "VBoxGlobal.h" 26 27 … … 144 145 UISettingsPageGlobal::fetchData(data); 145 146 146 /* Make sure update data was changed: */ 147 if (m_pCache->wasChanged()) 148 { 149 /* Save new update data from the cache: */ 150 const VBoxUpdateData newData(m_pCache->data().m_periodIndex, m_pCache->data().m_branchIndex); 151 gEDataManager->setApplicationUpdateData(newData.data()); 152 } 147 /* Update update data and failing state: */ 148 setFailed(!saveUpdateData()); 153 149 154 150 /* Upload properties to data: */ … … 251 247 } 252 248 249 bool UIGlobalSettingsUpdate::saveUpdateData() 250 { 251 /* Prepare result: */ 252 bool fSuccess = true; 253 /* Save update settings from the cache: */ 254 if (fSuccess && m_pCache->wasChanged()) 255 { 256 /* Get old update data from the cache: */ 257 //const UIDataSettingsGlobalUpdate &oldUpdateData = m_pCache->base(); 258 /* Get new update data from the cache: */ 259 const UIDataSettingsGlobalUpdate &newUpdateData = m_pCache->data(); 260 261 // Here could go changes for m_properties. 262 263 /* Show error message if necessary: */ 264 if (!fSuccess) 265 msgCenter().cannotSaveUpdateSettings(m_properties, this); 266 267 /* Save new update data from the cache: */ 268 const VBoxUpdateData newData(newUpdateData.m_periodIndex, newUpdateData.m_branchIndex); 269 gEDataManager->setApplicationUpdateData(newData.data()); 270 } 271 /* Return result: */ 272 return fSuccess; 273 } 274 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsUpdate.h
r66290 r66600 83 83 VBoxUpdateData::BranchType branchType() const; 84 84 85 /** Saves existing update data from the cache. */ 86 bool saveUpdateData(); 87 85 88 /** Holds the last checked button reference. */ 86 89 QRadioButton *m_pLastChosenRadio;
Note:
See TracChangeset
for help on using the changeset viewer.