Changeset 54932 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 24, 2015 5:58:35 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
r54928 r54932 65 65 , m_fPolished(false) 66 66 /* Loading/saving stuff: */ 67 , m_pSerializeProcess(0) 68 , m_pSerializeProgress(0) 67 69 , m_fLoaded(false) 68 70 , m_fSaved(false) … … 150 152 UISettingsDialog::~UISettingsDialog() 151 153 { 152 /* Delete serializer early if exists: */ 153 if (UISettingsSerializer::instance()) 154 delete UISettingsSerializer::instance(); 154 /* Delete serializer if exists: */ 155 if (serializeProcess()) 156 { 157 delete m_pSerializeProcess; 158 m_pSerializeProcess = 0; 159 } 160 if (serializeProgress()) 161 { 162 delete m_pSerializeProgress; 163 m_pSerializeProgress = 0; 164 } 155 165 156 166 /* Recall popup-pane if any: */ … … 208 218 void UISettingsDialog::sltMarkLoaded() 209 219 { 210 /* Delete serializer early if exists: */ 211 if (UISettingsSerializer::instance()) 212 delete UISettingsSerializer::instance(); 220 /* Delete serializer if exists: */ 221 if (serializeProcess()) 222 { 223 delete m_pSerializeProcess; 224 m_pSerializeProcess = 0; 225 } 226 if (serializeProgress()) 227 { 228 delete m_pSerializeProgress; 229 m_pSerializeProgress = 0; 230 } 213 231 214 232 /* Mark as loaded: */ … … 218 236 void UISettingsDialog::sltMarkSaved() 219 237 { 220 /* Delete serializer early if exists: */ 221 if (UISettingsSerializer::instance()) 222 delete UISettingsSerializer::instance(); 238 /* Delete serializer if exists: */ 239 if (serializeProcess()) 240 { 241 delete m_pSerializeProcess; 242 m_pSerializeProcess = 0; 243 } 244 if (serializeProgress()) 245 { 246 delete m_pSerializeProgress; 247 m_pSerializeProgress = 0; 248 } 223 249 224 250 /* Mark as saved: */ … … 250 276 251 277 /* Create settings loader: */ 252 UISettingsSerializer *pSettingsLoader= new UISettingsSerializer(this, UISettingsSerializer::Load,253 254 AssertPtrReturnVoid( pSettingsLoader);278 m_pSerializeProcess = new UISettingsSerializer(this, UISettingsSerializer::Load, 279 data, m_pSelector->settingPages()); 280 AssertPtrReturnVoid(m_pSerializeProcess); 255 281 { 256 282 /* Configure settings loader: */ 257 connect( pSettingsLoader, SIGNAL(sigNotifyAboutProcessStarted()), this, SLOT(sltHandleProcessStarted()));258 connect( pSettingsLoader, SIGNAL(sigNotifyAboutPagePostprocessed(int)), this, SLOT(sltHandlePageProcessed()));259 connect( pSettingsLoader, SIGNAL(sigNotifyAboutProcessFinished()), this, SLOT(sltMarkLoaded()));283 connect(m_pSerializeProcess, SIGNAL(sigNotifyAboutProcessStarted()), this, SLOT(sltHandleProcessStarted())); 284 connect(m_pSerializeProcess, SIGNAL(sigNotifyAboutPagePostprocessed(int)), this, SLOT(sltHandlePageProcessed())); 285 connect(m_pSerializeProcess, SIGNAL(sigNotifyAboutProcessFinished()), this, SLOT(sltMarkLoaded())); 260 286 /* Raise current page priority: */ 261 pSettingsLoader->raisePriorityOfPage(m_pSelector->currentId());287 m_pSerializeProcess->raisePriorityOfPage(m_pSelector->currentId()); 262 288 /* Start settings loader: */ 263 pSettingsLoader->start();289 m_pSerializeProcess->start(); 264 290 } 265 291 266 292 /* Upload data finally: */ 267 data = pSettingsLoader->data();293 data = m_pSerializeProcess->data(); 268 294 } 269 295 … … 274 300 275 301 /* Create settings saver: */ 276 UISettingsSerializerProgress *pSettingsSaveProgress = new UISettingsSerializerProgress(this, UISettingsSerializer::Save, 277 data, m_pSelector->settingPages()); 278 AssertPtrReturnVoid(pSettingsSaveProgress); 279 { 280 /* Configure settings saver: */ 281 connect(pSettingsSaveProgress, SIGNAL(finished(int)), this, SLOT(sltMarkSaved())); 302 m_pSerializeProgress = new UISettingsSerializerProgress(this, UISettingsSerializer::Save, 303 data, m_pSelector->settingPages()); 304 AssertPtrReturnVoid(m_pSerializeProgress); 305 { 282 306 /* Start settings saver: */ 283 pSettingsSaveProgress->exec();307 m_pSerializeProgress->exec(); 284 308 } 285 309 286 310 /* Upload data finally: */ 287 data = pSettingsSaveProgress->data();311 data = m_pSerializeProgress->data(); 288 312 } 289 313 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.h
r54928 r54932 32 32 class VBoxSettingsSelector; 33 33 class UISettingsPage; 34 class UISettingsSerializer; 35 class UISettingsSerializerProgress; 34 36 35 37 /* Using declarations: */ … … 68 70 69 71 protected: 72 73 /** Returns the serialize process instance. */ 74 UISettingsSerializer* serializeProcess() const { return m_pSerializeProcess; } 75 /** Returns the serialize progress instance. */ 76 UISettingsSerializerProgress* serializeProgress() const { return m_pSerializeProgress; } 70 77 71 78 /** Loads the @a data. */ … … 136 143 bool m_fPolished; 137 144 145 /** Holds the serialize process instance. */ 146 UISettingsSerializer *m_pSerializeProcess; 147 /** Holds the serialize progress instance. */ 148 UISettingsSerializerProgress *m_pSerializeProgress; 149 138 150 /* Loading/saving stuff: */ 139 151 bool m_fLoaded; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r54928 r54932 235 235 else if (!(newSettings == settings)) 236 236 vboxGlobal().setSettings(newSettings); 237 238 /* Mark as saved: */ 239 sltMarkSaved(); 237 240 } 238 241 … … 573 576 if (!m_machine.isOk()) 574 577 msgCenter().cannotSaveMachineSettings(m_machine, this); 578 579 /* Mark as saved: */ 580 sltMarkSaved(); 575 581 } 576 582 … … 780 786 void UISettingsDialogMachine::sltCategoryChanged(int cId) 781 787 { 782 if ( UISettingsSerializer::instance())783 UISettingsSerializer::instance()->raisePriorityOfPage(cId);788 if (serializeProcess()) 789 serializeProcess()->raisePriorityOfPage(cId); 784 790 785 791 UISettingsDialog::sltCategoryChanged(cId); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.cpp
r54928 r54932 26 26 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ 27 27 28 UISettingsSerializer* UISettingsSerializer::m_spInstance = 0;29 30 28 UISettingsSerializer::UISettingsSerializer(QObject *pParent, SerializationDirection direction, 31 29 const QVariant &data, const UISettingsPageList &pages) … … 36 34 , m_iIdOfHighPriorityPage(-1) 37 35 { 38 /* Prepare instance: */39 m_spInstance = this;40 41 36 /* Copy the page(s) from incoming list to our map: */ 42 37 foreach (UISettingsPage *pPage, pages) … … 58 53 if (isRunning()) 59 54 wait(); 60 61 /* Cleanup instance: */62 m_spInstance = 0;63 55 } 64 56 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.h
r54928 r54932 66 66 enum SerializationDirection { Load, Save }; 67 67 68 /** Returns the singleton instance. */69 static UISettingsSerializer* instance() { return m_spInstance; }70 71 68 /** Constructor. 72 69 * @param pParent being passed to the base-class, … … 109 106 /** Worker-thread serialization rutine. */ 110 107 void run(); 111 112 /** Holds the singleton instance. */113 static UISettingsSerializer *m_spInstance;114 108 115 109 /** Holds the load/save direction. */
Note:
See TracChangeset
for help on using the changeset viewer.