mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +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
@@ -590,26 +590,27 @@ namespace BlackGui
|
||||
return "1.0";
|
||||
}
|
||||
|
||||
bool CGuiApplication::cmdLineErrorMessage(const QString &errorMessage, bool retry) const
|
||||
bool CGuiApplication::cmdLineWarningMessage(const QString &text, const QString &informativeText) const
|
||||
{
|
||||
const QString helpText(beautifyHelpMessage(m_parser.helpText()));
|
||||
constexpr int MaxLength = 60;
|
||||
QMessageBox warningBox(QMessageBox::Warning, QGuiApplication::applicationDisplayName(), "<b>" +text + "</b>");
|
||||
warningBox.setInformativeText(informativeText);
|
||||
return warningBox.exec();
|
||||
}
|
||||
|
||||
QString htmlMsg;
|
||||
if (errorMessage.length() > MaxLength)
|
||||
{
|
||||
htmlMsg = "<html><head/><body><h4>" + errorMessage.left(MaxLength) + "..." + "</h4>" +
|
||||
"Details: " + errorMessage + "<br><br>";
|
||||
}
|
||||
bool CGuiApplication::cmdLineErrorMessage(const QString &text, const QString &informativeText, bool retry) const
|
||||
{
|
||||
QMessageBox errorBox(QMessageBox::Critical, QGuiApplication::applicationDisplayName(), "<b>" +text + "</b>");
|
||||
if(informativeText.length() < 300)
|
||||
errorBox.setInformativeText(informativeText);
|
||||
else
|
||||
{
|
||||
htmlMsg = "<html><head/><body><h4>" + errorMessage + "</h4>";
|
||||
}
|
||||
htmlMsg += helpText + "</body></html>";
|
||||
errorBox.setDetailedText(informativeText);
|
||||
|
||||
errorBox.addButton(QMessageBox::Abort);
|
||||
if(retry)
|
||||
errorBox.addButton(QMessageBox::Retry);
|
||||
|
||||
const int r = errorBox.exec();
|
||||
|
||||
const int r = QMessageBox::warning(nullptr,
|
||||
QGuiApplication::applicationDisplayName(),
|
||||
htmlMsg, QMessageBox::Abort, retry ? QMessageBox::Retry : QMessageBox::NoButton);
|
||||
return (r == QMessageBox::Retry);
|
||||
}
|
||||
|
||||
@@ -619,11 +620,10 @@ namespace BlackGui
|
||||
if (!msgs.hasErrorMessages()) { return false; }
|
||||
static const CPropertyIndexList propertiesSingle({ CStatusMessage::IndexMessage });
|
||||
static const CPropertyIndexList propertiesMulti({ CStatusMessage::IndexSeverityAsString, CStatusMessage::IndexMessage });
|
||||
const QString helpText(CGuiApplication::beautifyHelpMessage(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);
|
||||
"<html><head><body>" + msgsHtml + "</body></html>", QMessageBox::Abort, retry ? QMessageBox::Retry : QMessageBox::NoButton);
|
||||
return (r == QMessageBox::Retry);
|
||||
}
|
||||
|
||||
|
||||
@@ -125,9 +125,14 @@ namespace BlackGui
|
||||
//! Set window title
|
||||
QString setExtraWindowTitle(const QString &extraInfo, QWidget *mainWindowWidget = mainApplicationWidget()) const;
|
||||
|
||||
//! \name print warning message
|
||||
//! @{
|
||||
virtual bool cmdLineWarningMessage(const QString &text, const QString &informativeText) const override;
|
||||
//! @}
|
||||
|
||||
//! \name print messages generated during parsing / cmd handling
|
||||
//! @{
|
||||
virtual bool cmdLineErrorMessage(const QString &cmdLineErrorMessage, bool retry = false) const override;
|
||||
virtual bool cmdLineErrorMessage(const QString &text, const QString &informativeText = "", bool retry = false) const override;
|
||||
virtual bool cmdLineErrorMessage(const BlackMisc::CStatusMessageList &msgs, bool retry = false) const override;
|
||||
//! @}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user