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.
|
||||
- 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 feature Pattern Messages.
|
||||
|
||||
# Version 0.6.2 (unreleased)
|
||||
- [#903] Bug in tool Cut Spline path.
|
||||
|
|
|
@ -145,36 +145,51 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
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"));
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case QtDebugMsg:
|
||||
debugdate += QString(":DEBUG:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
||||
.arg(context.function, context.category, msg);
|
||||
vStdOut() << QApplication::translate("vNoisyHandler", "DEBUG:") << msg << "\n";
|
||||
debugdate += QStringLiteral(":DEBUG:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
||||
.arg(context.function, context.category, logMsg);
|
||||
vStdOut() << QApplication::translate("vNoisyHandler", "DEBUG:") << logMsg << "\n";
|
||||
break;
|
||||
case QtWarningMsg:
|
||||
debugdate += QString(":WARNING:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
||||
.arg(context.function, context.category, msg);
|
||||
vStdErr() << QApplication::translate("vNoisyHandler", "WARNING:") << msg << "\n";
|
||||
if (isPatternMessage)
|
||||
{
|
||||
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;
|
||||
case QtCriticalMsg:
|
||||
debugdate += QString(":CRITICAL:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
||||
.arg(context.function, context.category, msg);
|
||||
vStdErr() << QApplication::translate("vNoisyHandler", "CRITICAL:") << msg << "\n";
|
||||
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";
|
||||
break;
|
||||
case QtFatalMsg:
|
||||
debugdate += QString(":FATAL:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
||||
.arg(context.function, context.category, msg);
|
||||
vStdErr() << QApplication::translate("vNoisyHandler", "FATAL:") << msg << "\n";
|
||||
debugdate += QStringLiteral(":FATAL:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
||||
.arg(context.function, context.category, logMsg);
|
||||
vStdErr() << QApplication::translate("vNoisyHandler", "FATAL:") << logMsg << "\n";
|
||||
break;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0)
|
||||
case QtInfoMsg:
|
||||
debugdate += QString(":INFO:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line)
|
||||
.arg(context.function, context.category, msg);
|
||||
vStdOut() << QApplication::translate("vNoisyHandler", "INFO:") << msg << "\n";
|
||||
if (isPatternMessage)
|
||||
{
|
||||
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;
|
||||
#endif
|
||||
default:
|
||||
|
@ -188,11 +203,17 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
|
||||
if (isGuiThread)
|
||||
{
|
||||
//fixme: trying to make sure there are no save/load dialogs are opened, because error message during them will
|
||||
//lead to crash
|
||||
if (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg)
|
||||
{
|
||||
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) ||
|
||||
!QApplication::activeModalWidget()->inherits("QFileDialog");
|
||||
|
||||
if (topWinAllowsPop && (not isPatternMessage || (type == QtCriticalMsg || type == QtFatalMsg)))
|
||||
{
|
||||
QMessageBox messageBox;
|
||||
switch (type)
|
||||
{
|
||||
|
@ -219,13 +240,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
|
|||
break;
|
||||
}
|
||||
|
||||
if (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg)
|
||||
{
|
||||
if (VApplication::IsGUIMode())
|
||||
{
|
||||
if (topWinAllowsPop)
|
||||
{
|
||||
messageBox.setText(VAbstractApplication::ClearMessage(msg));
|
||||
messageBox.setText(VAbstractApplication::ClearMessage(logMsg));
|
||||
messageBox.setStandardButtons(QMessageBox::Ok);
|
||||
messageBox.setWindowModality(Qt::ApplicationModal);
|
||||
messageBox.setModal(true);
|
||||
|
|
|
@ -174,8 +174,6 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
dialogFMeasurements(nullptr),
|
||||
comboBoxDraws(nullptr), patternPieceLabel(nullptr),
|
||||
currentDrawIndex(0), currentToolBoxIndex(0),
|
||||
isDockToolOptionsVisible(true),
|
||||
isDockGroupsVisible(true),
|
||||
drawMode(true),
|
||||
leftGoToStage(nullptr), rightGoToStage(nullptr), autoSaveTimer(nullptr), guiEnabled(true),
|
||||
gradationHeights(nullptr),
|
||||
|
@ -300,6 +298,44 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
menu->setAsDockMenu();
|
||||
#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();
|
||||
}
|
||||
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)));
|
||||
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->dockWidgetToolOptions->setVisible(isDockToolOptionsVisible);
|
||||
|
||||
ui->dockWidgetGroups->setWidget(detailsWidget);
|
||||
ui->dockWidgetGroups->setWindowTitle(tr("Details"));
|
||||
ui->dockWidgetGroups->setVisible(isDockGroupsVisible);
|
||||
ui->dockWidgetGroups->setToolTip(tr("Show which details will go in layout"));
|
||||
|
||||
ui->dockWidgetToolOptions->setVisible(isDockToolOptionsVisible);
|
||||
|
||||
m_statusLabel->setText(QString());
|
||||
}
|
||||
else
|
||||
|
@ -3101,6 +3146,7 @@ void MainWindow::Clear()
|
|||
ui->actionDecreaseLabelFont->setEnabled(false);
|
||||
ui->actionOriginalLabelFont->setEnabled(false);
|
||||
ui->actionHideLabels->setEnabled(false);
|
||||
ui->plainTextEditPatternMessages->clear();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -3921,6 +3967,10 @@ void MainWindow::ReadSettings()
|
|||
restoreState(settings->GetWindowState());
|
||||
restoreState(settings->GetToolbarsState(), APP_VERSION);
|
||||
|
||||
ui->dockWidgetGroups->setVisible(settings->IsDockWidgetGroupsActive());
|
||||
ui->dockWidgetToolOptions->setVisible(settings->IsDockWidgetToolOptionsActive());
|
||||
ui->dockWidgetMessages->setVisible(settings->IsDockWidgetPatternMessagesActive());
|
||||
|
||||
// Scene antialiasing
|
||||
ui->view->SetAntialiasing(settings->GetGraphicalOutput());
|
||||
|
||||
|
@ -3930,8 +3980,12 @@ void MainWindow::ReadSettings()
|
|||
// Text under tool buton icon
|
||||
ToolBarStyles();
|
||||
|
||||
isDockToolOptionsVisible = ui->dockWidgetToolOptions->isVisible();
|
||||
isDockGroupsVisible = ui->dockWidgetGroups->isVisible();
|
||||
isDockToolOptionsVisible = ui->dockWidgetToolOptions->isEnabled();
|
||||
isDockGroupsVisible = ui->dockWidgetGroups->isEnabled();
|
||||
|
||||
QFont f = ui->plainTextEditPatternMessages->font();
|
||||
f.setPointSize(settings->GetPatternMessageFontSize(f.pointSize()));
|
||||
ui->plainTextEditPatternMessages->setFont(f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3952,6 +4006,10 @@ void MainWindow::WriteSettings()
|
|||
settings->SetWindowState(saveState());
|
||||
settings->SetToolbarsState(saveState(APP_VERSION));
|
||||
|
||||
settings->SetDockWidgetGroupsActive(ui->dockWidgetGroups->isEnabled());
|
||||
settings->SetDockWidgetToolOptionsActive(ui->dockWidgetToolOptions->isEnabled());
|
||||
settings->SetDockWidgetPatternMessagesActive(ui->dockWidgetMessages->isEnabled());
|
||||
|
||||
settings->sync();
|
||||
if (settings->status() == QSettings::AccessError)
|
||||
{
|
||||
|
@ -4262,17 +4320,19 @@ void MainWindow::AddDocks()
|
|||
//Add dock
|
||||
actionDockWidgetToolOptions = ui->dockWidgetToolOptions->toggleViewAction();
|
||||
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();
|
||||
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);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
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. */
|
||||
qint32 currentToolBoxIndex;
|
||||
|
||||
bool isDockToolOptionsVisible;
|
||||
bool isDockGroupsVisible;
|
||||
bool isDockToolOptionsVisible{false};
|
||||
bool isDockGroupsVisible{false};
|
||||
|
||||
/** @brief drawMode true if we current draw scene. */
|
||||
bool drawMode;
|
||||
|
@ -378,6 +378,8 @@ private:
|
|||
void ToolSelectOperationObjects();
|
||||
void ToolSelectGroupObjects();
|
||||
void ToolSelectDetail();
|
||||
|
||||
void PrintPatternMessage(QEvent *event);
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1100</width>
|
||||
<height>709</height>
|
||||
<height>809</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -55,7 +55,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>140</width>
|
||||
<width>126</width>
|
||||
<height>282</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -481,7 +481,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>140</width>
|
||||
<width>126</width>
|
||||
<height>243</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -746,7 +746,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>140</width>
|
||||
<width>126</width>
|
||||
<height>282</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -1120,8 +1120,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>140</width>
|
||||
<height>331</height>
|
||||
<width>126</width>
|
||||
<height>192</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="icon">
|
||||
|
@ -1324,7 +1324,7 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>140</width>
|
||||
<width>126</width>
|
||||
<height>237</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -1590,7 +1590,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>140</width>
|
||||
<height>331</height>
|
||||
<height>163</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="icon">
|
||||
|
@ -2013,6 +2013,115 @@
|
|||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContents_2"/>
|
||||
</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">
|
||||
<property name="icon">
|
||||
<iconset theme="document-new">
|
||||
|
@ -2859,6 +2968,16 @@
|
|||
<extends>QGraphicsView</extends>
|
||||
<header>vmaingraphicsview.h</header>
|
||||
</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>
|
||||
<resources>
|
||||
<include location="share/resources/toolicon.qrc"/>
|
||||
|
|
|
@ -174,6 +174,7 @@ MainWindowsNoGUI::MainWindowsNoGUI(QWidget *parent)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
MainWindowsNoGUI::~MainWindowsNoGUI()
|
||||
{
|
||||
delete m_unreadPatternMessage;
|
||||
delete m_mouseCoordinate;
|
||||
delete tempSceneLayout;
|
||||
delete pattern;
|
||||
|
|
|
@ -122,6 +122,7 @@ protected:
|
|||
|
||||
/** @brief mouseCoordinate pointer to label who show mouse coordinate. */
|
||||
QPointer<QLabel> m_mouseCoordinate;
|
||||
QPointer<QLabel> m_unreadPatternMessage{};
|
||||
|
||||
#if defined(Q_OS_WIN32) && QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
|
||||
QWinTaskbarButton *m_taskbarButton;
|
||||
|
|
|
@ -1011,7 +1011,8 @@ QVector<QPointF> VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal wid
|
|||
if ( points.size() < 3 )
|
||||
{
|
||||
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>();
|
||||
}
|
||||
|
||||
|
|
|
@ -385,7 +385,8 @@ bool VBank::PrepareDetails()
|
|||
{
|
||||
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());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
}
|
||||
|
||||
const qreal d = details.at(i).Diagonal();
|
||||
|
|
|
@ -268,7 +268,8 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
|||
const QString errorMsg =
|
||||
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
||||
.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 =
|
||||
QObject::tr("Passmark '%1' is not part of piece '%2'.")
|
||||
.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.")
|
||||
.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());
|
||||
|
|
|
@ -31,9 +31,18 @@
|
|||
|
||||
#include <qcompilerdetection.h>
|
||||
#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
|
||||
const QEvent::Type UNDO_EVENT = static_cast<QEvent::Type>(QEvent::User + CustomEventType::UndoEventType);
|
||||
|
||||
|
@ -47,6 +56,7 @@ public:
|
|||
virtual ~UndoEvent() =default;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const QEvent::Type LITE_PARSE_EVENT = static_cast<QEvent::Type>(QEvent::User + CustomEventType::LiteParseEventType);
|
||||
|
||||
class LiteParseEvent : public QEvent
|
||||
|
@ -59,6 +69,7 @@ public:
|
|||
virtual ~LiteParseEvent() =default;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
const QEvent::Type FIT_BEST_CURRENT_EVENT = static_cast<QEvent::Type>(QEvent::User +
|
||||
CustomEventType::FitBestCurrentEventType);
|
||||
|
||||
|
@ -72,4 +83,38 @@ public:
|
|||
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
|
||||
|
||||
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/button.png</file>
|
||||
<file>icon/32x32/button@2x.png</file>
|
||||
<file>icon/16x16/broom.png</file>
|
||||
<file>icon/16x16/broom@2x.png</file>
|
||||
</qresource>
|
||||
</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 <Qt>
|
||||
#include <QtDebug>
|
||||
#include <QWidget>
|
||||
|
||||
#include "../vmisc/def.h"
|
||||
#include "../vmisc/customevents.h"
|
||||
|
||||
const QString VAbstractApplication::patternMessageSignature = QStringLiteral("[PATTERN MESSAGE]");
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractApplication::VAbstractApplication(int &argc, char **argv)
|
||||
|
@ -257,6 +261,18 @@ void VAbstractApplication::SetDrawMode(const Draw &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)
|
||||
void VAbstractApplication::WinAttachConsole()
|
||||
|
|
|
@ -124,6 +124,11 @@ public:
|
|||
const Draw &GetDrawMode() const;
|
||||
void SetDrawMode(const Draw &value);
|
||||
|
||||
void PostPatternMessage(const QString &message, QtMsgType severity) const;
|
||||
|
||||
static const QString patternMessageSignature;
|
||||
bool IsPatternMessage(const QString &message) const;
|
||||
|
||||
protected:
|
||||
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, 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, 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
|
||||
int scrollingDurationCached = -1;
|
||||
int scrollingUpdateIntervalCached = -1;
|
||||
|
@ -678,6 +686,87 @@ void VSettings::SetScrollingAcceleration(qreal acceleration)
|
|||
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>
|
||||
T VSettings::GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const
|
||||
|
|
|
@ -178,6 +178,23 @@ public:
|
|||
qreal GetScrollingAcceleration() const;
|
||||
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:
|
||||
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 "
|
||||
"than minimal allowed.")
|
||||
.arg(passmarkData.nodeName, passmarkData.pieceName);
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
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 "
|
||||
"than minimal allowed.")
|
||||
.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>();
|
||||
}
|
||||
}
|
||||
|
@ -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 "
|
||||
"seam allowance. User must manually provide length.")
|
||||
.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>();
|
||||
}
|
||||
}
|
||||
|
@ -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 "
|
||||
"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
|
||||
}
|
||||
|
||||
|
@ -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 "
|
||||
"position for a notch.")
|
||||
.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
|
||||
}
|
||||
|
||||
|
@ -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 "
|
||||
"notch position.")
|
||||
.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)
|
||||
|
@ -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 "
|
||||
"less than minimal allowed.")
|
||||
.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();
|
||||
}
|
||||
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 "
|
||||
"collapse.")
|
||||
.arg(m_data.nodeName, m_data.pieceName);
|
||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
}
|
||||
}
|
||||
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 "
|
||||
"intersection.")
|
||||
.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();
|
||||
|
@ -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 "
|
||||
"than minimal allowed.")
|
||||
.arg(m_data.nodeName, m_data.pieceName);
|
||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
}
|
||||
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'.")
|
||||
.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
|
||||
}
|
||||
|
||||
|
@ -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'.")
|
||||
.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
|
||||
}
|
||||
|
||||
|
@ -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'.")
|
||||
.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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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.")
|
||||
.arg(nodeName, formula.Reason());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
return -1;
|
||||
}
|
||||
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.")
|
||||
.arg(nodeName, formula.Reason());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
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.")
|
||||
.arg(nodeName, formula.Reason());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
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: ")
|
||||
.arg(nodeName, formula.Reason());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
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.")
|
||||
.arg(nodeName, formula.Reason());
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractApplication::patternMessageSignature + errorMsg;
|
||||
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 "
|
||||
"point with cutting countour")
|
||||
.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 "
|
||||
"point with cutting countour")
|
||||
.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"
|
||||
" through point '%3' with angle %4°")
|
||||
.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);
|
||||
|
|
|
@ -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 "
|
||||
"through point '%4' and angle %5°")
|
||||
.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);
|
||||
|
|
|
@ -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")
|
||||
.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);
|
||||
|
|
|
@ -130,7 +130,8 @@ VToolPointFromCircleAndTangent *VToolPointFromCircleAndTangent::Create(VToolPoin
|
|||
"from point '%4' cannot be found")
|
||||
.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);
|
||||
|
|
|
@ -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 "
|
||||
"intersection with line (%4;%5)")
|
||||
.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);
|
||||
|
|
|
@ -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")
|
||||
.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);
|
||||
|
|
|
@ -134,7 +134,8 @@ VToolPointOfIntersectionCircles::Create(VToolPointOfIntersectionCirclesInitData
|
|||
{
|
||||
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());
|
||||
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);
|
||||
|
|
|
@ -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")
|
||||
.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);
|
||||
|
|
|
@ -146,7 +146,8 @@ VToolTriangle* VToolTriangle::Create(VToolTriangleInitData initData)
|
|||
{
|
||||
const QString errorMsg = tr("Error calculating point '%1'. Point of intersection cannot be found")
|
||||
.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);
|
||||
|
|
|
@ -1342,7 +1342,8 @@ void VToolSeamAllowance::RefreshGeometry(bool updateChildren)
|
|||
{
|
||||
const QString errorMsg = QObject::tr("Piece '%1'. Seam allowance is not valid.")
|
||||
.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.setFillRule(Qt::OddEvenFill);
|
||||
|
|
|
@ -49,6 +49,50 @@ VPlainTextEdit::~VPlainTextEdit()
|
|||
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()
|
||||
{
|
||||
|
@ -182,3 +226,26 @@ void VPlainTextEdit::CreateParenthesisSelection(int pos, bool match)
|
|||
|
||||
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);
|
||||
virtual ~VPlainTextEdit();
|
||||
|
||||
void SetMatchParenthesesEnabled(bool enabled);
|
||||
|
||||
void SetFilter(const QString &filter);
|
||||
|
||||
void appendPlainText(const QString &text);
|
||||
|
||||
private slots:
|
||||
void MatchParentheses();
|
||||
|
||||
private:
|
||||
VHighlighter m_highlighter;
|
||||
QString m_filter{};
|
||||
QStringList m_allLines{};
|
||||
|
||||
bool MatchLeftParenthesis(QTextBlock currentBlock, int i, int numLeftParentheses);
|
||||
bool MatchRightParenthesis(QTextBlock currentBlock, int i, int numRightParentheses);
|
||||
void CreateParenthesisSelection(int pos, bool match = true);
|
||||
void Filter();
|
||||
};
|
||||
|
||||
#endif // VPLAINTEXTEDIT_H
|
||||
|
|
Loading…
Reference in New Issue
Block a user