Fixed: Spinner doesn't stop when no plugins #4168

Also refactored duplicate code
This commit is contained in:
Nick Bolton 2015-02-25 08:35:07 +00:00
parent c300b65662
commit 595e403c87
2 changed files with 10 additions and 17 deletions

View File

@ -64,9 +64,7 @@ void PluginWizardPage::changeEvent(QEvent *e)
void PluginWizardPage::showError(QString error) void PluginWizardPage::showError(QString error)
{ {
updateStatus(error); updateStatus(error);
stopSpinning(); showFinished();
m_Finished = true;
emit completeChanged();
} }
void PluginWizardPage::queryPluginDone() void PluginWizardPage::queryPluginDone()
@ -74,8 +72,7 @@ void PluginWizardPage::queryPluginDone()
QStringList pluginList = m_pWebClient->getPluginList(); QStringList pluginList = m_pWebClient->getPluginList();
if (pluginList.isEmpty()) { if (pluginList.isEmpty()) {
updateStatus(tr("Setup complete.")); updateStatus(tr("Setup complete."));
m_Finished = true; showFinished();
emit completeChanged();
} }
else { else {
downloadPlugins(); downloadPlugins();
@ -95,14 +92,11 @@ void PluginWizardPage::updateDownloadStatus()
void PluginWizardPage::finished() void PluginWizardPage::finished()
{ {
updateStatus(tr("Plugins installed successfully.")); // TODO: we should check if ns plugin exists
stopSpinning();
// ideally this should check if ns plugin is ready
m_AppConfig.setCryptoEnabled(true); m_AppConfig.setCryptoEnabled(true);
m_Finished = true; updateStatus(tr("Plugins installed successfully."));
emit completeChanged(); showFinished();
} }
void PluginWizardPage::generateCertificate() void PluginWizardPage::generateCertificate()
@ -173,9 +167,11 @@ void PluginWizardPage::downloadPlugins()
Qt::QueuedConnection); Qt::QueuedConnection);
} }
void PluginWizardPage::stopSpinning() void PluginWizardPage::showFinished()
{ {
m_pLabelSpinning->hide(); m_pLabelSpinning->hide();
m_Finished = true;
emit completeChanged();
} }
bool PluginWizardPage::isComplete() const bool PluginWizardPage::isComplete() const
@ -190,10 +186,7 @@ void PluginWizardPage::initializePage()
if (m_Email.isEmpty() || if (m_Email.isEmpty() ||
m_Password.isEmpty()) { m_Password.isEmpty()) {
updateStatus(tr("Setup complete.")); updateStatus(tr("Setup complete."));
stopSpinning(); showFinished();
m_Finished = true;
emit completeChanged();
return; return;
} }

View File

@ -54,7 +54,7 @@ protected slots:
private: private:
void updateStatus(QString info); void updateStatus(QString info);
void downloadPlugins(); void downloadPlugins();
void stopSpinning(); void showFinished();
private: private:
bool m_Finished; bool m_Finished;