Changeset 54923 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Mar 24, 2015 3:08:36 PM (10 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialog.cpp
r54922 r54923 203 203 void UISettingsDialog::sltMarkLoaded() 204 204 { 205 /* Delete serializer early if exists: */ 206 if (UISettingsSerializer::instance()) 207 delete UISettingsSerializer::instance(); 208 205 209 /* Mark as loaded: */ 206 210 m_fLoaded = true; … … 209 213 void UISettingsDialog::sltMarkSaved() 210 214 { 215 /* Delete serializer early if exists: */ 216 if (UISettingsSerializer::instance()) 217 delete UISettingsSerializer::instance(); 218 211 219 /* Mark as saved: */ 212 220 m_fSaved = true; … … 241 249 QVariant::fromValue(data), 242 250 m_pSelector->settingPages()); 243 connect(pSettingsLoader, SIGNAL(destroyed(QObject*)), this, SLOT(sltMarkLoaded())); 244 /* Ask to raise required page priority: */ 245 pSettingsLoader->raisePriorityOfPage(m_pSelector->currentId()); 246 /* Start loader: */ 247 pSettingsLoader->start(); 251 AssertPtrReturnVoid(pSettingsLoader); 252 { 253 /* Configure settings loader: */ 254 connect(pSettingsLoader, SIGNAL(sigNotifyAboutProcessStarted()), this, SLOT(sltHandleProcessStarted())); 255 connect(pSettingsLoader, SIGNAL(sigNotifyAboutPagePostprocessed(int)), this, SLOT(sltHandlePageProcessed())); 256 connect(pSettingsLoader, SIGNAL(sigNotifyAboutProcessFinished()), this, SLOT(sltMarkLoaded())); 257 /* Raise current page priority: */ 258 pSettingsLoader->raisePriorityOfPage(m_pSelector->currentId()); 259 /* Start settings loader: */ 260 pSettingsLoader->start(); 261 } 248 262 249 263 /* Upload data finally: */ … … 261 275 QVariant::fromValue(data), 262 276 m_pSelector->settingPages()); 263 /* Start saver: */ 264 pSettingsSaver->start(); 277 AssertPtrReturnVoid(pSettingsSaver); 278 { 279 /* Start settings saver: */ 280 pSettingsSaver->start(); 281 } 265 282 266 283 /* Upload data finally: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.cpp
r54886 r54923 34 34 , m_data(data) 35 35 , m_fSavingComplete(m_direction == Load) 36 , m_fAllowToDestroySerializer(m_direction == Load)37 36 , m_iIdOfHighPriorityPage(-1) 38 37 { … … 47 46 } 48 47 49 /* Connecting this signals: */48 /* Handling internal signals, they are also redirected in their handlers: */ 50 49 connect(this, SIGNAL(sigNotifyAboutPageProcessed(int)), this, SLOT(sltHandleProcessedPage(int)), Qt::QueuedConnection); 51 50 connect(this, SIGNAL(sigNotifyAboutPagesProcessed()), this, SLOT(sltHandleProcessedPages()), Qt::QueuedConnection); 52 connect(this, SIGNAL(finished()), this, SLOT(sltDestroySerializer()), Qt::QueuedConnection); 53 /* Connecting parent signals: */ 54 connect(this, SIGNAL(sigNotifyAboutProcessStarted()), parent(), SLOT(sltHandleProcessStarted()), Qt::QueuedConnection); 55 connect(this, SIGNAL(sigNotifyAboutPageProcessed(int)), parent(), SLOT(sltHandlePageProcessed()), Qt::QueuedConnection); 51 52 /* Redirecting unhandled internal signals: */ 53 connect(this, SIGNAL(finished()), this, SIGNAL(sigNotifyAboutProcessFinished()), Qt::QueuedConnection); 56 54 } 57 55 … … 108 106 m_mutex.unlock(); 109 107 } 110 /* Allow to destroy serializer finally: */111 m_fAllowToDestroySerializer = true;112 108 } 113 109 } … … 128 124 } 129 125 } 126 /* Notify listeners about page postprocessed: */ 127 emit sigNotifyAboutPagePostprocessed(iPageId); 130 128 } 131 129 … … 146 144 pPage->revalidate(); 147 145 } 148 } 149 150 void UISettingsSerializer::sltDestroySerializer() 151 { 152 /* If not yet all events were processed, 153 * we should postpone destruction for now: */ 154 if (!m_fAllowToDestroySerializer) 155 QTimer::singleShot(0, this, SLOT(sltDestroySerializer())); 156 else 157 deleteLater(); 146 /* Notify listeners about pages postprocessed: */ 147 emit sigNotifyAboutPagesPostprocessed(); 158 148 } 159 149 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsSerializer.h
r54886 r54923 46 46 /** Notifies GUI thread about some page was processed. */ 47 47 void sigNotifyAboutPageProcessed(int iPageId); 48 49 48 /** Notifies GUI thread about all pages were processed. */ 50 49 void sigNotifyAboutPagesProcessed(); 50 51 /** Notifies listeners about some page was post-processed. */ 52 void sigNotifyAboutPagePostprocessed(int iPageId); 53 /** Notifies listeners about all pages were post-processed. */ 54 void sigNotifyAboutPagesPostprocessed(); 55 56 /** Notifies listeners about process has been finished. */ 57 void sigNotifyAboutProcessFinished(); 51 58 52 59 public: … … 88 95 void sltHandleProcessedPages(); 89 96 90 /** Killing serializer, softly :) */91 void sltDestroySerializer();92 93 97 protected: 94 98 … … 109 113 /** Holds whether the save was complete. */ 110 114 bool m_fSavingComplete; 111 /** Holds whether it is allowed to destroy the serializer. */112 bool m_fAllowToDestroySerializer;113 115 /** Holds the ID of the high priority page. */ 114 116 int m_iIdOfHighPriorityPage;
Note:
See TracChangeset
for help on using the changeset viewer.