mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 12:55:31 +08:00
refs #485, renamed to cmdLineErrorMessage (to distinguish from status messages)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
76814b43be
commit
c411f07551
@@ -110,7 +110,7 @@ namespace BlackCore
|
|||||||
CStatusMessage m(this->requestReloadOfSetupAndVersion());
|
CStatusMessage m(this->requestReloadOfSetupAndVersion());
|
||||||
if (m.isWarningOrAbove())
|
if (m.isWarningOrAbove())
|
||||||
{
|
{
|
||||||
this->errorMessage(m.getMessage());
|
this->cmdLineErrorMessage(m.getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -384,7 +384,7 @@ namespace BlackCore
|
|||||||
void CApplication::severeStartupProblem(const CStatusMessage &message)
|
void CApplication::severeStartupProblem(const CStatusMessage &message)
|
||||||
{
|
{
|
||||||
CLogMessage(this).preformatted(message);
|
CLogMessage(this).preformatted(message);
|
||||||
this->errorMessage(message.getMessage());
|
this->cmdLineErrorMessage(message.getMessage());
|
||||||
this->exit(EXIT_FAILURE);
|
this->exit(EXIT_FAILURE);
|
||||||
|
|
||||||
// if I get here the event loop was not yet running
|
// if I get here the event loop was not yet running
|
||||||
@@ -467,7 +467,7 @@ namespace BlackCore
|
|||||||
QStringList args(QCoreApplication::instance()->arguments());
|
QStringList args(QCoreApplication::instance()->arguments());
|
||||||
if (!this->m_parser.parse(args))
|
if (!this->m_parser.parse(args))
|
||||||
{
|
{
|
||||||
this->errorMessage(this->m_parser.errorText());
|
this->cmdLineErrorMessage(this->m_parser.errorText());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,12 +475,12 @@ namespace BlackCore
|
|||||||
if (this->m_parser.isSet(this->m_cmdHelp))
|
if (this->m_parser.isSet(this->m_cmdHelp))
|
||||||
{
|
{
|
||||||
// Important parser help will already stop application
|
// Important parser help will already stop application
|
||||||
this->helpMessage();
|
this->cmdLineHelpMessage();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (this->m_parser.isSet(this->m_cmdVersion))
|
if (this->m_parser.isSet(this->m_cmdVersion))
|
||||||
{
|
{
|
||||||
this->versionMessage();
|
this->cmdLineVersionMessage();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,20 +493,20 @@ namespace BlackCore
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CApplication::errorMessage(const QString &errorMessage) const
|
void CApplication::cmdLineErrorMessage(const QString &errorMessage) const
|
||||||
{
|
{
|
||||||
fputs(qPrintable(errorMessage), stderr);
|
fputs(qPrintable(errorMessage), stderr);
|
||||||
fputs("\n\n", stderr);
|
fputs("\n\n", stderr);
|
||||||
fputs(qPrintable(this->m_parser.helpText()), stderr);
|
fputs(qPrintable(this->m_parser.helpText()), stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CApplication::helpMessage()
|
void CApplication::cmdLineHelpMessage()
|
||||||
{
|
{
|
||||||
this->m_parser.showHelp(); // terminates
|
this->m_parser.showHelp(); // terminates
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CApplication::versionMessage() const
|
void CApplication::cmdLineVersionMessage() const
|
||||||
{
|
{
|
||||||
printf("%s %s\n", qPrintable(QCoreApplication::applicationName()), qPrintable(QCoreApplication::applicationVersion()));
|
printf("%s %s\n", qPrintable(QCoreApplication::applicationName()), qPrintable(QCoreApplication::applicationVersion()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ namespace BlackCore
|
|||||||
QString getParserOptionValue(const QCommandLineOption &option) const;
|
QString getParserOptionValue(const QCommandLineOption &option) const;
|
||||||
|
|
||||||
//! Display parser error message
|
//! Display parser error message
|
||||||
virtual void errorMessage(const QString &errorMessage) const;
|
virtual void cmdLineErrorMessage(const QString &cmdLineErrorMessage) const;
|
||||||
|
|
||||||
//! Parses and handles the standard options such as help, version, parse error
|
//! Parses and handles the standard options such as help, version, parse error
|
||||||
//! \note in some cases (error, version, help) application is terminated during this step
|
//! \note in some cases (error, version, help) application is terminated during this step
|
||||||
@@ -213,10 +213,10 @@ namespace BlackCore
|
|||||||
CApplication(const QString &applicationName, QCoreApplication *app);
|
CApplication(const QString &applicationName, QCoreApplication *app);
|
||||||
|
|
||||||
//! Display help message
|
//! Display help message
|
||||||
virtual void helpMessage();
|
virtual void cmdLineHelpMessage();
|
||||||
|
|
||||||
//! Display version message
|
//! Display version message
|
||||||
virtual void versionMessage() const;
|
virtual void cmdLineVersionMessage() const;
|
||||||
|
|
||||||
//! Can be used to parse specialized arguments
|
//! Can be used to parse specialized arguments
|
||||||
virtual bool parsingHookIn() { return true; }
|
virtual bool parsingHookIn() { return true; }
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ namespace BlackCore
|
|||||||
QFile f(this->m_localSetupFileValue);
|
QFile f(this->m_localSetupFileValue);
|
||||||
if (!f.exists())
|
if (!f.exists())
|
||||||
{
|
{
|
||||||
sApp->errorMessage("File " + this->m_localSetupFileValue + " does not exist");
|
sApp->cmdLineErrorMessage("File " + this->m_localSetupFileValue + " does not exist");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ namespace BlackCore
|
|||||||
{
|
{
|
||||||
if (!CNetworkUtils::canConnect(url))
|
if (!CNetworkUtils::canConnect(url))
|
||||||
{
|
{
|
||||||
sApp->errorMessage("URL " + url.toString() + " not reachable");
|
sApp->cmdLineErrorMessage("URL " + url.toString() + " not reachable");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
if (msgs.hasErrorMessages())
|
if (msgs.hasErrorMessages())
|
||||||
{
|
{
|
||||||
this->showMessages(msgs);
|
this->showOverlayMessages(msgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,7 +379,7 @@ namespace BlackGui
|
|||||||
// errors if any
|
// errors if any
|
||||||
if (msgs.hasErrorMessages())
|
if (msgs.hasErrorMessages())
|
||||||
{
|
{
|
||||||
this->showMessages(msgs);
|
this->showOverlayMessages(msgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -594,7 +594,7 @@ namespace BlackGui
|
|||||||
);
|
);
|
||||||
if (msgs.hasWarningOrErrorMessages())
|
if (msgs.hasWarningOrErrorMessages())
|
||||||
{
|
{
|
||||||
this->showMessages(msgs);
|
this->showOverlayMessages(msgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ namespace BlackGui
|
|||||||
CApplication::exit(retcode);
|
CApplication::exit(retcode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGuiApplication::errorMessage(const QString &errorMessage) const
|
void CGuiApplication::cmdLineErrorMessage(const QString &errorMessage) const
|
||||||
{
|
{
|
||||||
if (CProject::isRunningOnWindowsNtPlatform())
|
if (CProject::isRunningOnWindowsNtPlatform())
|
||||||
{
|
{
|
||||||
@@ -99,11 +99,11 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CApplication::errorMessage(errorMessage);
|
CApplication::cmdLineErrorMessage(errorMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGuiApplication::helpMessage()
|
void CGuiApplication::cmdLineHelpMessage()
|
||||||
{
|
{
|
||||||
if (CProject::isRunningOnWindowsNtPlatform())
|
if (CProject::isRunningOnWindowsNtPlatform())
|
||||||
{
|
{
|
||||||
@@ -113,11 +113,11 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CApplication::helpMessage();
|
CApplication::cmdLineHelpMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGuiApplication::versionMessage() const
|
void CGuiApplication::cmdLineVersionMessage() const
|
||||||
{
|
{
|
||||||
if (CProject::isRunningOnWindowsNtPlatform())
|
if (CProject::isRunningOnWindowsNtPlatform())
|
||||||
{
|
{
|
||||||
@@ -127,7 +127,7 @@ namespace BlackGui
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CApplication::versionMessage();
|
CApplication::cmdLineVersionMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,10 @@ namespace BlackGui
|
|||||||
//! Init the main application window based on information in this application
|
//! Init the main application window based on information in this application
|
||||||
void initMainApplicationWindow(QWidget *mainWindow) const;
|
void initMainApplicationWindow(QWidget *mainWindow) const;
|
||||||
|
|
||||||
//! \copydoc BlackCore::CApplication::errorMessage
|
//! \name print messages generated during parsing / cmd handling
|
||||||
virtual void errorMessage(const QString &errorMessage) const override;
|
//! @{
|
||||||
|
virtual void cmdLineErrorMessage(const QString &cmdLineErrorMessage) const override;
|
||||||
|
//! @}
|
||||||
|
|
||||||
//! Set icon
|
//! Set icon
|
||||||
//! \note Pixmap requires a valid QApplication, so it cannot be passed as constructor parameter
|
//! \note Pixmap requires a valid QApplication, so it cannot be passed as constructor parameter
|
||||||
@@ -65,10 +67,10 @@ namespace BlackGui
|
|||||||
static void exit(int retcode = 0);
|
static void exit(int retcode = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! \name print messages generated during parsing
|
//! \name print messages generated during parsing / cmd handling
|
||||||
//! @{
|
//! @{
|
||||||
virtual void helpMessage() override;
|
virtual void cmdLineHelpMessage() override;
|
||||||
virtual void versionMessage() const override;
|
virtual void cmdLineVersionMessage() const override;
|
||||||
//! @}
|
//! @}
|
||||||
|
|
||||||
//! Handle paring of special GUI cmd arguments
|
//! Handle paring of special GUI cmd arguments
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (!QSystemTrayIcon::isSystemTrayAvailable())
|
if (!QSystemTrayIcon::isSystemTrayAvailable())
|
||||||
{
|
{
|
||||||
a.errorMessage("I could not detect any system tray on this system.");
|
a.cmdLineErrorMessage("I could not detect any system tray on this system.");
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ bool CSwiftGuiStdApplication::parsingHookIn()
|
|||||||
// check if rechable
|
// check if rechable
|
||||||
if (!CDBusServer::isDBusAvailable(dBusAddress))
|
if (!CDBusServer::isDBusAvailable(dBusAddress))
|
||||||
{
|
{
|
||||||
this->errorMessage("DBus server at " + dBusAddress + " can not be reached");
|
this->cmdLineErrorMessage("DBus server at " + dBusAddress + " can not be reached");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user