GUI split advanced search dialog in 2 tabs and add/adjust date and size filtering
This commit is contained in:
parent
9ff88adf22
commit
382cdc9f8a
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>545</width>
|
||||
<height>537</height>
|
||||
<width>544</width>
|
||||
<height>441</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -16,7 +16,17 @@
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_5">
|
||||
<attribute name="title">
|
||||
<string>Find</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
@ -145,6 +155,63 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_6">
|
||||
<attribute name="title">
|
||||
<string>Filter</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="filterDatesCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Check this to enable filtering on dates</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Filter dates</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>From</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="minDateDTE">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>To</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="maxDateDTE">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line2">
|
||||
<property name="frameShape">
|
||||
@ -157,6 +224,22 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="filterSizesCB">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Check this to enable filtering on sizes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Filter sizes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelminsize">
|
||||
<property name="toolTip">
|
||||
@ -168,7 +251,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="minSizeLE"/>
|
||||
<widget class="QLineEdit" name="minSizeLE">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelmaxsize">
|
||||
@ -181,7 +268,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="maxSizeLE"/>
|
||||
<widget class="QLineEdit" name="maxSizeLE">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@ -195,6 +286,8 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
@ -376,6 +469,8 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line5">
|
||||
<property name="frameShape">
|
||||
@ -448,14 +543,10 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line1">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::HLine</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@ -62,6 +62,10 @@ void AdvSearch::init()
|
||||
// signals and slots connections
|
||||
connect(delFiltypPB, SIGNAL(clicked()), this, SLOT(delFiltypPB_clicked()));
|
||||
connect(searchPB, SIGNAL(clicked()), this, SLOT(runSearch()));
|
||||
connect(filterDatesCB, SIGNAL(toggled(bool)),
|
||||
this, SLOT(filterDatesCB_toggled(bool)));
|
||||
connect(filterSizesCB, SIGNAL(toggled(bool)),
|
||||
this, SLOT(filterSizesCB_toggled(bool)));
|
||||
connect(restrictFtCB, SIGNAL(toggled(bool)),
|
||||
this, SLOT(restrictFtCB_toggled(bool)));
|
||||
connect(restrictCtCB, SIGNAL(toggled(bool)),
|
||||
@ -101,6 +105,14 @@ void AdvSearch::init()
|
||||
}
|
||||
(*m_clauseWins.begin())->wordsLE->setFocus();
|
||||
|
||||
// Initialize min/max mtime from extrem values in the index
|
||||
int minyear, maxyear;
|
||||
if (rcldb) {
|
||||
rcldb->maxYearSpan(&minyear, &maxyear);
|
||||
minDateDTE->setDate(QDate(minyear, 1, 1));
|
||||
maxDateDTE->setDate(QDate(maxyear, 12, 31));
|
||||
}
|
||||
|
||||
// Initialize lists of accepted and ignored mime types from config
|
||||
// and settings
|
||||
m_ignTypes = prefs.asearchIgnFilTyps;
|
||||
@ -118,6 +130,10 @@ void AdvSearch::init()
|
||||
// don't want to see it.
|
||||
clauseline->close();
|
||||
|
||||
bool calpop = 0;
|
||||
minDateDTE->setCalendarPopup(calpop);
|
||||
maxDateDTE->setCalendarPopup(calpop);
|
||||
|
||||
// Translations for known categories
|
||||
cat_translations[QString::fromUtf8("texts")] = tr("texts");
|
||||
cat_rtranslations[tr("texts")] = QString::fromUtf8("texts");
|
||||
@ -248,6 +264,19 @@ void AdvSearch::restrictFtCB_toggled(bool on)
|
||||
saveFileTypesPB->setEnabled(on);
|
||||
}
|
||||
|
||||
// Activate file type selection
|
||||
void AdvSearch::filterSizesCB_toggled(bool on)
|
||||
{
|
||||
minSizeLE->setEnabled(on);
|
||||
maxSizeLE->setEnabled(on);
|
||||
}
|
||||
// Activate file type selection
|
||||
void AdvSearch::filterDatesCB_toggled(bool on)
|
||||
{
|
||||
minDateDTE->setEnabled(on);
|
||||
maxDateDTE->setEnabled(on);
|
||||
}
|
||||
|
||||
void AdvSearch::restrictCtCB_toggled(bool on)
|
||||
{
|
||||
m_ignByCats = on;
|
||||
@ -367,10 +396,24 @@ void AdvSearch::runSearch()
|
||||
}
|
||||
}
|
||||
|
||||
if (filterDatesCB->isChecked()) {
|
||||
QDate mindate = minDateDTE->date();
|
||||
QDate maxdate = maxDateDTE->date();
|
||||
DateInterval di;
|
||||
di.y1 = mindate.year();
|
||||
di.m1 = mindate.month();
|
||||
di.d1 = mindate.day();
|
||||
di.y2 = maxdate.year();
|
||||
di.m2 = maxdate.month();
|
||||
di.d2 = maxdate.day();
|
||||
sdata->setDateSpan(&di);
|
||||
}
|
||||
if (filterSizesCB->isChecked()) {
|
||||
size_t size = stringToSize(minSizeLE->text());
|
||||
sdata->setMinSize(size);
|
||||
size = stringToSize(maxSizeLE->text());
|
||||
sdata->setMaxSize(size);
|
||||
}
|
||||
|
||||
if (!subtreeCMB->currentText().isEmpty()) {
|
||||
QString current = subtreeCMB->currentText();
|
||||
|
||||
@ -48,6 +48,8 @@ public slots:
|
||||
virtual void addFiltypPB_clicked();
|
||||
virtual void addAFiltypPB_clicked();
|
||||
virtual void guiListsToIgnTypes();
|
||||
virtual void filterDatesCB_toggled(bool);
|
||||
virtual void filterSizesCB_toggled(bool);
|
||||
virtual void restrictFtCB_toggled(bool);
|
||||
virtual void restrictCtCB_toggled(bool);
|
||||
virtual void runSearch();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user