New feature Pattern Messages.
Added special field to show pattern warnings instead of warning dialogs. Fixed issue with tabified dockwidgets. --HG-- branch : develop
This commit is contained in:
parent
b7c1b4c4a6
commit
8f6ae65224
|
@ -32,6 +32,7 @@
|
||||||
- Added options to control passmark angle type and passmark mark type.
|
- Added options to control passmark angle type and passmark mark type.
|
||||||
- Improve for recent files list. Show duplicate file names with unique path section.
|
- Improve for recent files list. Show duplicate file names with unique path section.
|
||||||
- New command line option --cropWidth. Helps to crop unused width of paper.
|
- New command line option --cropWidth. Helps to crop unused width of paper.
|
||||||
|
- New feature Pattern Messages.
|
||||||
|
|
||||||
# Version 0.6.2 (unreleased)
|
# Version 0.6.2 (unreleased)
|
||||||
- [#903] Bug in tool Cut Spline path.
|
- [#903] Bug in tool Cut Spline path.
|
||||||
|
|
|
@ -145,36 +145,51 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
type = QtDebugMsg;
|
type = QtDebugMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString logMsg = msg;
|
||||||
|
const bool isPatternMessage = qApp->IsPatternMessage(msg);
|
||||||
|
if (isPatternMessage)
|
||||||
|
{
|
||||||
|
logMsg = logMsg.remove(VAbstractApplication::patternMessageSignature);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
QString debugdate = "[" + QDateTime::currentDateTime().toString(QStringLiteral("yyyy.MM.dd hh:mm:ss"));
|
QString debugdate = "[" + QDateTime::currentDateTime().toString(QStringLiteral("yyyy.MM.dd hh:mm:ss"));
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case QtDebugMsg:
|
case QtDebugMsg:
|
||||||
debugdate += QString(":DEBUG:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
debugdate += QStringLiteral(":DEBUG:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
||||||
.arg(context.function, context.category, msg);
|
.arg(context.function, context.category, logMsg);
|
||||||
vStdOut() << QApplication::translate("vNoisyHandler", "DEBUG:") << msg << "\n";
|
vStdOut() << QApplication::translate("vNoisyHandler", "DEBUG:") << logMsg << "\n";
|
||||||
break;
|
break;
|
||||||
case QtWarningMsg:
|
case QtWarningMsg:
|
||||||
debugdate += QString(":WARNING:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
if (isPatternMessage)
|
||||||
.arg(context.function, context.category, msg);
|
{
|
||||||
vStdErr() << QApplication::translate("vNoisyHandler", "WARNING:") << msg << "\n";
|
qApp->PostPatternMessage(logMsg, type);
|
||||||
|
}
|
||||||
|
debugdate += QStringLiteral(":WARNING:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
||||||
|
.arg(context.function, context.category, logMsg);
|
||||||
|
vStdErr() << QApplication::translate("vNoisyHandler", "WARNING:") << logMsg << "\n";
|
||||||
break;
|
break;
|
||||||
case QtCriticalMsg:
|
case QtCriticalMsg:
|
||||||
debugdate += QString(":CRITICAL:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
debugdate += QStringLiteral(":CRITICAL:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
||||||
.arg(context.function, context.category, msg);
|
.arg(context.function, context.category, logMsg);
|
||||||
vStdErr() << QApplication::translate("vNoisyHandler", "CRITICAL:") << msg << "\n";
|
vStdErr() << QApplication::translate("vNoisyHandler", "CRITICAL:") << logMsg << "\n";
|
||||||
break;
|
break;
|
||||||
case QtFatalMsg:
|
case QtFatalMsg:
|
||||||
debugdate += QString(":FATAL:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
debugdate += QStringLiteral(":FATAL:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
||||||
.arg(context.function, context.category, msg);
|
.arg(context.function, context.category, logMsg);
|
||||||
vStdErr() << QApplication::translate("vNoisyHandler", "FATAL:") << msg << "\n";
|
vStdErr() << QApplication::translate("vNoisyHandler", "FATAL:") << logMsg << "\n";
|
||||||
break;
|
break;
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
|
||||||
case QtInfoMsg:
|
case QtInfoMsg:
|
||||||
debugdate += QString(":INFO:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
if (isPatternMessage)
|
||||||
.arg(context.function, context.category, msg);
|
{
|
||||||
vStdOut() << QApplication::translate("vNoisyHandler", "INFO:") << msg << "\n";
|
qApp->PostPatternMessage(logMsg, type);
|
||||||
|
}
|
||||||
|
debugdate += QStringLiteral(":INFO:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
||||||
|
.arg(context.function, context.category, logMsg);
|
||||||
|
vStdOut() << QApplication::translate("vNoisyHandler", "INFO:") << logMsg << "\n";
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
|
@ -188,11 +203,17 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
|
|
||||||
if (isGuiThread)
|
if (isGuiThread)
|
||||||
{
|
{
|
||||||
//fixme: trying to make sure there are no save/load dialogs are opened, because error message during them will
|
if (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg)
|
||||||
//lead to crash
|
{
|
||||||
|
if (VApplication::IsGUIMode())
|
||||||
|
{
|
||||||
|
//fixme: trying to make sure there are no save/load dialogs are opened, because error message during
|
||||||
|
// them will lead to crash
|
||||||
const bool topWinAllowsPop = (QApplication::activeModalWidget() == nullptr) ||
|
const bool topWinAllowsPop = (QApplication::activeModalWidget() == nullptr) ||
|
||||||
!QApplication::activeModalWidget()->inherits("QFileDialog");
|
!QApplication::activeModalWidget()->inherits("QFileDialog");
|
||||||
|
|
||||||
|
if (topWinAllowsPop && (not isPatternMessage || (type == QtCriticalMsg || type == QtFatalMsg)))
|
||||||
|
{
|
||||||
QMessageBox messageBox;
|
QMessageBox messageBox;
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -219,13 +240,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg)
|
messageBox.setText(VAbstractApplication::ClearMessage(logMsg));
|
||||||
{
|
|
||||||
if (VApplication::IsGUIMode())
|
|
||||||
{
|
|
||||||
if (topWinAllowsPop)
|
|
||||||
{
|
|
||||||
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);
|
||||||
|
|
|
@ -174,8 +174,6 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
dialogFMeasurements(nullptr),
|
dialogFMeasurements(nullptr),
|
||||||
comboBoxDraws(nullptr), patternPieceLabel(nullptr),
|
comboBoxDraws(nullptr), patternPieceLabel(nullptr),
|
||||||
currentDrawIndex(0), currentToolBoxIndex(0),
|
currentDrawIndex(0), currentToolBoxIndex(0),
|
||||||
isDockToolOptionsVisible(true),
|
|
||||||
isDockGroupsVisible(true),
|
|
||||||
drawMode(true),
|
drawMode(true),
|
||||||
leftGoToStage(nullptr), rightGoToStage(nullptr), autoSaveTimer(nullptr), guiEnabled(true),
|
leftGoToStage(nullptr), rightGoToStage(nullptr), autoSaveTimer(nullptr), guiEnabled(true),
|
||||||
gradationHeights(nullptr),
|
gradationHeights(nullptr),
|
||||||
|
@ -300,6 +298,44 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
|
|
||||||
menu->setAsDockMenu();
|
menu->setAsDockMenu();
|
||||||
#endif //defined(Q_OS_MAC)
|
#endif //defined(Q_OS_MAC)
|
||||||
|
|
||||||
|
connect(ui->toolButtonMessagesZoomInFont, &QToolButton::clicked, this, [this]()
|
||||||
|
{
|
||||||
|
VSettings *settings = qApp->ValentinaSettings();
|
||||||
|
QFont f = ui->plainTextEditPatternMessages->font();
|
||||||
|
if (f.pointSize() < settings->GetDefMaxPatternMessageFontSize())
|
||||||
|
{
|
||||||
|
f.setPointSize(f.pointSize()+1);
|
||||||
|
ui->plainTextEditPatternMessages->setFont(f);
|
||||||
|
settings->SetPatternMessageFontSize(f.pointSize());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->toolButtonMessagesZoomOutFont, &QToolButton::clicked, this, [this]()
|
||||||
|
{
|
||||||
|
VSettings *settings = qApp->ValentinaSettings();
|
||||||
|
QFont f = ui->plainTextEditPatternMessages->font();
|
||||||
|
if (f.pointSize() > settings->GetDefMinPatternMessageFontSize())
|
||||||
|
{
|
||||||
|
f.setPointSize(f.pointSize()-1);
|
||||||
|
ui->plainTextEditPatternMessages->setFont(f);
|
||||||
|
settings->SetPatternMessageFontSize(f.pointSize());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->lineEditMessagesFilter, &QLineEdit::textChanged, this, [this](const QString &text)
|
||||||
|
{
|
||||||
|
ui->plainTextEditPatternMessages->SetFilter(text);
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->toolButtonClearMessages, &QToolButton::clicked, this, [this]()
|
||||||
|
{
|
||||||
|
ui->plainTextEditPatternMessages->clear();
|
||||||
|
if (not m_unreadPatternMessage.isNull())
|
||||||
|
{
|
||||||
|
m_unreadPatternMessage->setText(QString());
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1542,6 +1578,10 @@ void MainWindow::customEvent(QEvent *event)
|
||||||
{
|
{
|
||||||
ZoomFitBestCurrent();
|
ZoomFitBestCurrent();
|
||||||
}
|
}
|
||||||
|
else if (event->type() == PATTERN_MESSAGE_EVENT)
|
||||||
|
{
|
||||||
|
PrintPatternMessage(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1975,6 +2015,10 @@ void MainWindow::ToolBarOption()
|
||||||
|
|
||||||
m_mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(UnitsToStr(qApp->patternUnit(), true)));
|
m_mouseCoordinate = new QLabel(QString("0, 0 (%1)").arg(UnitsToStr(qApp->patternUnit(), true)));
|
||||||
ui->toolBarOption->addWidget(m_mouseCoordinate);
|
ui->toolBarOption->addWidget(m_mouseCoordinate);
|
||||||
|
|
||||||
|
ui->toolBarOption->addSeparator();
|
||||||
|
m_unreadPatternMessage = new QLabel();
|
||||||
|
ui->toolBarOption->addWidget(m_unreadPatternMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -2647,13 +2691,14 @@ void MainWindow::ActionDetails(bool checked)
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->dockWidgetLayoutPages->setVisible(false);
|
ui->dockWidgetLayoutPages->setVisible(false);
|
||||||
ui->dockWidgetToolOptions->setVisible(isDockToolOptionsVisible);
|
|
||||||
|
|
||||||
ui->dockWidgetGroups->setWidget(detailsWidget);
|
ui->dockWidgetGroups->setWidget(detailsWidget);
|
||||||
ui->dockWidgetGroups->setWindowTitle(tr("Details"));
|
ui->dockWidgetGroups->setWindowTitle(tr("Details"));
|
||||||
ui->dockWidgetGroups->setVisible(isDockGroupsVisible);
|
ui->dockWidgetGroups->setVisible(isDockGroupsVisible);
|
||||||
ui->dockWidgetGroups->setToolTip(tr("Show which details will go in layout"));
|
ui->dockWidgetGroups->setToolTip(tr("Show which details will go in layout"));
|
||||||
|
|
||||||
|
ui->dockWidgetToolOptions->setVisible(isDockToolOptionsVisible);
|
||||||
|
|
||||||
m_statusLabel->setText(QString());
|
m_statusLabel->setText(QString());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3101,6 +3146,7 @@ void MainWindow::Clear()
|
||||||
ui->actionDecreaseLabelFont->setEnabled(false);
|
ui->actionDecreaseLabelFont->setEnabled(false);
|
||||||
ui->actionOriginalLabelFont->setEnabled(false);
|
ui->actionOriginalLabelFont->setEnabled(false);
|
||||||
ui->actionHideLabels->setEnabled(false);
|
ui->actionHideLabels->setEnabled(false);
|
||||||
|
ui->plainTextEditPatternMessages->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -3921,6 +3967,10 @@ void MainWindow::ReadSettings()
|
||||||
restoreState(settings->GetWindowState());
|
restoreState(settings->GetWindowState());
|
||||||
restoreState(settings->GetToolbarsState(), APP_VERSION);
|
restoreState(settings->GetToolbarsState(), APP_VERSION);
|
||||||
|
|
||||||
|
ui->dockWidgetGroups->setVisible(settings->IsDockWidgetGroupsActive());
|
||||||
|
ui->dockWidgetToolOptions->setVisible(settings->IsDockWidgetToolOptionsActive());
|
||||||
|
ui->dockWidgetMessages->setVisible(settings->IsDockWidgetPatternMessagesActive());
|
||||||
|
|
||||||
// Scene antialiasing
|
// Scene antialiasing
|
||||||
ui->view->SetAntialiasing(settings->GetGraphicalOutput());
|
ui->view->SetAntialiasing(settings->GetGraphicalOutput());
|
||||||
|
|
||||||
|
@ -3930,8 +3980,12 @@ void MainWindow::ReadSettings()
|
||||||
// Text under tool buton icon
|
// Text under tool buton icon
|
||||||
ToolBarStyles();
|
ToolBarStyles();
|
||||||
|
|
||||||
isDockToolOptionsVisible = ui->dockWidgetToolOptions->isVisible();
|
isDockToolOptionsVisible = ui->dockWidgetToolOptions->isEnabled();
|
||||||
isDockGroupsVisible = ui->dockWidgetGroups->isVisible();
|
isDockGroupsVisible = ui->dockWidgetGroups->isEnabled();
|
||||||
|
|
||||||
|
QFont f = ui->plainTextEditPatternMessages->font();
|
||||||
|
f.setPointSize(settings->GetPatternMessageFontSize(f.pointSize()));
|
||||||
|
ui->plainTextEditPatternMessages->setFont(f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3952,6 +4006,10 @@ void MainWindow::WriteSettings()
|
||||||
settings->SetWindowState(saveState());
|
settings->SetWindowState(saveState());
|
||||||
settings->SetToolbarsState(saveState(APP_VERSION));
|
settings->SetToolbarsState(saveState(APP_VERSION));
|
||||||
|
|
||||||
|
settings->SetDockWidgetGroupsActive(ui->dockWidgetGroups->isEnabled());
|
||||||
|
settings->SetDockWidgetToolOptionsActive(ui->dockWidgetToolOptions->isEnabled());
|
||||||
|
settings->SetDockWidgetPatternMessagesActive(ui->dockWidgetMessages->isEnabled());
|
||||||
|
|
||||||
settings->sync();
|
settings->sync();
|
||||||
if (settings->status() == QSettings::AccessError)
|
if (settings->status() == QSettings::AccessError)
|
||||||
{
|
{
|
||||||
|
@ -4262,17 +4320,19 @@ void MainWindow::AddDocks()
|
||||||
//Add dock
|
//Add dock
|
||||||
actionDockWidgetToolOptions = ui->dockWidgetToolOptions->toggleViewAction();
|
actionDockWidgetToolOptions = ui->dockWidgetToolOptions->toggleViewAction();
|
||||||
ui->menuWindow->addAction(actionDockWidgetToolOptions);
|
ui->menuWindow->addAction(actionDockWidgetToolOptions);
|
||||||
connect(ui->dockWidgetToolOptions, &QDockWidget::visibilityChanged, this, [this](bool visible)
|
connect(actionDockWidgetToolOptions, &QAction::triggered, this, [this](bool checked)
|
||||||
{
|
{
|
||||||
isDockToolOptionsVisible = visible;
|
isDockToolOptionsVisible = checked;
|
||||||
});
|
});
|
||||||
|
|
||||||
actionDockWidgetGroups = ui->dockWidgetGroups->toggleViewAction();
|
actionDockWidgetGroups = ui->dockWidgetGroups->toggleViewAction();
|
||||||
ui->menuWindow->addAction(actionDockWidgetGroups);
|
ui->menuWindow->addAction(actionDockWidgetGroups);
|
||||||
connect(ui->dockWidgetGroups, &QDockWidget::visibilityChanged, this, [this](bool visible)
|
connect(actionDockWidgetGroups, &QAction::triggered, this, [this](bool checked)
|
||||||
{
|
{
|
||||||
isDockGroupsVisible = visible;
|
isDockGroupsVisible = checked;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ui->menuWindow->addAction(ui->dockWidgetMessages->toggleViewAction());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -6044,3 +6104,43 @@ void MainWindow::ToolSelectDetail()
|
||||||
|
|
||||||
ui->view->AllowRubberBand(false);
|
ui->view->AllowRubberBand(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void MainWindow::PrintPatternMessage(QEvent *event)
|
||||||
|
{
|
||||||
|
SCASSERT(event != nullptr)
|
||||||
|
auto *patternMessage = static_cast<PatternMessageEvent *>(event);
|
||||||
|
|
||||||
|
QString severity;
|
||||||
|
|
||||||
|
switch(patternMessage->Severity())
|
||||||
|
{
|
||||||
|
case QtDebugMsg:
|
||||||
|
severity = tr("DEBUG");
|
||||||
|
break;
|
||||||
|
case QtWarningMsg:
|
||||||
|
severity = tr("WARNING");
|
||||||
|
break;
|
||||||
|
case QtCriticalMsg:
|
||||||
|
severity = tr("CRITICAL");
|
||||||
|
break;
|
||||||
|
case QtFatalMsg:
|
||||||
|
severity = tr("FATAL");
|
||||||
|
break;
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
|
||||||
|
case QtInfoMsg:
|
||||||
|
severity = tr("INFO");
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QString time = QDateTime::currentDateTime().toString(QStringLiteral("hh:mm:ss"));
|
||||||
|
const QString message = QStringLiteral("%1: [%2] %3").arg(time, severity, patternMessage->Message());
|
||||||
|
ui->plainTextEditPatternMessages->appendPlainText(message);
|
||||||
|
if (not m_unreadPatternMessage.isNull())
|
||||||
|
{
|
||||||
|
m_unreadPatternMessage->setText(DialogWarningIcon() + tr("Pattern messages"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -249,8 +249,8 @@ private:
|
||||||
/** @brief currentToolBoxIndex save current set of tools. */
|
/** @brief currentToolBoxIndex save current set of tools. */
|
||||||
qint32 currentToolBoxIndex;
|
qint32 currentToolBoxIndex;
|
||||||
|
|
||||||
bool isDockToolOptionsVisible;
|
bool isDockToolOptionsVisible{false};
|
||||||
bool isDockGroupsVisible;
|
bool isDockGroupsVisible{false};
|
||||||
|
|
||||||
/** @brief drawMode true if we current draw scene. */
|
/** @brief drawMode true if we current draw scene. */
|
||||||
bool drawMode;
|
bool drawMode;
|
||||||
|
@ -378,6 +378,8 @@ private:
|
||||||
void ToolSelectOperationObjects();
|
void ToolSelectOperationObjects();
|
||||||
void ToolSelectGroupObjects();
|
void ToolSelectGroupObjects();
|
||||||
void ToolSelectDetail();
|
void ToolSelectDetail();
|
||||||
|
|
||||||
|
void PrintPatternMessage(QEvent *event);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1100</width>
|
<width>1100</width>
|
||||||
<height>709</height>
|
<height>809</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>140</width>
|
<width>126</width>
|
||||||
<height>282</height>
|
<height>282</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -481,7 +481,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>140</width>
|
<width>126</width>
|
||||||
<height>243</height>
|
<height>243</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -746,7 +746,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>140</width>
|
<width>126</width>
|
||||||
<height>282</height>
|
<height>282</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1120,8 +1120,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>140</width>
|
<width>126</width>
|
||||||
<height>331</height>
|
<height>192</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="icon">
|
<attribute name="icon">
|
||||||
|
@ -1324,7 +1324,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>140</width>
|
<width>126</width>
|
||||||
<height>237</height>
|
<height>237</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1590,7 +1590,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>140</width>
|
<width>140</width>
|
||||||
<height>331</height>
|
<height>163</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="icon">
|
<attribute name="icon">
|
||||||
|
@ -2013,6 +2013,115 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
<widget class="QWidget" name="dockWidgetContents_2"/>
|
<widget class="QWidget" name="dockWidgetContents_2"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QDockWidget" name="dockWidgetMessages">
|
||||||
|
<property name="floating">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Pattern messages</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="dockWidgetArea">
|
||||||
|
<number>8</number>
|
||||||
|
</attribute>
|
||||||
|
<widget class="QWidget" name="dockWidgetContents_4">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonClearMessages">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Clear all messages</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../../libs/vmisc/share/resources/icon.qrc">
|
||||||
|
<normaloff>:/icon/16x16/broom@2x.png</normaloff>:/icon/16x16/broom@2x.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="VLineEdit" name="lineEditMessagesFilter">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>1</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Filter</string>
|
||||||
|
</property>
|
||||||
|
<property name="clearButtonEnabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonMessagesZoomInFont">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Zoom in</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="zoom-in">
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonMessagesZoomOutFont">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Zoom out</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="zoom-out">
|
||||||
|
<normaloff>.</normaloff>.</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="VPlainTextEdit" name="plainTextEditPatternMessages">
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="maximumBlockCount">
|
||||||
|
<number>500</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
<action name="actionNew">
|
<action name="actionNew">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="document-new">
|
<iconset theme="document-new">
|
||||||
|
@ -2859,6 +2968,16 @@
|
||||||
<extends>QGraphicsView</extends>
|
<extends>QGraphicsView</extends>
|
||||||
<header>vmaingraphicsview.h</header>
|
<header>vmaingraphicsview.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>VLineEdit</class>
|
||||||
|
<extends>QLineEdit</extends>
|
||||||
|
<header>vlineedit.h</header>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>VPlainTextEdit</class>
|
||||||
|
<extends>QPlainTextEdit</extends>
|
||||||
|
<header>vplaintextedit.h</header>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="share/resources/toolicon.qrc"/>
|
<include location="share/resources/toolicon.qrc"/>
|
||||||
|
|
|
@ -174,6 +174,7 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
MainWindowsNoGUI::~MainWindowsNoGUI()
|
MainWindowsNoGUI::~MainWindowsNoGUI()
|
||||||
{
|
{
|
||||||
|
delete m_unreadPatternMessage;
|
||||||
delete m_mouseCoordinate;
|
delete m_mouseCoordinate;
|
||||||
delete tempSceneLayout;
|
delete tempSceneLayout;
|
||||||
delete pattern;
|
delete pattern;
|
||||||
|
|
|
@ -122,6 +122,7 @@ protected:
|
||||||
|
|
||||||
/** @brief mouseCoordinate pointer to label who show mouse coordinate. */
|
/** @brief mouseCoordinate pointer to label who show mouse coordinate. */
|
||||||
QPointer<QLabel> m_mouseCoordinate;
|
QPointer<QLabel> m_mouseCoordinate;
|
||||||
|
QPointer<QLabel> m_unreadPatternMessage{};
|
||||||
|
|
||||||
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||||
QWinTaskbarButton *m_taskbarButton;
|
QWinTaskbarButton *m_taskbarButton;
|
||||||
|
|
|
@ -1011,7 +1011,8 @@ QVector<QPointF> VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal wid
|
||||||
if ( points.size() < 3 )
|
if ( points.size() < 3 )
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Piece '%1'. Not enough points to build seam allowance.").arg(name);
|
const QString errorMsg = tr("Piece '%1'. Not enough points to build seam allowance.").arg(name);
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
return QVector<QPointF>();
|
return QVector<QPointF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -385,7 +385,8 @@ bool VBank::PrepareDetails()
|
||||||
{
|
{
|
||||||
const QString errorMsg = QObject::tr("Piece '%1' has invalid layout allowance. Please, check seam allowance"
|
const QString errorMsg = QObject::tr("Piece '%1' has invalid layout allowance. Please, check seam allowance"
|
||||||
" to check how seam allowance behave.").arg(details.at(i).GetName());
|
" to check how seam allowance behave.").arg(details.at(i).GetName());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
const qreal d = details.at(i).Diagonal();
|
const qreal d = details.at(i).Diagonal();
|
||||||
|
|
|
@ -268,7 +268,8 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
||||||
const QString errorMsg =
|
const QString errorMsg =
|
||||||
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
||||||
.arg(pData.nodeName, piece.GetName());
|
.arg(pData.nodeName, piece.GetName());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -302,7 +303,8 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
||||||
const QString errorMsg =
|
const QString errorMsg =
|
||||||
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
||||||
.arg(pData.nodeName, piece.GetName());
|
.arg(pData.nodeName, piece.GetName());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -432,7 +434,8 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContai
|
||||||
{
|
{
|
||||||
const QString errorMsg = QObject::tr("Piece '%1'. Seam allowance is not valid.")
|
const QString errorMsg = QObject::tr("Piece '%1'. Seam allowance is not valid.")
|
||||||
.arg(piece.GetName());
|
.arg(piece.GetName());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
det.SetCountourPoints(futureMainPath.result(), piece.IsHideMainPath());
|
det.SetCountourPoints(futureMainPath.result(), piece.IsHideMainPath());
|
||||||
|
|
|
@ -31,9 +31,18 @@
|
||||||
|
|
||||||
#include <qcompilerdetection.h>
|
#include <qcompilerdetection.h>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
enum CustomEventType { UndoEventType = 1, LiteParseEventType = 2, FitBestCurrentEventType = 3 };
|
#include "typedef.h"
|
||||||
|
|
||||||
|
enum CustomEventType {
|
||||||
|
UndoEventType = 1,
|
||||||
|
LiteParseEventType = 2,
|
||||||
|
FitBestCurrentEventType = 3,
|
||||||
|
PatternMessageEventType = 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
// Define undo event identifier
|
// Define undo event identifier
|
||||||
const QEvent::Type UNDO_EVENT = static_cast<QEvent::Type>(QEvent::User + CustomEventType::UndoEventType);
|
const QEvent::Type UNDO_EVENT = static_cast<QEvent::Type>(QEvent::User + CustomEventType::UndoEventType);
|
||||||
|
|
||||||
|
@ -47,6 +56,7 @@ public:
|
||||||
virtual ~UndoEvent() =default;
|
virtual ~UndoEvent() =default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
const QEvent::Type LITE_PARSE_EVENT = static_cast<QEvent::Type>(QEvent::User + CustomEventType::LiteParseEventType);
|
const QEvent::Type LITE_PARSE_EVENT = static_cast<QEvent::Type>(QEvent::User + CustomEventType::LiteParseEventType);
|
||||||
|
|
||||||
class LiteParseEvent : public QEvent
|
class LiteParseEvent : public QEvent
|
||||||
|
@ -59,6 +69,7 @@ public:
|
||||||
virtual ~LiteParseEvent() =default;
|
virtual ~LiteParseEvent() =default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
const QEvent::Type FIT_BEST_CURRENT_EVENT = static_cast<QEvent::Type>(QEvent::User +
|
const QEvent::Type FIT_BEST_CURRENT_EVENT = static_cast<QEvent::Type>(QEvent::User +
|
||||||
CustomEventType::FitBestCurrentEventType);
|
CustomEventType::FitBestCurrentEventType);
|
||||||
|
|
||||||
|
@ -72,4 +83,38 @@ public:
|
||||||
virtual ~FitBestCurrentEvent() =default;
|
virtual ~FitBestCurrentEvent() =default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
const QEvent::Type PATTERN_MESSAGE_EVENT = static_cast<QEvent::Type>(QEvent::User +
|
||||||
|
CustomEventType::PatternMessageEventType);
|
||||||
|
|
||||||
|
class PatternMessageEvent : public QEvent
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PatternMessageEvent(const QString &message, QtMsgType severity)
|
||||||
|
: QEvent(PATTERN_MESSAGE_EVENT),
|
||||||
|
m_message(message),
|
||||||
|
m_severity(severity)
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual ~PatternMessageEvent() =default;
|
||||||
|
|
||||||
|
QString Message() const;
|
||||||
|
|
||||||
|
QtMsgType Severity() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_message;
|
||||||
|
QtMsgType m_severity;
|
||||||
|
};
|
||||||
|
|
||||||
#endif // CUSTOMEVENTS_H
|
#endif // CUSTOMEVENTS_H
|
||||||
|
|
||||||
|
inline QString PatternMessageEvent::Message() const
|
||||||
|
{
|
||||||
|
return m_message;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QtMsgType PatternMessageEvent::Severity() const
|
||||||
|
{
|
||||||
|
return m_severity;
|
||||||
|
}
|
||||||
|
|
|
@ -77,5 +77,7 @@
|
||||||
<file>icon/32x32/passmark@2x.png</file>
|
<file>icon/32x32/passmark@2x.png</file>
|
||||||
<file>icon/32x32/button.png</file>
|
<file>icon/32x32/button.png</file>
|
||||||
<file>icon/32x32/button@2x.png</file>
|
<file>icon/32x32/button@2x.png</file>
|
||||||
|
<file>icon/16x16/broom.png</file>
|
||||||
|
<file>icon/16x16/broom@2x.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
BIN
src/libs/vmisc/share/resources/icon/16x16/broom.png
Normal file
BIN
src/libs/vmisc/share/resources/icon/16x16/broom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 743 B |
BIN
src/libs/vmisc/share/resources/icon/16x16/broom@2x.png
Normal file
BIN
src/libs/vmisc/share/resources/icon/16x16/broom@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -39,8 +39,12 @@
|
||||||
#include <QUndoStack>
|
#include <QUndoStack>
|
||||||
#include <Qt>
|
#include <Qt>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
|
#include "../vmisc/customevents.h"
|
||||||
|
|
||||||
|
const QString VAbstractApplication::patternMessageSignature = QStringLiteral("[PATTERN MESSAGE]");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VAbstractApplication::VAbstractApplication(int &argc, char **argv)
|
VAbstractApplication::VAbstractApplication(int &argc, char **argv)
|
||||||
|
@ -257,6 +261,18 @@ void VAbstractApplication::SetDrawMode(const Draw &value)
|
||||||
mode = value;
|
mode = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractApplication::PostPatternMessage(const QString &message, QtMsgType severity) const
|
||||||
|
{
|
||||||
|
QApplication::postEvent(mainWindow, new PatternMessageEvent(VAbstractApplication::ClearMessage(message), severity));
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VAbstractApplication::IsPatternMessage(const QString &message) const
|
||||||
|
{
|
||||||
|
return VAbstractApplication::ClearMessage(message).startsWith(patternMessageSignature);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
void VAbstractApplication::WinAttachConsole()
|
void VAbstractApplication::WinAttachConsole()
|
||||||
|
|
|
@ -124,6 +124,11 @@ public:
|
||||||
const Draw &GetDrawMode() const;
|
const Draw &GetDrawMode() const;
|
||||||
void SetDrawMode(const Draw &value);
|
void SetDrawMode(const Draw &value);
|
||||||
|
|
||||||
|
void PostPatternMessage(const QString &message, QtMsgType severity) const;
|
||||||
|
|
||||||
|
static const QString patternMessageSignature;
|
||||||
|
bool IsPatternMessage(const QString &message) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QUndoStack *undoStack;
|
QUndoStack *undoStack;
|
||||||
|
|
||||||
|
|
|
@ -105,10 +105,18 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingTiledPDFOrientation, (QLatin1Str
|
||||||
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingDuration, (QLatin1String("scrolling/duration")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingDuration, (QLatin1String("scrolling/duration")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingUpdateInterval, (QLatin1String("scrolling/updateInterval")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingUpdateInterval, (QLatin1String("scrolling/updateInterval")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingSensorMouseScale, (QLatin1String("scrolling/sensorMouseScale")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingSensorMouseScale,
|
||||||
|
(QLatin1String("scrolling/sensorMouseScale")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingWheelMouseScale, (QLatin1String("scrolling/wheelMouseScale")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingWheelMouseScale, (QLatin1String("scrolling/wheelMouseScale")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingAcceleration, (QLatin1String("scrolling/acceleration")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingScrollingAcceleration, (QLatin1String("scrolling/acceleration")))
|
||||||
|
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingdockWidgetGroupsActive, (QLatin1String("dockWidget/groupsActive")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetToolOptionsActive,
|
||||||
|
(QLatin1String("dockWidget/toolOptionsActive")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDockWidgetPatternMessagesActive,
|
||||||
|
(QLatin1String("dockWidget/patternMessagesActive")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternMessagesFontSize, (QLatin1String("font/patternMessagesSize")))
|
||||||
|
|
||||||
// Reading settings file is very expensive, cache values to speed up getting a value
|
// Reading settings file is very expensive, cache values to speed up getting a value
|
||||||
int scrollingDurationCached = -1;
|
int scrollingDurationCached = -1;
|
||||||
int scrollingUpdateIntervalCached = -1;
|
int scrollingUpdateIntervalCached = -1;
|
||||||
|
@ -678,6 +686,87 @@ void VSettings::SetScrollingAcceleration(qreal acceleration)
|
||||||
setValue(*settingScrollingAcceleration, scrollingAccelerationCached);
|
setValue(*settingScrollingAcceleration, scrollingAccelerationCached);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VSettings::IsDockWidgetGroupsActive() const
|
||||||
|
{
|
||||||
|
return value(*settingdockWidgetGroupsActive, GetDefDockWidgetGroupsActive()).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VSettings::GetDefDockWidgetGroupsActive()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VSettings::SetDockWidgetGroupsActive(bool value)
|
||||||
|
{
|
||||||
|
setValue(*settingdockWidgetGroupsActive, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VSettings::IsDockWidgetToolOptionsActive() const
|
||||||
|
{
|
||||||
|
return value(*settingDockWidgetToolOptionsActive, GetDefDockWidgetToolOptionsActive()).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VSettings::GetDefDockWidgetToolOptionsActive()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VSettings::SetDockWidgetToolOptionsActive(bool value)
|
||||||
|
{
|
||||||
|
setValue(*settingDockWidgetToolOptionsActive, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VSettings::IsDockWidgetPatternMessagesActive() const
|
||||||
|
{
|
||||||
|
return value(*settingDockWidgetPatternMessagesActive, GetDefDockWidgetPatternMessagesActive()).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
bool VSettings::GetDefDockWidgetPatternMessagesActive()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VSettings::SetDockWidgetPatternMessagesActive(bool value)
|
||||||
|
{
|
||||||
|
setValue(*settingDockWidgetPatternMessagesActive, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
int VSettings::GetPatternMessageFontSize(int fontSizeDef) const
|
||||||
|
{
|
||||||
|
fontSizeDef = qBound(GetDefMinPatternMessageFontSize(), fontSizeDef, GetDefMaxPatternMessageFontSize());
|
||||||
|
const int fontSize = value(*settingPatternMessagesFontSize, fontSizeDef).toInt();
|
||||||
|
return qBound(GetDefMinPatternMessageFontSize(), fontSize, GetDefMaxPatternMessageFontSize());
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
int VSettings::GetDefMinPatternMessageFontSize()
|
||||||
|
{
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
int VSettings::GetDefMaxPatternMessageFontSize()
|
||||||
|
{
|
||||||
|
return 40;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VSettings::SetPatternMessageFontSize(int size)
|
||||||
|
{
|
||||||
|
setValue(*settingPatternMessagesFontSize, qBound(GetDefMinPatternMessageFontSize(), size,
|
||||||
|
GetDefMaxPatternMessageFontSize()));
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T VSettings::GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const
|
T VSettings::GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const
|
||||||
|
|
|
@ -178,6 +178,23 @@ public:
|
||||||
qreal GetScrollingAcceleration() const;
|
qreal GetScrollingAcceleration() const;
|
||||||
void SetScrollingAcceleration(qreal acceleration);
|
void SetScrollingAcceleration(qreal acceleration);
|
||||||
|
|
||||||
|
bool IsDockWidgetGroupsActive() const;
|
||||||
|
static bool GetDefDockWidgetGroupsActive();
|
||||||
|
void SetDockWidgetGroupsActive(bool value);
|
||||||
|
|
||||||
|
bool IsDockWidgetToolOptionsActive() const;
|
||||||
|
static bool GetDefDockWidgetToolOptionsActive();
|
||||||
|
void SetDockWidgetToolOptionsActive(bool value);
|
||||||
|
|
||||||
|
bool IsDockWidgetPatternMessagesActive() const;
|
||||||
|
static bool GetDefDockWidgetPatternMessagesActive();
|
||||||
|
void SetDockWidgetPatternMessagesActive(bool value);
|
||||||
|
|
||||||
|
int GetPatternMessageFontSize(int fontSizeDef) const;
|
||||||
|
static int GetDefMinPatternMessageFontSize();
|
||||||
|
static int GetDefMaxPatternMessageFontSize();
|
||||||
|
void SetPatternMessageFontSize(int size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VSettings)
|
Q_DISABLE_COPY(VSettings)
|
||||||
|
|
||||||
|
|
|
@ -575,7 +575,8 @@ QVector<QLineF> PassmarkBisectorBaseLine(PassmarkStatus seamPassmarkType, const
|
||||||
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
|
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
|
||||||
"than minimal allowed.")
|
"than minimal allowed.")
|
||||||
.arg(passmarkData.nodeName, passmarkData.pieceName);
|
.arg(passmarkData.nodeName, passmarkData.pieceName);
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
return QVector<QLineF>();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -783,7 +784,8 @@ QVector<QLineF> VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const
|
||||||
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
|
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
|
||||||
"than minimal allowed.")
|
"than minimal allowed.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
return QVector<QLineF>();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -798,7 +800,8 @@ QVector<QLineF> VPassmark::BuiltInSAPassmarkBaseLine(const VPiece &piece) const
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2' with built in "
|
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2' with built in "
|
||||||
"seam allowance. User must manually provide length.")
|
"seam allowance. User must manually provide length.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
return QVector<QLineF>();
|
return QVector<QLineF>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -841,7 +844,8 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
|
||||||
{
|
{
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Seam allowance is "
|
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Seam allowance is "
|
||||||
"empty.").arg(m_data.nodeName, m_data.pieceName);
|
"empty.").arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
return QVector<QLineF>(); // Something wrong
|
return QVector<QLineF>(); // Something wrong
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -852,7 +856,8 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Cannot find "
|
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Cannot find "
|
||||||
"position for a notch.")
|
"position for a notch.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
return QVector<QLineF>(); // Something wrong
|
return QVector<QLineF>(); // Something wrong
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -861,7 +866,8 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Unable to fix a "
|
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Unable to fix a "
|
||||||
"notch position.")
|
"notch position.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto PassmarkIntersection = [this, seamAllowance] (QLineF line, qreal width)
|
auto PassmarkIntersection = [this, seamAllowance] (QLineF line, qreal width)
|
||||||
|
@ -882,7 +888,8 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
|
||||||
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is "
|
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is "
|
||||||
"less than minimal allowed.")
|
"less than minimal allowed.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
return QLineF();
|
return QLineF();
|
||||||
}
|
}
|
||||||
line.setLength(length);
|
line.setLength(length);
|
||||||
|
@ -898,7 +905,8 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Notch "
|
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Notch "
|
||||||
"collapse.")
|
"collapse.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -906,7 +914,8 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Cannot find "
|
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'. Cannot find "
|
||||||
"intersection.")
|
"intersection.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QLineF();
|
return QLineF();
|
||||||
|
@ -920,7 +929,8 @@ QVector<QLineF> VPassmark::SAPassmarkBaseLine(const QVector<QPointF> &seamAllowa
|
||||||
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
|
const QString errorMsg = QObject::tr("Found null notch for point '%1' in piece '%2'. Length is less "
|
||||||
"than minimal allowed.")
|
"than minimal allowed.")
|
||||||
.arg(m_data.nodeName, m_data.pieceName);
|
.arg(m_data.nodeName, m_data.pieceName);
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -913,7 +913,8 @@ bool VPiece::GetPassmarkPreviousSAPoints(const QVector<VPieceNode> &path, int in
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
||||||
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
return false; // Something wrong
|
return false; // Something wrong
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -951,7 +952,8 @@ bool VPiece::GetPassmarkNextSAPoints(const QVector<VPieceNode> &path, int index,
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
||||||
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
return false; // Something wrong
|
return false; // Something wrong
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1034,7 +1036,8 @@ VPassmark VPiece::CreatePassmark(const QVector<VPieceNode> &path, int previousIn
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
||||||
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
||||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
return VPassmark();
|
return VPassmark();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,8 @@ qreal VPieceNode::GetSABefore(const VContainer *data) const
|
||||||
|
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.")
|
const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.")
|
||||||
.arg(nodeName, formula.Reason());
|
.arg(nodeName, formula.Reason());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return formula.getDoubleValue();
|
return formula.getDoubleValue();
|
||||||
|
@ -177,7 +178,8 @@ qreal VPieceNode::GetSABefore(const VContainer *data, Unit unit) const
|
||||||
|
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.")
|
const QString errorMsg = QObject::tr("Cannot calculate seam allowance before for point '%1'. Reason: %2.")
|
||||||
.arg(nodeName, formula.Reason());
|
.arg(nodeName, formula.Reason());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +230,8 @@ qreal VPieceNode::GetSAAfter(const VContainer *data) const
|
||||||
|
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: %2.")
|
const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: %2.")
|
||||||
.arg(nodeName, formula.Reason());
|
.arg(nodeName, formula.Reason());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +262,8 @@ qreal VPieceNode::GetSAAfter(const VContainer *data, Unit unit) const
|
||||||
|
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: ")
|
const QString errorMsg = QObject::tr("Cannot calculate seam allowance after for point '%1'. Reason: ")
|
||||||
.arg(nodeName, formula.Reason());
|
.arg(nodeName, formula.Reason());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +328,8 @@ qreal VPieceNode::GetPassmarkLength(const VContainer *data, Unit unit) const
|
||||||
|
|
||||||
const QString errorMsg = QObject::tr("Cannot calculate passmark length for point '%1'. Reason: %2.")
|
const QString errorMsg = QObject::tr("Cannot calculate passmark length for point '%1'. Reason: %2.")
|
||||||
.arg(nodeName, formula.Reason());
|
.arg(nodeName, formula.Reason());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
return VSAPoint::maxPassmarkLength;
|
return VSAPoint::maxPassmarkLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -369,7 +369,8 @@ QVector<QPointF> VPiecePath::PathPoints(const VContainer *data, const QVector<QP
|
||||||
const QString errorMsg = QObject::tr("Error in internal path '%1'. There is no intersection of first "
|
const QString errorMsg = QObject::tr("Error in internal path '%1'. There is no intersection of first "
|
||||||
"point with cutting countour")
|
"point with cutting countour")
|
||||||
.arg(GetName());
|
.arg(GetName());
|
||||||
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +387,8 @@ QVector<QPointF> VPiecePath::PathPoints(const VContainer *data, const QVector<QP
|
||||||
const QString errorMsg = QObject::tr("Error in internal path '%1'. There is no intersection of last "
|
const QString errorMsg = QObject::tr("Error in internal path '%1'. There is no intersection of last "
|
||||||
"point with cutting countour")
|
"point with cutting countour")
|
||||||
.arg(GetName());
|
.arg(GetName());
|
||||||
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,8 @@ VToolCurveIntersectAxis *VToolCurveIntersectAxis::Create(VToolCurveIntersectAxis
|
||||||
const QString errorMsg = tr("Error calculating point '%1'. There is no intersection with curve '%2' and axis"
|
const QString errorMsg = tr("Error calculating point '%1'. There is no intersection with curve '%2' and axis"
|
||||||
" through point '%3' with angle %4°")
|
" through point '%3' with angle %4°")
|
||||||
.arg(initData.name, curve->name(), basePoint->name()).arg(angle);
|
.arg(initData.name, curve->name(), basePoint->name()).arg(angle);
|
||||||
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
const qreal segLength = curve->GetLengthByPoint(fPoint);
|
const qreal segLength = curve->GetLengthByPoint(fPoint);
|
||||||
|
|
|
@ -133,7 +133,8 @@ VToolLineIntersectAxis *VToolLineIntersectAxis::Create(VToolLineIntersectAxisIni
|
||||||
const QString errorMsg = tr("Error calculating point '%1'. Line (%2;%3) doesn't have intersection with axis "
|
const QString errorMsg = tr("Error calculating point '%1'. Line (%2;%3) doesn't have intersection with axis "
|
||||||
"through point '%4' and angle %5°")
|
"through point '%4' and angle %5°")
|
||||||
.arg(initData.name, firstPoint->name(), secondPoint->name(), basePoint->name()).arg(axis.angle());
|
.arg(initData.name, firstPoint->name(), secondPoint->name(), basePoint->name()).arg(axis.angle());
|
||||||
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
VPointF *p = new VPointF(fPoint, initData.name, initData.mx, initData.my);
|
VPointF *p = new VPointF(fPoint, initData.name, initData.mx, initData.my);
|
||||||
|
|
|
@ -121,7 +121,8 @@ VToolPointFromArcAndTangent *VToolPointFromArcAndTangent::Create(VToolPointFromA
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Error calculating point '%1'. Tangent to arc '%2' from point '%3' cannot be found")
|
const QString errorMsg = tr("Error calculating point '%1'. Tangent to arc '%2' from point '%3' cannot be found")
|
||||||
.arg(initData.name, arc.name(), tPoint.name());
|
.arg(initData.name, arc.name(), tPoint.name());
|
||||||
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
||||||
|
|
|
@ -130,7 +130,8 @@ VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(VToolPoin
|
||||||
"from point '%4' cannot be found")
|
"from point '%4' cannot be found")
|
||||||
.arg(initData.name, cPoint.name()).arg(radius).arg(tPoint.name());
|
.arg(initData.name, cPoint.name()).arg(radius).arg(tPoint.name());
|
||||||
|
|
||||||
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
||||||
|
|
|
@ -216,7 +216,8 @@ VToolPointOfContact* VToolPointOfContact::Create(VToolPointOfContactInitData &in
|
||||||
const QString errorMsg = tr("Error calculating point '%1'. Circle with center '%2' and radius '%3' doesn't have "
|
const QString errorMsg = tr("Error calculating point '%1'. Circle with center '%2' and radius '%3' doesn't have "
|
||||||
"intersection with line (%4;%5)")
|
"intersection with line (%4;%5)")
|
||||||
.arg(initData.name, centerP->name()).arg(result).arg(firstP->name(), secondP->name());
|
.arg(initData.name, centerP->name()).arg(result).arg(firstP->name(), secondP->name());
|
||||||
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
VPointF *p = new VPointF(fPoint, initData.name, initData.mx, initData.my);
|
VPointF *p = new VPointF(fPoint, initData.name, initData.mx, initData.my);
|
||||||
|
|
|
@ -120,7 +120,8 @@ VToolPointOfIntersectionArcs *VToolPointOfIntersectionArcs::Create(VToolPointOfI
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Error calculating point '%1'. Arcs '%2' and '%3' have no point of intersection")
|
const QString errorMsg = tr("Error calculating point '%1'. Arcs '%2' and '%3' have no point of intersection")
|
||||||
.arg(initData.name, firstArc->name(), secondArc->name());
|
.arg(initData.name, firstArc->name(), secondArc->name());
|
||||||
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
||||||
|
|
|
@ -134,7 +134,8 @@ VToolPointOfIntersectionCircles::Create(VToolPointOfIntersectionCirclesInitData
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Error calculating point '%1'. Circles with centers in points '%2' and '%3' have "
|
const QString errorMsg = tr("Error calculating point '%1'. Circles with centers in points '%2' and '%3' have "
|
||||||
"no point of intersection").arg(initData.name, c1Point.name(), c2Point.name());
|
"no point of intersection").arg(initData.name, c1Point.name(), c2Point.name());
|
||||||
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
||||||
|
|
|
@ -125,7 +125,8 @@ VToolPointOfIntersectionCurves *VToolPointOfIntersectionCurves::Create(VToolPoin
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Error calculating point '%1'. Curves '%2' and '%3' have no point of intersection")
|
const QString errorMsg = tr("Error calculating point '%1'. Curves '%2' and '%3' have no point of intersection")
|
||||||
.arg(initData.name, curve1->name(), curve2->name());
|
.arg(initData.name, curve1->name(), curve2->name());
|
||||||
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
||||||
|
|
|
@ -146,7 +146,8 @@ VToolTriangle* VToolTriangle::Create(VToolTriangleInitData initData)
|
||||||
{
|
{
|
||||||
const QString errorMsg = tr("Error calculating point '%1'. Point of intersection cannot be found")
|
const QString errorMsg = tr("Error calculating point '%1'. Point of intersection cannot be found")
|
||||||
.arg(initData.name);
|
.arg(initData.name);
|
||||||
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VExceptionObjectError(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
VPointF *p = new VPointF(point, initData.name, initData.mx, initData.my);
|
||||||
|
|
|
@ -1342,7 +1342,8 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren)
|
||||||
{
|
{
|
||||||
const QString errorMsg = QObject::tr("Piece '%1'. Seam allowance is not valid.")
|
const QString errorMsg = QObject::tr("Piece '%1'. Seam allowance is not valid.")
|
||||||
.arg(detail.GetName());
|
.arg(detail.GetName());
|
||||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||||
|
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||||
}
|
}
|
||||||
path.addPath(detail.SeamAllowancePath(futureSeamAllowance.result()));
|
path.addPath(detail.SeamAllowancePath(futureSeamAllowance.result()));
|
||||||
path.setFillRule(Qt::OddEvenFill);
|
path.setFillRule(Qt::OddEvenFill);
|
||||||
|
|
|
@ -49,6 +49,50 @@ VPlainTextEdit::~VPlainTextEdit()
|
||||||
document()->blockSignals(true); // prevent crash
|
document()->blockSignals(true); // prevent crash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPlainTextEdit::SetFilter(const QString &filter)
|
||||||
|
{
|
||||||
|
if(m_filter.isEmpty() && not filter.isEmpty())
|
||||||
|
{
|
||||||
|
QTextDocument *doc = document();
|
||||||
|
m_allLines.clear();
|
||||||
|
m_allLines.reserve(doc->lineCount());
|
||||||
|
|
||||||
|
for(int i=0; i < doc->blockCount(); ++i)
|
||||||
|
{
|
||||||
|
m_allLines.append(doc->findBlockByNumber(i).text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_filter = filter;
|
||||||
|
|
||||||
|
Filter();
|
||||||
|
|
||||||
|
if(m_filter.isEmpty())
|
||||||
|
{
|
||||||
|
m_allLines.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPlainTextEdit::appendPlainText(const QString &text)
|
||||||
|
{
|
||||||
|
if (m_filter.isEmpty())
|
||||||
|
{
|
||||||
|
QPlainTextEdit::appendPlainText(text);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_allLines.append(text);
|
||||||
|
const int diff = m_allLines.size() - maximumBlockCount();
|
||||||
|
if (diff > 0)
|
||||||
|
{
|
||||||
|
m_allLines = m_allLines.mid(diff);
|
||||||
|
}
|
||||||
|
Filter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPlainTextEdit::MatchParentheses()
|
void VPlainTextEdit::MatchParentheses()
|
||||||
{
|
{
|
||||||
|
@ -182,3 +226,26 @@ void VPlainTextEdit::CreateParenthesisSelection(int pos, bool match)
|
||||||
|
|
||||||
setExtraSelections(selections);
|
setExtraSelections(selections);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VPlainTextEdit::Filter()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
if(not m_filter.isEmpty())
|
||||||
|
{
|
||||||
|
for(auto &line : m_allLines)
|
||||||
|
{
|
||||||
|
if (line.contains(m_filter))
|
||||||
|
{
|
||||||
|
QPlainTextEdit::appendPlainText(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(auto &line : m_allLines)
|
||||||
|
{
|
||||||
|
QPlainTextEdit::appendPlainText(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -39,15 +39,24 @@ public:
|
||||||
VPlainTextEdit(const QString & text, QWidget * parent = nullptr);
|
VPlainTextEdit(const QString & text, QWidget * parent = nullptr);
|
||||||
virtual ~VPlainTextEdit();
|
virtual ~VPlainTextEdit();
|
||||||
|
|
||||||
|
void SetMatchParenthesesEnabled(bool enabled);
|
||||||
|
|
||||||
|
void SetFilter(const QString &filter);
|
||||||
|
|
||||||
|
void appendPlainText(const QString &text);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void MatchParentheses();
|
void MatchParentheses();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VHighlighter m_highlighter;
|
VHighlighter m_highlighter;
|
||||||
|
QString m_filter{};
|
||||||
|
QStringList m_allLines{};
|
||||||
|
|
||||||
bool MatchLeftParenthesis(QTextBlock currentBlock, int i, int numLeftParentheses);
|
bool MatchLeftParenthesis(QTextBlock currentBlock, int i, int numLeftParentheses);
|
||||||
bool MatchRightParenthesis(QTextBlock currentBlock, int i, int numRightParentheses);
|
bool MatchRightParenthesis(QTextBlock currentBlock, int i, int numRightParentheses);
|
||||||
void CreateParenthesisSelection(int pos, bool match = true);
|
void CreateParenthesisSelection(int pos, bool match = true);
|
||||||
|
void Filter();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VPLAINTEXTEDIT_H
|
#endif // VPLAINTEXTEDIT_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user