mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
Add warning about expire and redesign warning/error popup
Fixes Github Issue #38
This commit is contained in:
committed by
Mat Sutcliffe
parent
189bb15936
commit
1d4aa96e9b
@@ -1404,14 +1404,21 @@ namespace BlackCore
|
||||
// checks
|
||||
if (CBuildConfig::isLifetimeExpired())
|
||||
{
|
||||
this->cmdLineErrorMessage("Program expired " + CBuildConfig::getEol().toString());
|
||||
this->cmdLineErrorMessage("Program expired since " + CBuildConfig::getEol().date().toString(),
|
||||
"This version is no longer supported and usable. You have to install a newer version.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(CBuildConfig::daysTillLifetimeExpiry() <= 30)
|
||||
{
|
||||
this->cmdLineWarningMessage("This version will expire in " + QString::number(CBuildConfig::daysTillLifetimeExpiry()) + " days!",
|
||||
"You'll need to update swift in order to use it thereafter.");
|
||||
}
|
||||
|
||||
const QStringList verifyErrors = CDirectoryUtils::verifyRuntimeDirectoriesAndFiles();
|
||||
if (!verifyErrors.isEmpty() && !m_applicationInfo.isUnitTest())
|
||||
{
|
||||
this->cmdLineErrorMessage("Missing runtime directories/files: " + verifyErrors.join(", "));
|
||||
this->cmdLineErrorMessage("Missing runtime directories/files:", verifyErrors.join(", "));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1419,13 +1426,13 @@ namespace BlackCore
|
||||
const QStringList args(QCoreApplication::instance()->arguments());
|
||||
if (!m_parser.parse(args))
|
||||
{
|
||||
this->cmdLineErrorMessage(m_parser.errorText());
|
||||
this->cmdLineErrorMessage("Parser error:", m_parser.errorText());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_singleApplication && m_alreadyRunning && !this->skipSingleApplicationCheck())
|
||||
{
|
||||
this->cmdLineErrorMessage("Program must only run once");
|
||||
this->cmdLineErrorMessage("Program must only run once", "You cannot run two or more instances side-by-side.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1461,12 +1468,16 @@ namespace BlackCore
|
||||
return !this->synchronizeSetup(timeoutMs).hasErrorMessages();
|
||||
}
|
||||
|
||||
bool CApplication::cmdLineErrorMessage(const QString &errorMessage, bool retry) const
|
||||
bool CApplication::cmdLineWarningMessage(const QString &text, const QString &informativeText) const
|
||||
{
|
||||
fputs(qPrintable(text + informativeText), stderr);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CApplication::cmdLineErrorMessage(const QString &text, const QString &informativeText, bool retry) const
|
||||
{
|
||||
Q_UNUSED(retry) // only works with UI version
|
||||
fputs(qPrintable(errorMessage), stderr);
|
||||
fputs("\n\n", stderr);
|
||||
fputs(qPrintable(m_parser.helpText()), stderr);
|
||||
fputs(qPrintable(text + informativeText), stderr);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -299,8 +299,11 @@ namespace BlackCore
|
||||
//! \see synchronizeSetup
|
||||
virtual bool parseAndSynchronizeSetup(int timeoutMs = BlackMisc::Network::CNetworkUtils::getLongTimeoutMs());
|
||||
|
||||
//! Display warning message
|
||||
virtual bool cmdLineWarningMessage(const QString &text, const QString &informativeText = "") const;
|
||||
|
||||
//! Display error message
|
||||
virtual bool cmdLineErrorMessage(const QString &cmdLineErrorMessage, bool retry = false) const;
|
||||
virtual bool cmdLineErrorMessage(const QString &text, const QString &informativeText = "", bool retry = false) const;
|
||||
|
||||
//! Display error message
|
||||
virtual bool cmdLineErrorMessage(const BlackMisc::CStatusMessageList &msgs, bool retry = false) const;
|
||||
|
||||
@@ -184,7 +184,7 @@ namespace BlackCore
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
retry = sApp->cmdLineErrorMessage(QStringLiteral("URL '%1' not reachable").arg(urlString), true);
|
||||
retry = sApp->cmdLineErrorMessage(QStringLiteral("URL '%1' not reachable").arg(urlString), "", true);
|
||||
}
|
||||
while (retry);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user