void UISettingsSerializer::start(Priority priority /* = InheritPriority */) { /* Notify listeners about we are starting: */ emit sigNotifyAboutProcessStarted(); /* If serializer saves settings: */ if (m_enmDirection == Save) { /* We should update internal page cache first: */ foreach (UISettingsPage *pPage, m_pages.values()) pPage->putToCache(); } /* Start async serializing thread: */ QThread::start(priority); }
/* Settings serializer constructor: */ UISettingsSerializer(QObject *pParent, const QVariant &data, UISettingsSerializeDirection direction) : QThread(pParent) , m_direction(direction) , m_data(data) , m_fSavingComplete(m_direction == UISettingsSerializeDirection_Load) , m_fAllowToDestroySerializer(m_direction == UISettingsSerializeDirection_Load) , m_iIdOfHighPriorityPage(-1) { /* Set instance: */ m_pInstance = this; /* Connecting this signals: */ connect(this, SIGNAL(sigNotifyAboutPageProcessed(int)), this, SLOT(sltHandleProcessedPage(int)), Qt::QueuedConnection); connect(this, SIGNAL(sigNotifyAboutPagesProcessed()), this, SLOT(sltHandleProcessedPages()), Qt::QueuedConnection); connect(this, SIGNAL(finished()), this, SLOT(sltDestroySerializer()), Qt::QueuedConnection); /* Connecting parent signals: */ connect(this, SIGNAL(sigNotifyAboutProcessStarted()), parent(), SLOT(sltHandleProcessStarted()), Qt::QueuedConnection); connect(this, SIGNAL(sigNotifyAboutPageProcessed(int)), parent(), SLOT(sltHandlePageProcessed()), Qt::QueuedConnection); }