Ref T41, prg version can be checked when it is not new

This commit is contained in:
Klaus Basan
2017-04-26 02:08:00 +02:00
committed by Mathew Sutcliffe
parent ee75d5f900
commit 420e80a437
2 changed files with 13 additions and 5 deletions

View File

@@ -389,7 +389,7 @@ namespace BlackGui
}); });
a = menu.addAction(CIcons::swift24(), "Check for updates"); a = menu.addAction(CIcons::swift24(), "Check for updates");
c = connect(a, &QAction::triggered, this, &CGuiApplication::checkNewVersion); c = connect(a, &QAction::triggered, this, &CGuiApplication::checkNewVersionMenu);
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed"); Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
Q_UNUSED(c); Q_UNUSED(c);
@@ -627,7 +627,7 @@ namespace BlackGui
return true; return true;
} }
void CGuiApplication::checkNewVersion() void CGuiApplication::checkNewVersion(bool onlyIfNew)
{ {
if (!m_installDialog) if (!m_installDialog)
{ {
@@ -635,7 +635,7 @@ namespace BlackGui
m_installDialog = new CDownloadAndInstallDialog(this->mainApplicationWindow()); m_installDialog = new CDownloadAndInstallDialog(this->mainApplicationWindow());
} }
if (!m_installDialog->isNewVersionAvailable()) return; if (onlyIfNew && !m_installDialog->isNewVersionAvailable()) return;
const int result = m_installDialog->exec(); const int result = m_installDialog->exec();
if (result != QDialog::Accepted) { return; } if (result != QDialog::Accepted) { return; }
} }
@@ -645,7 +645,7 @@ namespace BlackGui
QTimer::singleShot(delayedMs, this, [ = ] QTimer::singleShot(delayedMs, this, [ = ]
{ {
if (this->m_installDialog) { return; } if (this->m_installDialog) { return; }
this->checkNewVersion(); this->checkNewVersion(true);
}); });
} }
@@ -671,4 +671,9 @@ namespace BlackGui
} }
} }
} }
void CGuiApplication::checkNewVersionMenu()
{
this->checkNewVersion(false);
}
} // ns } // ns

View File

@@ -203,7 +203,7 @@ namespace BlackGui
virtual bool parsingHookIn() override; virtual bool parsingHookIn() override;
//! Check for a new version (update) //! Check for a new version (update)
void checkNewVersion(); void checkNewVersion(bool onlyIfNew);
//! Register metadata //! Register metadata
static void registerMetadata(); static void registerMetadata();
@@ -224,6 +224,9 @@ namespace BlackGui
//! Reload widget style from settings //! Reload widget style from settings
void settingsChanged(); void settingsChanged();
//! Check new from menu
void checkNewVersionMenu();
}; };
} // ns } // ns