Small improvement to UpdateDialog.
This commit is contained in:
parent
706bca49f9
commit
3073ceb312
@ -35,7 +35,7 @@
|
|||||||
#define VER_LAMEXP_MINOR_LO 9
|
#define VER_LAMEXP_MINOR_LO 9
|
||||||
#define VER_LAMEXP_TYPE Beta
|
#define VER_LAMEXP_TYPE Beta
|
||||||
#define VER_LAMEXP_PATCH 2
|
#define VER_LAMEXP_PATCH 2
|
||||||
#define VER_LAMEXP_BUILD 2278
|
#define VER_LAMEXP_BUILD 2279
|
||||||
#define VER_LAMEXP_CONFG 2188
|
#define VER_LAMEXP_CONFG 2188
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -937,8 +937,9 @@ void MainWindow::addFolder(const QString &path, bool recursive, bool delayed, QS
|
|||||||
/*
|
/*
|
||||||
* Check for updates
|
* Check for updates
|
||||||
*/
|
*/
|
||||||
bool MainWindow::checkForUpdates(void)
|
bool MainWindow::checkForUpdates(bool &haveNewVersion)
|
||||||
{
|
{
|
||||||
|
haveNewVersion = false;
|
||||||
bool bReadyToInstall = false;
|
bool bReadyToInstall = false;
|
||||||
|
|
||||||
UpdateDialog *updateDialog = new UpdateDialog(m_settings, this);
|
UpdateDialog *updateDialog = new UpdateDialog(m_settings, this);
|
||||||
@ -948,6 +949,7 @@ bool MainWindow::checkForUpdates(void)
|
|||||||
{
|
{
|
||||||
SHOW_CORNER_WIDGET(false);
|
SHOW_CORNER_WIDGET(false);
|
||||||
m_settings->autoUpdateLastCheck(QDate::currentDate().toString(Qt::ISODate));
|
m_settings->autoUpdateLastCheck(QDate::currentDate().toString(Qt::ISODate));
|
||||||
|
haveNewVersion = updateDialog->haveNewVersion();
|
||||||
bReadyToInstall = updateDialog->updateReadyToInstall();
|
bReadyToInstall = updateDialog->updateReadyToInstall();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1513,14 +1515,22 @@ void MainWindow::windowShown(void)
|
|||||||
{
|
{
|
||||||
if(MUtils::OS::current_date() >= lamexp_version_expires())
|
if(MUtils::OS::current_date() >= lamexp_version_expires())
|
||||||
{
|
{
|
||||||
qWarning("Binary has expired !!!");
|
qWarning("Binary expired !!!");
|
||||||
PLAY_SOUND_OPTIONAL("whammy", false);
|
PLAY_SOUND_OPTIONAL("whammy", false);
|
||||||
|
bool haveNewVersion = true;
|
||||||
if(QMessageBox::warning(this, tr("LameXP - Expired"), NOBREAK(QString("%1<br>%2").arg(tr("This demo (pre-release) version of LameXP has expired at %1.").arg(lamexp_version_expires().toString(Qt::ISODate)), tr("LameXP is free software and release versions won't expire."))), tr("Check for Updates"), tr("Exit Program")) == 0)
|
if(QMessageBox::warning(this, tr("LameXP - Expired"), NOBREAK(QString("%1<br>%2").arg(tr("This demo (pre-release) version of LameXP has expired at %1.").arg(lamexp_version_expires().toString(Qt::ISODate)), tr("LameXP is free software and release versions won't expire."))), tr("Check for Updates"), tr("Exit Program")) == 0)
|
||||||
{
|
{
|
||||||
checkForUpdates();
|
if (checkForUpdates(haveNewVersion))
|
||||||
|
{
|
||||||
|
QApplication::quit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(haveNewVersion)
|
||||||
|
{
|
||||||
|
QApplication::quit();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
QApplication::quit();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1546,7 +1556,8 @@ void MainWindow::windowShown(void)
|
|||||||
switch(ret)
|
switch(ret)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if(checkForUpdates())
|
bool haveNewVersion;
|
||||||
|
if(checkForUpdates(haveNewVersion))
|
||||||
{
|
{
|
||||||
QApplication::quit();
|
QApplication::quit();
|
||||||
return;
|
return;
|
||||||
@ -1572,7 +1583,8 @@ void MainWindow::windowShown(void)
|
|||||||
{
|
{
|
||||||
if(QMessageBox::information(this, tr("Update Reminder"), NOBREAK(lastUpdateCheck.isValid() ? tr("Your last update check was more than 14 days ago. Check for updates now?") : tr("Your did not check for LameXP updates yet. Check for updates now?")), tr("Check for Updates"), tr("Postpone")) == 0)
|
if(QMessageBox::information(this, tr("Update Reminder"), NOBREAK(lastUpdateCheck.isValid() ? tr("Your last update check was more than 14 days ago. Check for updates now?") : tr("Your did not check for LameXP updates yet. Check for updates now?")), tr("Check for Updates"), tr("Postpone")) == 0)
|
||||||
{
|
{
|
||||||
if(checkForUpdates())
|
bool haveNewVersion;
|
||||||
|
if(checkForUpdates(haveNewVersion))
|
||||||
{
|
{
|
||||||
QApplication::quit();
|
QApplication::quit();
|
||||||
return;
|
return;
|
||||||
@ -2266,7 +2278,8 @@ void MainWindow::checkForBetaUpdatesActionTriggered(bool checked)
|
|||||||
|
|
||||||
if(checkUpdatesNow)
|
if(checkUpdatesNow)
|
||||||
{
|
{
|
||||||
if(checkForUpdates())
|
bool haveNewVersion;
|
||||||
|
if(checkForUpdates(haveNewVersion))
|
||||||
{
|
{
|
||||||
QApplication::quit();
|
QApplication::quit();
|
||||||
}
|
}
|
||||||
@ -2369,7 +2382,8 @@ void MainWindow::checkUpdatesActionActivated(void)
|
|||||||
ABORT_IF_BUSY;
|
ABORT_IF_BUSY;
|
||||||
WidgetHideHelper hiderHelper(m_dropBox.data());
|
WidgetHideHelper hiderHelper(m_dropBox.data());
|
||||||
|
|
||||||
if(checkForUpdates())
|
bool haveNewVersion;
|
||||||
|
if(checkForUpdates(haveNewVersion))
|
||||||
{
|
{
|
||||||
QApplication::quit();
|
QApplication::quit();
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ private:
|
|||||||
|
|
||||||
void addFiles(const QStringList &files);
|
void addFiles(const QStringList &files);
|
||||||
void addFolder(const QString &path, bool recursive = false, bool delayed = false, QString filter = QString());
|
void addFolder(const QString &path, bool recursive = false, bool delayed = false, QString filter = QString());
|
||||||
bool checkForUpdates(void);
|
bool MainWindow::checkForUpdates(bool &haveNewVersion);
|
||||||
void initializeTranslation(void);
|
void initializeTranslation(void);
|
||||||
void refreshFavorites(void);
|
void refreshFavorites(void);
|
||||||
void openDocumentLink(QAction *const action);
|
void openDocumentLink(QAction *const action);
|
||||||
|
@ -79,6 +79,7 @@ UpdateDialog::UpdateDialog(const SettingsModel *const settings, QWidget *parent)
|
|||||||
m_logFile(new QStringList()),
|
m_logFile(new QStringList()),
|
||||||
m_betaUpdates(settings ? (settings->autoUpdateCheckBeta() || lamexp_version_demo()) : lamexp_version_demo()),
|
m_betaUpdates(settings ? (settings->autoUpdateCheckBeta() || lamexp_version_demo()) : lamexp_version_demo()),
|
||||||
m_success(false),
|
m_success(false),
|
||||||
|
m_haveNewVersion(false),
|
||||||
m_firstShow(true),
|
m_firstShow(true),
|
||||||
m_updateReadyToInstall(false),
|
m_updateReadyToInstall(false),
|
||||||
m_updaterProcess(NULL),
|
m_updaterProcess(NULL),
|
||||||
@ -357,9 +358,9 @@ void UpdateDialog::threadFinished(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const bool bHaveUpdate = (m_thread->getUpdateStatus() == MUtils::UpdateChecker::UpdateStatus_CompletedUpdateAvailable);
|
const bool bHaveNewVersion = (m_thread->getUpdateStatus() == MUtils::UpdateChecker::UpdateStatus_CompletedUpdateAvailable);
|
||||||
ui->installButton->setEnabled(bHaveUpdate);
|
ui->installButton->setEnabled(bHaveNewVersion);
|
||||||
MUtils::Sound::beep(bHaveUpdate ? MUtils::Sound::BEEP_NFO : MUtils::Sound::BEEP_WRN);
|
MUtils::Sound::beep(bHaveNewVersion ? MUtils::Sound::BEEP_NFO : MUtils::Sound::BEEP_WRN);
|
||||||
|
|
||||||
if(const MUtils::UpdateCheckerInfo *const updateInfo = m_thread->getUpdateInfo())
|
if(const MUtils::UpdateCheckerInfo *const updateInfo = m_thread->getUpdateInfo())
|
||||||
{
|
{
|
||||||
@ -369,6 +370,7 @@ void UpdateDialog::threadFinished(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_success = true;
|
m_success = true;
|
||||||
|
m_haveNewVersion = bHaveNewVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->retryButton->setVisible(!bSuccess);
|
ui->retryButton->setVisible(!bSuccess);
|
||||||
|
@ -51,6 +51,7 @@ public:
|
|||||||
|
|
||||||
bool getSuccess(void) { return m_success; }
|
bool getSuccess(void) { return m_success; }
|
||||||
bool updateReadyToInstall(void) { return m_updateReadyToInstall; }
|
bool updateReadyToInstall(void) { return m_updateReadyToInstall; }
|
||||||
|
bool haveNewVersion(void) { return m_haveNewVersion; }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateInit(void);
|
void updateInit(void);
|
||||||
@ -90,6 +91,7 @@ private:
|
|||||||
unsigned long m_updaterProcess;
|
unsigned long m_updaterProcess;
|
||||||
|
|
||||||
bool m_success;
|
bool m_success;
|
||||||
|
bool m_haveNewVersion;
|
||||||
bool m_updateReadyToInstall;
|
bool m_updateReadyToInstall;
|
||||||
bool m_firstShow;
|
bool m_firstShow;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user