Ref T42, application classes

* GUI classes allow retry
* longer timeouts
* accept unknow accessibility (QAM)
* QAM now as pointer, which would allow to replace QAM

When QAM becomes disconnected, then connect again it is in unknown state
This commit is contained in:
Klaus Basan
2017-04-28 02:42:50 +02:00
committed by Mathew Sutcliffe
parent 212bb6b485
commit 74e0bf397f
5 changed files with 90 additions and 66 deletions

View File

@@ -259,39 +259,27 @@ namespace BlackGui
return html;
}
void CGuiApplication::cmdLineErrorMessage(const QString &errorMessage) const
bool CGuiApplication::cmdLineErrorMessage(const QString &errorMessage, bool retry) const
{
if (CBuildConfig::isRunningOnWindowsNtPlatform())
{
const QString helpText(beautifyHelpMessage(this->m_parser.helpText()));
QMessageBox::warning(nullptr,
QGuiApplication::applicationDisplayName(),
"<html><head/><body><h2>" + errorMessage + "</h2><br>" + helpText + "</body></html>");
}
else
{
CApplication::cmdLineErrorMessage(errorMessage);
}
const QString helpText(beautifyHelpMessage(this->m_parser.helpText()));
const int r = QMessageBox::warning(nullptr,
QGuiApplication::applicationDisplayName(),
"<html><head/><body><h2>" + errorMessage + "</h2><br>" + helpText + "</body></html>", QMessageBox::Abort, retry ? QMessageBox::Retry : QMessageBox::NoButton);
return (r == QMessageBox::Retry);
}
void CGuiApplication::cmdLineErrorMessage(const CStatusMessageList &msgs) const
bool CGuiApplication::cmdLineErrorMessage(const CStatusMessageList &msgs, bool retry) const
{
if (msgs.isEmpty()) { return; }
if (!msgs.hasErrorMessages()) { return; }
if (CBuildConfig::isRunningOnWindowsNtPlatform())
{
static const CPropertyIndexList propertiesSingle({ CStatusMessage::IndexMessage });
static const CPropertyIndexList propertiesMulti({ CStatusMessage::IndexSeverityAsString, CStatusMessage::IndexMessage });
const QString helpText(CGuiApplication::beautifyHelpMessage(this->m_parser.helpText()));
const QString msgsHtml = msgs.toHtml(msgs.size() > 1 ? propertiesMulti : propertiesSingle);
QMessageBox::critical(nullptr,
QGuiApplication::applicationDisplayName(),
"<html><head/><body>" + msgsHtml + "<br><br>" + helpText + "</body></html>");
}
else
{
CApplication::cmdLineErrorMessage(msgs);
}
if (msgs.isEmpty()) { return false; }
if (!msgs.hasErrorMessages()) { return false; }
static const CPropertyIndexList propertiesSingle({ CStatusMessage::IndexMessage });
static const CPropertyIndexList propertiesMulti({ CStatusMessage::IndexSeverityAsString, CStatusMessage::IndexMessage });
const QString helpText(CGuiApplication::beautifyHelpMessage(this->m_parser.helpText()));
const QString msgsHtml = msgs.toHtml(msgs.size() > 1 ? propertiesMulti : propertiesSingle);
const int r = QMessageBox::critical(nullptr,
QGuiApplication::applicationDisplayName(),
"<html><head/><body>" + msgsHtml + "<br><br>" + helpText + "</body></html>", QMessageBox::Abort, retry ? QMessageBox::Retry : QMessageBox::NoButton);
return (r == QMessageBox::Retry);
}
bool CGuiApplication::displayInStatusBar(const CStatusMessage &message)

View File

@@ -111,8 +111,8 @@ namespace BlackGui
//! \name print messages generated during parsing / cmd handling
//! @{
virtual void cmdLineErrorMessage(const QString &cmdLineErrorMessage) const override;
virtual void cmdLineErrorMessage(const BlackMisc::CStatusMessageList &msgs) const override;
virtual bool cmdLineErrorMessage(const QString &cmdLineErrorMessage, bool retry = false) const override;
virtual bool cmdLineErrorMessage(const BlackMisc::CStatusMessageList &msgs, bool retry = false) const override;
//! @}
//! \name direct access to main application window