Rename lamexp_version_demo() into lamexp_version_test() + small code refactoring in MainWindow::checkForUpdates().
This commit is contained in:
parent
952f0a91d4
commit
4ff29d3b16
@ -581,7 +581,7 @@ void AboutDialog::initInformationTab(void)
|
|||||||
int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
|
int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
|
||||||
aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(QString("!!! --- DEBUG BUILD --- Expires at: %1 · Days left: %2 --- DEBUG BUILD --- !!!").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft)));
|
aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(QString("!!! --- DEBUG BUILD --- Expires at: %1 · Days left: %2 --- DEBUG BUILD --- !!!").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft)));
|
||||||
}
|
}
|
||||||
else if(lamexp_version_demo())
|
else if(lamexp_version_test())
|
||||||
{
|
{
|
||||||
int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
|
int daysLeft = qMax(currentDate.daysTo(lamexp_version_expires()), 0);
|
||||||
aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(tr("Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left.").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft)));
|
aboutText += QString("<hr><font color=\"crimson\">%1</font>").arg(tr("Note: This demo (pre-release) version of LameXP will expire at %1. Still %2 days left.").arg(lamexp_version_expires().toString(Qt::ISODate), QString::number(daysLeft)));
|
||||||
|
@ -712,8 +712,8 @@ MainWindow::MainWindow(MUtils::IPCChannel *const ipcChannel, FileListModel *cons
|
|||||||
ui->actionDisableSlowStartupNotifications->setChecked(!m_settings->antivirNotificationsEnabled());
|
ui->actionDisableSlowStartupNotifications->setChecked(!m_settings->antivirNotificationsEnabled());
|
||||||
ui->actionDisableShellIntegration->setChecked(!m_settings->shellIntegrationEnabled());
|
ui->actionDisableShellIntegration->setChecked(!m_settings->shellIntegrationEnabled());
|
||||||
ui->actionDisableShellIntegration->setDisabled(lamexp_version_portable() && ui->actionDisableShellIntegration->isChecked());
|
ui->actionDisableShellIntegration->setDisabled(lamexp_version_portable() && ui->actionDisableShellIntegration->isChecked());
|
||||||
ui->actionCheckForBetaUpdates->setChecked(m_settings->autoUpdateCheckBeta() || lamexp_version_demo());
|
ui->actionCheckForBetaUpdates->setChecked(m_settings->autoUpdateCheckBeta() || lamexp_version_test());
|
||||||
ui->actionCheckForBetaUpdates->setEnabled(!lamexp_version_demo());
|
ui->actionCheckForBetaUpdates->setEnabled(!lamexp_version_test());
|
||||||
ui->actionHibernateComputer->setChecked(m_settings->hibernateComputer());
|
ui->actionHibernateComputer->setChecked(m_settings->hibernateComputer());
|
||||||
ui->actionHibernateComputer->setEnabled(MUtils::OS::is_hibernation_supported());
|
ui->actionHibernateComputer->setEnabled(MUtils::OS::is_hibernation_supported());
|
||||||
connect(ui->actionDisableUpdateReminder, SIGNAL(triggered(bool)), this, SLOT(disableUpdateReminderActionTriggered(bool)));
|
connect(ui->actionDisableUpdateReminder, SIGNAL(triggered(bool)), this, SLOT(disableUpdateReminderActionTriggered(bool)));
|
||||||
@ -937,10 +937,13 @@ void MainWindow::addFolder(const QString &path, bool recursive, bool delayed, QS
|
|||||||
/*
|
/*
|
||||||
* Check for updates
|
* Check for updates
|
||||||
*/
|
*/
|
||||||
bool MainWindow::checkForUpdates(bool &haveNewVersion)
|
bool MainWindow::checkForUpdates(bool *const haveNewVersion)
|
||||||
{
|
{
|
||||||
haveNewVersion = false;
|
|
||||||
bool bReadyToInstall = false;
|
bool bReadyToInstall = false;
|
||||||
|
if (haveNewVersion)
|
||||||
|
{
|
||||||
|
*haveNewVersion = false;
|
||||||
|
}
|
||||||
|
|
||||||
UpdateDialog *updateDialog = new UpdateDialog(m_settings, this);
|
UpdateDialog *updateDialog = new UpdateDialog(m_settings, this);
|
||||||
updateDialog->exec();
|
updateDialog->exec();
|
||||||
@ -949,8 +952,11 @@ bool MainWindow::checkForUpdates(bool &haveNewVersion)
|
|||||||
{
|
{
|
||||||
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();
|
||||||
|
if (haveNewVersion)
|
||||||
|
{
|
||||||
|
*haveNewVersion = updateDialog->haveNewVersion();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MUTILS_DELETE(updateDialog);
|
MUTILS_DELETE(updateDialog);
|
||||||
@ -1226,7 +1232,7 @@ void MainWindow::changeEvent(QEvent *e)
|
|||||||
{
|
{
|
||||||
setWindowTitle(QString("%1 [!!! DEBUG BUILD !!!]").arg(windowTitle()));
|
setWindowTitle(QString("%1 [!!! DEBUG BUILD !!!]").arg(windowTitle()));
|
||||||
}
|
}
|
||||||
else if(lamexp_version_demo())
|
else if(lamexp_version_test())
|
||||||
{
|
{
|
||||||
setWindowTitle(QString("%1 [%2]").arg(windowTitle(), tr("DEMO VERSION")));
|
setWindowTitle(QString("%1 [%2]").arg(windowTitle(), tr("DEMO VERSION")));
|
||||||
}
|
}
|
||||||
@ -1472,7 +1478,7 @@ void MainWindow::windowShown(void)
|
|||||||
m_settings->licenseAccepted(1);
|
m_settings->licenseAccepted(1);
|
||||||
m_settings->syncNow();
|
m_settings->syncNow();
|
||||||
PLAY_SOUND_OPTIONAL("woohoo", false);
|
PLAY_SOUND_OPTIONAL("woohoo", false);
|
||||||
if (lamexp_version_demo())
|
if (lamexp_version_test())
|
||||||
{
|
{
|
||||||
showAnnounceBox();
|
showAnnounceBox();
|
||||||
}
|
}
|
||||||
@ -1511,7 +1517,7 @@ void MainWindow::windowShown(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Check for expiration
|
//Check for expiration
|
||||||
if(lamexp_version_demo())
|
if(lamexp_version_test())
|
||||||
{
|
{
|
||||||
if(MUtils::OS::current_date() >= lamexp_version_expires())
|
if(MUtils::OS::current_date() >= lamexp_version_expires())
|
||||||
{
|
{
|
||||||
@ -1520,7 +1526,7 @@ void MainWindow::windowShown(void)
|
|||||||
bool haveNewVersion = true;
|
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)
|
||||||
{
|
{
|
||||||
if (checkForUpdates(haveNewVersion))
|
if (checkForUpdates(&haveNewVersion))
|
||||||
{
|
{
|
||||||
QApplication::quit();
|
QApplication::quit();
|
||||||
return;
|
return;
|
||||||
@ -1548,7 +1554,7 @@ void MainWindow::windowShown(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Update reminder
|
//Update reminder
|
||||||
if(MUtils::OS::current_date() >= MUtils::Version::app_build_date().addYears(1))
|
if(MUtils::OS::current_date() >= MUtils::Version::app_build_date().addYears(1).addMonths(3))
|
||||||
{
|
{
|
||||||
qWarning("Binary is more than a year old, time to update!");
|
qWarning("Binary is more than a year old, time to update!");
|
||||||
SHOW_CORNER_WIDGET(true);
|
SHOW_CORNER_WIDGET(true);
|
||||||
@ -1556,8 +1562,7 @@ void MainWindow::windowShown(void)
|
|||||||
switch(ret)
|
switch(ret)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
bool haveNewVersion;
|
if(checkForUpdates())
|
||||||
if(checkForUpdates(haveNewVersion))
|
|
||||||
{
|
{
|
||||||
QApplication::quit();
|
QApplication::quit();
|
||||||
return;
|
return;
|
||||||
@ -1583,8 +1588,7 @@ 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)
|
||||||
{
|
{
|
||||||
bool haveNewVersion;
|
if(checkForUpdates(NULL))
|
||||||
if(checkForUpdates(haveNewVersion))
|
|
||||||
{
|
{
|
||||||
QApplication::quit();
|
QApplication::quit();
|
||||||
return;
|
return;
|
||||||
@ -2278,8 +2282,7 @@ void MainWindow::checkForBetaUpdatesActionTriggered(bool checked)
|
|||||||
|
|
||||||
if(checkUpdatesNow)
|
if(checkUpdatesNow)
|
||||||
{
|
{
|
||||||
bool haveNewVersion;
|
if(checkForUpdates())
|
||||||
if(checkForUpdates(haveNewVersion))
|
|
||||||
{
|
{
|
||||||
QApplication::quit();
|
QApplication::quit();
|
||||||
}
|
}
|
||||||
@ -2382,8 +2385,7 @@ void MainWindow::checkUpdatesActionActivated(void)
|
|||||||
ABORT_IF_BUSY;
|
ABORT_IF_BUSY;
|
||||||
WidgetHideHelper hiderHelper(m_dropBox.data());
|
WidgetHideHelper hiderHelper(m_dropBox.data());
|
||||||
|
|
||||||
bool haveNewVersion;
|
if(checkForUpdates())
|
||||||
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 MainWindow::checkForUpdates(bool &haveNewVersion);
|
bool MainWindow::checkForUpdates(bool *const haveNewVersion = NULL);
|
||||||
void initializeTranslation(void);
|
void initializeTranslation(void);
|
||||||
void refreshFavorites(void);
|
void refreshFavorites(void);
|
||||||
void openDocumentLink(QAction *const action);
|
void openDocumentLink(QAction *const action);
|
||||||
|
@ -77,7 +77,7 @@ UpdateDialog::UpdateDialog(const SettingsModel *const settings, QWidget *parent)
|
|||||||
m_taskbar(new MUtils::Taskbar7(parent)),
|
m_taskbar(new MUtils::Taskbar7(parent)),
|
||||||
m_settings(settings),
|
m_settings(settings),
|
||||||
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_test()) : lamexp_version_test()),
|
||||||
m_success(false),
|
m_success(false),
|
||||||
m_haveNewVersion(false),
|
m_haveNewVersion(false),
|
||||||
m_firstShow(true),
|
m_firstShow(true),
|
||||||
|
@ -57,7 +57,7 @@ unsigned int lamexp_version_build (void);
|
|||||||
unsigned int lamexp_version_confg (void);
|
unsigned int lamexp_version_confg (void);
|
||||||
const char* lamexp_version_release (void);
|
const char* lamexp_version_release (void);
|
||||||
bool lamexp_version_portable (void);
|
bool lamexp_version_portable (void);
|
||||||
bool lamexp_version_demo (void);
|
bool lamexp_version_test (void);
|
||||||
const QDate& lamexp_version_expires (void);
|
const QDate& lamexp_version_expires (void);
|
||||||
unsigned int lamexp_toolver_neroaac (void);
|
unsigned int lamexp_toolver_neroaac (void);
|
||||||
unsigned int lamexp_toolver_fhgaacenc(void);
|
unsigned int lamexp_toolver_fhgaacenc(void);
|
||||||
|
@ -97,9 +97,9 @@ const char *lamexp_support_url(void) { return g_lamexp_support_url; }
|
|||||||
const char *lamexp_tracker_url(void) { return g_lamexp_tracker_url; }
|
const char *lamexp_tracker_url(void) { return g_lamexp_tracker_url; }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for Demo (pre-release) version
|
* Check for test (pre-release) version
|
||||||
*/
|
*/
|
||||||
bool lamexp_version_demo(void)
|
bool lamexp_version_test(void)
|
||||||
{
|
{
|
||||||
QReadLocker readLock(&g_lamexp_version_lock);
|
QReadLocker readLock(&g_lamexp_version_lock);
|
||||||
|
|
||||||
|
@ -237,14 +237,14 @@ static int lamexp_main(int &argc, char **argv)
|
|||||||
lamexp_initialize_resources();
|
lamexp_initialize_resources();
|
||||||
|
|
||||||
//Check for expiration
|
//Check for expiration
|
||||||
if(lamexp_version_demo())
|
if(lamexp_version_test())
|
||||||
{
|
{
|
||||||
const QDate currentDate = MUtils::OS::current_date();
|
const QDate currentDate = MUtils::OS::current_date();
|
||||||
if(currentDate.addDays(1) < MUtils::Version::app_build_date())
|
if(currentDate.addDays(1) < MUtils::Version::app_build_date())
|
||||||
{
|
{
|
||||||
qFatal("System's date (%s) is before LameXP build date (%s). Huh?", currentDate.toString(Qt::ISODate).toLatin1().constData(), MUtils::Version::app_build_date().toString(Qt::ISODate).toLatin1().constData());
|
qFatal("System's date (%s) is before LameXP build date (%s). Huh?", currentDate.toString(Qt::ISODate).toLatin1().constData(), MUtils::Version::app_build_date().toString(Qt::ISODate).toLatin1().constData());
|
||||||
}
|
}
|
||||||
qWarning(QString("Note: This demo (pre-release) version of LameXP will expire at %1.\n").arg(lamexp_version_expires().toString(Qt::ISODate)).toLatin1().constData());
|
qWarning(QString("Note: This test (pre-release) version of LameXP will expire at %1.\n").arg(lamexp_version_expires().toString(Qt::ISODate)).toLatin1().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Initialize IPC
|
//Initialize IPC
|
||||||
@ -291,5 +291,5 @@ static int lamexp_main(int &argc, char **argv)
|
|||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
return MUtils::Startup::startup(argc, argv, lamexp_main, "LameXP", lamexp_version_demo());
|
return MUtils::Startup::startup(argc, argv, lamexp_main, "LameXP", lamexp_version_test());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user