Changeset 54921 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 24, 2015 2:29:53 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
r52730 r54921 35 35 # include "QIWidgetValidator.h" 36 36 # include "VBoxSettingsSelector.h" 37 # include "UISettingsSerializer.h" 37 38 # include "UISettingsPage.h" 38 39 # include "UIToolBar.h" … … 158 159 { 159 160 /* Load data: */ 160 load Data();161 loadOwnData(); 161 162 162 163 /* Execute dialog and wait for completion: */ … … 165 166 166 167 /* Save data: */ 167 save Data();168 saveOwnData(); 168 169 } 169 170 … … 197 198 void UISettingsDialog::sltMarkLoaded() 198 199 { 200 /* Mark as loaded: */ 199 201 m_fLoaded = true; 200 202 } … … 202 204 void UISettingsDialog::sltMarkSaved() 203 205 { 206 /* Mark as saved: */ 204 207 m_fSaved = true; 205 208 } … … 223 226 } 224 227 225 void UISettingsDialog::loadData() 226 { 228 void UISettingsDialog::loadData(QVariant &data) 229 { 230 /* Mark as not loaded: */ 227 231 m_fLoaded = false; 228 } 229 230 void UISettingsDialog::saveData() 231 { 232 233 /* Create settings loader: */ 234 UISettingsSerializer *pSettingsLoader = new UISettingsSerializer(this, 235 UISettingsSerializer::Load, 236 QVariant::fromValue(data), 237 m_pSelector->settingPages()); 238 connect(pSettingsLoader, SIGNAL(destroyed(QObject*)), this, SLOT(sltMarkLoaded())); 239 /* Ask to raise required page priority: */ 240 pSettingsLoader->raisePriorityOfPage(m_pSelector->currentId()); 241 /* Start loader: */ 242 pSettingsLoader->start(); 243 244 /* Upload data finally: */ 245 data = pSettingsLoader->data(); 246 } 247 248 void UISettingsDialog::saveData(QVariant &data) 249 { 250 /* Mark as not saved: */ 232 251 m_fSaved = false; 252 253 /* Create settings saver: */ 254 UISettingsSerializer *pSettingsSaver = new UISettingsSerializer(this, 255 UISettingsSerializer::Save, 256 QVariant::fromValue(data), 257 m_pSelector->settingPages()); 258 /* Start saver: */ 259 pSettingsSaver->start(); 260 261 /* Upload data finally: */ 262 data = pSettingsSaver->data(); 233 263 } 234 264 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h
r52727 r54921 66 66 protected: 67 67 68 /* Save/load API: */ 69 virtual void loadData(); 70 virtual void saveData(); 68 /** Loads the @a data. */ 69 void loadData(QVariant &data); 70 /** Wrapper for the method above. 71 * Loads the data from the corresponding source. */ 72 virtual void loadOwnData() = 0; 73 74 /** Saves the @a data. */ 75 void saveData(QVariant &data); 76 /** Wrapper for the method above. 77 * Saves the data to the corresponding source. */ 78 virtual void saveOwnData() = 0; 71 79 72 80 /* UI translator: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r54919 r54921 206 206 } 207 207 208 void UISettingsDialogGlobal::loadData() 209 { 210 /* Call to base-class: */ 211 UISettingsDialog::loadData(); 212 208 void UISettingsDialogGlobal::loadOwnData() 209 { 213 210 /* Get properties and settings: */ 214 211 CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties(); … … 217 214 qRegisterMetaType<UISettingsDataGlobal>(); 218 215 UISettingsDataGlobal data(properties, settings); 219 /* Create global settings loader: */ 220 UISettingsSerializer *pGlobalSettingsLoader = new UISettingsSerializer(this, 221 UISettingsSerializer::Load, 222 QVariant::fromValue(data), 223 m_pSelector->settingPages()); 224 connect(pGlobalSettingsLoader, SIGNAL(destroyed(QObject*)), this, SLOT(sltMarkLoaded())); 225 /* Start loader: */ 226 pGlobalSettingsLoader->start(); 227 } 228 229 void UISettingsDialogGlobal::saveData() 230 { 216 QVariant varData = QVariant::fromValue(data); 217 231 218 /* Call to base-class: */ 232 UISettingsDialog::saveData(); 233 219 UISettingsDialog::loadData(varData); 220 } 221 222 void UISettingsDialogGlobal::saveOwnData() 223 { 234 224 /* Get properties and settings: */ 235 225 CSystemProperties properties = vboxGlobal().virtualBox().GetSystemProperties(); … … 238 228 qRegisterMetaType<UISettingsDataGlobal>(); 239 229 UISettingsDataGlobal data(properties, settings); 240 /* Create global settings saver: */ 241 UISettingsSerializer *pGlobalSettingsSaver = new UISettingsSerializer(this, 242 UISettingsSerializer::Save, 243 QVariant::fromValue(data), 244 m_pSelector->settingPages()); 245 /* Start saver: */ 246 pGlobalSettingsSaver->start(); 230 QVariant varData = QVariant::fromValue(data); 231 232 /* Call to base-class: */ 233 UISettingsDialog::saveData(varData); 247 234 248 235 /* Get updated properties & settings: */ 249 CSystemProperties newProperties = pGlobalSettingsSaver->data().value<UISettingsDataGlobal>().m_properties;250 VBoxGlobalSettings newSettings = pGlobalSettingsSaver->data().value<UISettingsDataGlobal>().m_settings;236 CSystemProperties newProperties = varData.value<UISettingsDataGlobal>().m_properties; 237 VBoxGlobalSettings newSettings = varData.value<UISettingsDataGlobal>().m_settings; 251 238 /* If properties are not OK => show the error: */ 252 239 if (!newProperties.isOk()) … … 506 493 } 507 494 508 void UISettingsDialogMachine::load Data()495 void UISettingsDialogMachine::loadOwnData() 509 496 { 510 497 /* Check that session is NOT created: */ 511 498 if (!m_session.isNull()) 512 499 return; 513 514 /* Call to base-class: */515 UISettingsDialog::loadData();516 500 517 501 /* Disconnect global VBox events from this dialog: */ … … 532 516 qRegisterMetaType<UISettingsDataMachine>(); 533 517 UISettingsDataMachine data(m_machine, m_console); 534 /* Create machine settings loader: */ 535 UISettingsSerializer *pMachineSettingsLoader = new UISettingsSerializer(this, 536 UISettingsSerializer::Load, 537 QVariant::fromValue(data), 538 m_pSelector->settingPages()); 539 connect(pMachineSettingsLoader, SIGNAL(destroyed(QObject*)), this, SLOT(sltMarkLoaded())); 540 connect(pMachineSettingsLoader, SIGNAL(sigNotifyAboutPagesProcessed()), this, SLOT(sltSetFirstRunFlag())); 541 /* Ask to raise required page priority: */ 542 pMachineSettingsLoader->raisePriorityOfPage(m_pSelector->currentId()); 543 /* Start page loader: */ 544 pMachineSettingsLoader->start(); 545 } 546 547 void UISettingsDialogMachine::saveData() 518 QVariant varData = QVariant::fromValue(data); 519 520 /* Call to base-class: */ 521 UISettingsDialog::loadData(varData); 522 } 523 524 void UISettingsDialogMachine::saveOwnData() 548 525 { 549 526 /* Check that session is NOT created: */ 550 527 if (!m_session.isNull()) 551 528 return; 552 553 /* Call to base-class: */554 UISettingsDialog::saveData();555 529 556 530 /* Disconnect global VBox events from this dialog: */ … … 571 545 qRegisterMetaType<UISettingsDataMachine>(); 572 546 UISettingsDataMachine data(m_machine, m_console); 573 /* Create machine settings saver: */ 574 UISettingsSerializer *pMachineSettingsSaver = new UISettingsSerializer(this, 575 UISettingsSerializer::Save, 576 QVariant::fromValue(data), 577 m_pSelector->settingPages()); 578 /* Start saver: */ 579 pMachineSettingsSaver->start(); 547 QVariant varData = QVariant::fromValue(data); 548 549 /* Call to base-class: */ 550 UISettingsDialog::saveData(varData); 580 551 581 552 /* Get updated machine: */ 582 m_machine = pMachineSettingsSaver->data().value<UISettingsDataMachine>().m_machine;553 m_machine = varData.value<UISettingsDataMachine>().m_machine; 583 554 /* If machine is OK => perform final operations: */ 584 555 if (m_machine.isOk()) … … 743 714 UISettingsDialog::sltMarkLoaded(); 744 715 716 sltSetFirstRunFlag(); 717 745 718 /* Unlock the session if exists: */ 746 719 if (!m_session.isNull()) … … 821 794 822 795 /* Reload data: */ 823 load Data();796 loadOwnData(); 824 797 } 825 798 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.h
r52727 r54921 41 41 protected: 42 42 43 void loadData(); 44 void saveData(); 43 /** Loads the data from the corresponding source. */ 44 void loadOwnData(); 45 /** Saves the data to the corresponding source. */ 46 void saveOwnData(); 45 47 46 48 void retranslateUi(); … … 66 68 protected: 67 69 68 void loadData(); 69 void saveData(); 70 /** Loads the data from the corresponding source. */ 71 void loadOwnData(); 72 /** Saves the data to the corresponding source. */ 73 void saveOwnData(); 70 74 71 75 void retranslateUi();
Note:
See TracChangeset
for help on using the changeset viewer.