From 46131d3cb9a6cb1c13fc495966ffeaea57be45a0 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 20 Feb 2020 19:35:49 +0200 Subject: [PATCH] Improve pattern messages. Include cases when impossible to prepare data for layout. --- src/app/valentina/core/vapplication.cpp | 4 ++++ src/libs/vlayout/vbank.cpp | 11 +++++++---- src/libs/vlayout/vbank.h | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/app/valentina/core/vapplication.cpp b/src/app/valentina/core/vapplication.cpp index 6b31f0724..493a5392e 100644 --- a/src/app/valentina/core/vapplication.cpp +++ b/src/app/valentina/core/vapplication.cpp @@ -172,6 +172,10 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con vStdErr() << QApplication::translate("vNoisyHandler", "WARNING:") << logMsg << "\n"; break; case QtCriticalMsg: + if (isPatternMessage) + { + qApp->PostPatternMessage(logMsg, type); + } debugdate += QStringLiteral(":CRITICAL:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line) .arg(context.function, context.category, logMsg); vStdErr() << QApplication::translate("vNoisyHandler", "CRITICAL:") << logMsg << "\n"; diff --git a/src/libs/vlayout/vbank.cpp b/src/libs/vlayout/vbank.cpp index 32a72881c..26d8ddd3c 100644 --- a/src/libs/vlayout/vbank.cpp +++ b/src/libs/vlayout/vbank.cpp @@ -334,8 +334,9 @@ bool VBank::PrepareUnsorted() const qint64 square = details.at(i).Square(); if (square <= 0) { - qCCritical(lBank, "Preparing data for layout error: Detail '%s' square <= 0", - qUtf8Printable(details.at(i).GetName())); + qCCritical(lBank) << VAbstractApplication::patternMessageSignature + + tr("Preparing data for layout error: Detail '%1' square <= 0") + .arg(details.at(i).GetName()); prepare = false; return prepare; } @@ -358,14 +359,16 @@ bool VBank::PrepareDetails() { if (layoutWidth <= 0) { - qCCritical(lBank, "Preparing data for layout error: Layout paper sheet <= 0"); + qCCritical(lBank) << VAbstractApplication::patternMessageSignature + + tr("Preparing data for layout error: Layout paper sheet <= 0"); prepare = false; return prepare; } if (details.isEmpty()) { - qCCritical(lBank, "Preparing data for layout error: List of details is empty"); + qCCritical(lBank) << VAbstractApplication::patternMessageSignature + + tr("Preparing data for layout error: List of details is empty"); prepare = false; return prepare; } diff --git a/src/libs/vlayout/vbank.h b/src/libs/vlayout/vbank.h index 7dd5a6c41..37b821e72 100644 --- a/src/libs/vlayout/vbank.h +++ b/src/libs/vlayout/vbank.h @@ -53,6 +53,7 @@ enum class Cases : qint8 { CaseThreeGroup = 0, CaseTwoGroup, CaseDesc, UnknownCa class VBank { + Q_DECLARE_TR_FUNCTIONS(VBank) public: VBank();