Added new function VAbstractApplication::ClearMessage.
It will help clear messages from unneeded '"' at the start and at the end. qWarning and others adds them. --HG-- branch : develop
This commit is contained in:
parent
270f3b44a1
commit
81caed8f5f
|
@ -199,7 +199,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
{
|
{
|
||||||
if (topWinAllowsPop)
|
if (topWinAllowsPop)
|
||||||
{
|
{
|
||||||
messageBox.setText(msg);
|
messageBox.setText(VAbstractApplication::ClearMessage(msg));
|
||||||
messageBox.setStandardButtons(QMessageBox::Ok);
|
messageBox.setStandardButtons(QMessageBox::Ok);
|
||||||
messageBox.setWindowModality(Qt::ApplicationModal);
|
messageBox.setWindowModality(Qt::ApplicationModal);
|
||||||
messageBox.setModal(true);
|
messageBox.setModal(true);
|
||||||
|
|
|
@ -185,20 +185,20 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case QtWarningMsg:
|
case QtWarningMsg:
|
||||||
messageBox.setWindowTitle(QApplication::translate("vNoisyHandler", "Warning."));
|
messageBox.setWindowTitle(QApplication::translate("vNoisyHandler", "Warning"));
|
||||||
messageBox.setIcon(QMessageBox::Warning);
|
messageBox.setIcon(QMessageBox::Warning);
|
||||||
break;
|
break;
|
||||||
case QtCriticalMsg:
|
case QtCriticalMsg:
|
||||||
messageBox.setWindowTitle(QApplication::translate("vNoisyHandler", "Critical error."));
|
messageBox.setWindowTitle(QApplication::translate("vNoisyHandler", "Critical error"));
|
||||||
messageBox.setIcon(QMessageBox::Critical);
|
messageBox.setIcon(QMessageBox::Critical);
|
||||||
break;
|
break;
|
||||||
case QtFatalMsg:
|
case QtFatalMsg:
|
||||||
messageBox.setWindowTitle(QApplication::translate("vNoisyHandler", "Fatal error."));
|
messageBox.setWindowTitle(QApplication::translate("vNoisyHandler", "Fatal error"));
|
||||||
messageBox.setIcon(QMessageBox::Critical);
|
messageBox.setIcon(QMessageBox::Critical);
|
||||||
break;
|
break;
|
||||||
#if QT_VERSION > QT_VERSION_CHECK(5, 4, 2)
|
#if QT_VERSION > QT_VERSION_CHECK(5, 4, 2)
|
||||||
case QtInfoMsg:
|
case QtInfoMsg:
|
||||||
messageBox.setWindowTitle(QApplication::translate("vNoisyHandler", "Information."));
|
messageBox.setWindowTitle(QApplication::translate("vNoisyHandler", "Information"));
|
||||||
messageBox.setIcon(QMessageBox::Information);
|
messageBox.setIcon(QMessageBox::Information);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
@ -213,7 +213,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
{
|
{
|
||||||
if (topWinAllowsPop)
|
if (topWinAllowsPop)
|
||||||
{
|
{
|
||||||
messageBox.setText(msg);
|
messageBox.setText(VAbstractApplication::ClearMessage(msg));
|
||||||
messageBox.setStandardButtons(QMessageBox::Ok);
|
messageBox.setStandardButtons(QMessageBox::Ok);
|
||||||
messageBox.setWindowModality(Qt::ApplicationModal);
|
messageBox.setWindowModality(Qt::ApplicationModal);
|
||||||
messageBox.setModal(true);
|
messageBox.setModal(true);
|
||||||
|
|
|
@ -234,6 +234,23 @@ QUndoStack *VAbstractApplication::getUndoStack() const
|
||||||
return undoStack;
|
return undoStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* @brief ClearMessage helps to clear a message string from standard Qt function.
|
||||||
|
* @param msg the message that contains '"' at the start and at the end
|
||||||
|
* @return cleared string
|
||||||
|
*/
|
||||||
|
QString VAbstractApplication::ClearMessage(QString msg)
|
||||||
|
{
|
||||||
|
if (msg.startsWith('"') && msg.endsWith('"'))
|
||||||
|
{
|
||||||
|
msg.remove(0, 1);
|
||||||
|
msg.chop(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
void VAbstractApplication::WinAttachConsole()
|
void VAbstractApplication::WinAttachConsole()
|
||||||
|
|
|
@ -115,6 +115,8 @@ public:
|
||||||
static void WinAttachConsole();
|
static void WinAttachConsole();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static QString ClearMessage(QString msg);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QUndoStack *undoStack;
|
QUndoStack *undoStack;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user