Some code clean-up.

This commit is contained in:
LoRd_MuldeR 2017-12-06 02:13:00 +01:00
parent 25debe1d8e
commit 0012af66a7
2 changed files with 46 additions and 31 deletions

@ -35,7 +35,7 @@
#define VER_LAMEXP_MINOR_LO 6 #define VER_LAMEXP_MINOR_LO 6
#define VER_LAMEXP_TYPE Beta #define VER_LAMEXP_TYPE Beta
#define VER_LAMEXP_PATCH 1 #define VER_LAMEXP_PATCH 1
#define VER_LAMEXP_BUILD 2060 #define VER_LAMEXP_BUILD 2061
#define VER_LAMEXP_CONFG 2002 #define VER_LAMEXP_CONFG 2002
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

@ -1452,45 +1452,60 @@ void MainWindow::windowShown(void)
//First run? //First run?
const bool firstRun = arguments.contains("first-run"); const bool firstRun = arguments.contains("first-run");
if (firstRun)
{
m_settings->licenseAccepted(0);
m_settings->autoUpdateCheckBeta(false);
m_settings->syncNow();
}
//Check license //Check license
if((m_settings->licenseAccepted() <= 0) || firstRun) if (m_settings->licenseAccepted() <= 0)
{ {
int iAccepted = m_settings->licenseAccepted(); if (m_settings->licenseAccepted() == 0)
if((iAccepted == 0) || firstRun)
{ {
AboutDialog *about = new AboutDialog(m_settings, this, true); QScopedPointer<AboutDialog> about(new AboutDialog(m_settings, this, true));
iAccepted = about->exec(); if (about->exec() > 0)
if(iAccepted <= 0) iAccepted = -2;
MUTILS_DELETE(about);
}
if(iAccepted <= 0)
{
m_settings->licenseAccepted(++iAccepted);
m_settings->syncNow();
QApplication::processEvents();
MUtils::Sound::play_sound("whammy", false);
QMessageBox::critical(this, tr("License Declined"), tr("You have declined the license. Consequently the application will exit now!"), tr("Goodbye!"));
QFileInfo uninstallerInfo = QFileInfo(QString("%1/Uninstall.exe").arg(QApplication::applicationDirPath()));
if(uninstallerInfo.exists())
{ {
QString uninstallerDir = uninstallerInfo.canonicalPath(); m_settings->licenseAccepted(1);
QString uninstallerPath = uninstallerInfo.canonicalFilePath(); m_settings->syncNow();
for(int i = 0; i < 3; i++) MUtils::Sound::play_sound("woohoo", false);
if (lamexp_version_demo())
{ {
if(MUtils::OS::shell_open(this, QDir::toNativeSeparators(uninstallerPath), "/Force", QDir::toNativeSeparators(uninstallerDir))) break; showAnnounceBox();
} }
} }
QApplication::quit(); else
return; {
m_settings->licenseAccepted(-1);
m_settings->syncNow();
}
} }
else
MUtils::Sound::play_sound("woohoo", false); {
m_settings->licenseAccepted(1); m_settings->licenseAccepted(0);
m_settings->syncNow(); m_settings->syncNow();
if(lamexp_version_demo()) showAnnounceBox(); }
}
//License declined?
if(m_settings->licenseAccepted() <= 0)
{
QApplication::processEvents();
MUtils::Sound::play_sound("whammy", false);
QMessageBox::critical(this, tr("License Declined"), tr("You have declined the license. Consequently the application will exit now!"), tr("Goodbye!"));
QFileInfo uninstallerInfo = QFileInfo(QString("%1/Uninstall.exe").arg(QApplication::applicationDirPath()));
if(uninstallerInfo.exists())
{
QString uninstallerDir = uninstallerInfo.canonicalPath();
QString uninstallerPath = uninstallerInfo.canonicalFilePath();
for(int i = 0; i < 3; i++)
{
if(MUtils::OS::shell_open(this, QDir::toNativeSeparators(uninstallerPath), "/Force", QDir::toNativeSeparators(uninstallerDir))) break;
}
}
QApplication::quit();
return;
} }
//Check for expiration //Check for expiration