Improve pattern messages.

Include cases when impossible to prepare data for layout.
This commit is contained in:
Roman Telezhynskyi 2020-02-20 19:35:49 +02:00
parent 6d1b7a9212
commit 46131d3cb9
3 changed files with 12 additions and 4 deletions

View File

@ -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";

View File

@ -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;
}

View File

@ -53,6 +53,7 @@ enum class Cases : qint8 { CaseThreeGroup = 0, CaseTwoGroup, CaseDesc, UnknownCa
class VBank
{
Q_DECLARE_TR_FUNCTIONS(VBank)
public:
VBank();