Add text search bar in History window. Closes #153

This commit is contained in:
Roman Telezhynskyi 2021-11-19 13:23:35 +02:00
parent d61eda4a41
commit 920e6fc8ab
4 changed files with 89 additions and 0 deletions

View File

@ -22,6 +22,7 @@
- Improve storing visibility group items. Don't store duplicate information.
- Remove tool from all visibility groups it in.
- Option to disable the automatic search for updates.
- [smart-pattern/valentina#153] To add text search bar in History window.
# Valentina 0.7.49 July 1, 2021
- Fix crash.

View File

@ -40,6 +40,7 @@
#include "../vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.h"
#include "../xml/vpattern.h"
#include "../vmisc/diagnostic.h"
#include "../vmisc/vtablesearch.h"
#include <QDebug>
#include <QtConcurrent>
@ -72,6 +73,22 @@ DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
connect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor);
connect(doc, &VPattern::patternChanged, this, &DialogHistory::UpdateHistory);
ShowPoint();
m_search = QSharedPointer<VTableSearch>(new VTableSearch(ui->tableWidget));
connect(ui->lineEditFind, &QLineEdit::textEdited, this, [this](const QString &term){m_search->Find(term);});
connect(ui->toolButtonFindPrevious, &QToolButton::clicked, this, [this](){m_search->FindPrevious();});
connect(ui->toolButtonFindNext, &QToolButton::clicked, this, [this](){m_search->FindNext();});
connect(m_search.data(), &VTableSearch::HasResult, this, [this] (bool state)
{
ui->toolButtonFindPrevious->setEnabled(state);
});
connect(m_search.data(), &VTableSearch::HasResult, this, [this] (bool state)
{
ui->toolButtonFindNext->setEnabled(state);
});
}
//---------------------------------------------------------------------------------------------------------------------
@ -158,6 +175,8 @@ void DialogHistory::UpdateHistory()
{
FillTable();
InitialTable();
m_search->RefreshList(ui->lineEditFind->text());
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -34,6 +34,7 @@
#include <QDomElement>
class VPattern;
class VTableSearch;
struct HistoryRecord
{
@ -90,6 +91,7 @@ private:
/** @brief cursorToolRecordRow save number of row selected record */
qint32 cursorToolRecordRow;
QSharedPointer<VTableSearch> m_search{};
void FillTable();
HistoryRecord Record(const VToolRecord &tool) const;

View File

@ -24,6 +24,73 @@
<locale language="English" country="UnitedStates"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="labelFind">
<property name="text">
<string>Find:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditFind">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Search measurements by term. &lt;/p&gt;&lt;p&gt;Prepend &amp;quot;/r/&amp;quot; to the front of the search string to search history records by regex.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="placeholderText">
<string>Search</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonFindPrevious">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Find Previous</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset theme="go-previous">
<normaloff>../../tape</normaloff>../../tape</iconset>
</property>
<property name="shortcut">
<string>Ctrl+Shift+G</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonFindNext">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Find Next</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset theme="go-next">
<normaloff>../../tape</normaloff>../../tape</iconset>
</property>
<property name="shortcut">
<string>Ctrl+G</string>
</property>
<property name="autoExclusive">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTableWidget" name="tableWidget">
<property name="alternatingRowColors">