Auto refresh the list with each parse.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2019-11-28 15:17:27 +02:00
parent 0c78511cfc
commit 866a801f38
7 changed files with 63 additions and 5 deletions

View File

@ -327,12 +327,19 @@ MainWindow::MainWindow(QWidget *parent)
ui->plainTextEditPatternMessages->SetFilter(text);
});
connect(ui->toolButtonClearMessages, &QToolButton::clicked, this, [this]()
connect(ui->toolButtonClearMessages, &QToolButton::clicked, this, &MainWindow::ClearPatternMessages);
ui->toolButtonAutoRefresh->setChecked(qApp->ValentinaSettings()->GetAutoRefreshPatternMessage());
connect(ui->toolButtonAutoRefresh, &QToolButton::clicked, this, [](bool checked)
{
ui->plainTextEditPatternMessages->clear();
if (not m_unreadPatternMessage.isNull())
qApp->ValentinaSettings()->SetAutoRefreshPatternMessage(checked);
});
connect(doc, &VPattern::PreParseState, this, [this]()
{
m_unreadPatternMessage->setText(QString());
if (ui->toolButtonAutoRefresh->isChecked())
{
ClearPatternMessages();
}
});
}
@ -3703,6 +3710,16 @@ void MainWindow::ShowProgress()
}
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClearPatternMessages()
{
ui->plainTextEditPatternMessages->clear();
if (not m_unreadPatternMessage.isNull())
{
m_unreadPatternMessage->setText(QString());
}
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::SetDefaultHeight()
{

View File

@ -205,6 +205,7 @@ private slots:
void ChangedHeight(const QString &text);
void ShowProgress();
void ClearPatternMessages();
private:
Q_DISABLE_COPY(MainWindow)

View File

@ -2041,6 +2041,25 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonAutoRefresh">
<property name="toolTip">
<string>Auto refresh the list with each parse</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="view-refresh"/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="VLineEdit" name="lineEditMessagesFilter">
<property name="sizePolicy">

View File

@ -167,6 +167,7 @@ void VPattern::Parse(const Document &parse)
break;
}
emit PreParseState();
m_parsing = true;
SCASSERT(sceneDraw != nullptr)
SCASSERT(sceneDetail != nullptr)

View File

@ -119,6 +119,9 @@ public:
int ElementsToParse() const;
signals:
void PreParseState();
public slots:
virtual void LiteParseTree(const Document &parse) override;

View File

@ -71,6 +71,8 @@ namespace
{
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationLabelLanguage,
(QLatin1String("configuration/label_language")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutoRefreshPatternMessage,
(QLatin1String("configuration/autoRefreshPatternMessage")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLayout, (QLatin1String("paths/layout")))
@ -767,6 +769,18 @@ void VSettings::SetPatternMessageFontSize(int size)
GetDefMaxPatternMessageFontSize()));
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetAutoRefreshPatternMessage() const
{
return value(*settingAutoRefreshPatternMessage, true).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetAutoRefreshPatternMessage(bool value)
{
setValue(*settingAutoRefreshPatternMessage, value);
}
//---------------------------------------------------------------------------------------------------------------------
template<typename T>
T VSettings::GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const

View File

@ -195,6 +195,9 @@ public:
static int GetDefMaxPatternMessageFontSize();
void SetPatternMessageFontSize(int size);
bool GetAutoRefreshPatternMessage() const;
void SetAutoRefreshPatternMessage(bool value);
private:
Q_DISABLE_COPY(VSettings)