mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 15:45:42 +08:00
refs #846, allow to display cmdLineErrorMessage by BlackMisc::CStatusMessageList
Improved formatting and HTL escape message
This commit is contained in:
committed by
Mathew Sutcliffe
parent
62f2593486
commit
d6235d901e
@@ -226,7 +226,7 @@ namespace BlackGui
|
||||
}
|
||||
if (!tableMode)
|
||||
{
|
||||
html += l;
|
||||
html += l.toHtmlEscaped();
|
||||
html += "<br>";
|
||||
}
|
||||
else
|
||||
@@ -246,7 +246,7 @@ namespace BlackGui
|
||||
else
|
||||
{
|
||||
html += " ";
|
||||
html += l.simplified();
|
||||
html += l.simplified().toHtmlEscaped();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -261,7 +261,7 @@ namespace BlackGui
|
||||
const QString helpText(beautifyHelpMessage(this->m_parser.helpText()));
|
||||
QMessageBox::warning(nullptr,
|
||||
QGuiApplication::applicationDisplayName(),
|
||||
"<html><head/><body><h2>" + errorMessage + "</h2>" + helpText + "</body></html>");
|
||||
"<html><head/><body><h2>" + errorMessage + "</h2><br>" + helpText + "</body></html>");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -269,6 +269,26 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CGuiApplication::cmdLineErrorMessage(const CStatusMessageList &msgs) 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(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);
|
||||
}
|
||||
}
|
||||
|
||||
bool CGuiApplication::displayInStatusBar(const CStatusMessage &message)
|
||||
{
|
||||
IMainWindowAccess *m = mainWindowAccess();
|
||||
|
||||
@@ -105,6 +105,7 @@ 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;
|
||||
//! @}
|
||||
|
||||
//! \name direct access to main application window
|
||||
|
||||
Reference in New Issue
Block a user