GUI: added date filter tool in side bar
This commit is contained in:
parent
11865812a4
commit
03149a57b4
@ -24,14 +24,27 @@
|
||||
#include "idxmodel.h"
|
||||
#include "guiutils.h"
|
||||
|
||||
void RclMain::populateFilters()
|
||||
void RclMain::populateSideFilters(bool init)
|
||||
{
|
||||
m_idxtreemodel = new IdxTreeModel(theconfig, prefs.idxFilterTreeDepth, idxTreeView);
|
||||
m_idxtreemodel->populate();
|
||||
m_idxtreemodel->setHeaderData(0, Qt::Horizontal, QVariant(tr("Filter directories")));
|
||||
idxTreeView->setModel(m_idxtreemodel);
|
||||
idxTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
idxTreeView->setSelectionMode(QAbstractItemView::MultiSelection);
|
||||
if (init) {
|
||||
idxTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
idxTreeView->setSelectionMode(QAbstractItemView::MultiSelection);
|
||||
connect(idxTreeView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(setFiltSpec()));
|
||||
|
||||
minDateFilterDTEDT->setCalendarPopup(true);
|
||||
maxDateFilterDTEDT->setCalendarPopup(true);
|
||||
minDateFilterDTEDT->setDate(QDate::currentDate());
|
||||
maxDateFilterDTEDT->setDate(QDate::currentDate());
|
||||
connect(minDateFilterDTEDT, SIGNAL(dateChanged(const QDate &)), this, SLOT(setFiltSpec()));
|
||||
connect(maxDateFilterDTEDT, SIGNAL(dateChanged(const QDate &)), this, SLOT(setFiltSpec()));
|
||||
connect(dateFilterCB, SIGNAL(toggled(bool)), this, SLOT(setFiltSpec()));
|
||||
connect(dateFilterCB, SIGNAL(toggled(bool)), minDateFilterDTEDT, SLOT(setEnabled(bool)));
|
||||
connect(dateFilterCB, SIGNAL(toggled(bool)), maxDateFilterDTEDT, SLOT(setEnabled(bool)));
|
||||
}
|
||||
}
|
||||
|
||||
void RclMain::clearDirFilter()
|
||||
|
||||
@ -190,7 +190,7 @@ void RclMain::showIndexConfig(bool modal)
|
||||
if (created) {
|
||||
connect(new QShortcut(quitKeySeq, indexConfig->getDialog()),
|
||||
SIGNAL (activated()), this, SLOT (fileExit()));
|
||||
connect(indexConfig, SIGNAL(idxConfigPossiblyChanged()), this, SLOT(populateFilters()));
|
||||
connect(indexConfig, SIGNAL(idxConfigPossiblyChanged()), this, SLOT(populateSideFilters()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,48 @@
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QTreeView" name="idxTreeView"/>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayoutsidefilt">
|
||||
<item>
|
||||
<widget class="Line" name="line2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="dateFilterCB">
|
||||
<property name="text">
|
||||
<string>Filter dates</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="hLayoutDatesFilter">
|
||||
<item>
|
||||
<widget class="QDateEdit" name="minDateFilterDTEDT">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDateEdit" name="maxDateFilterDTEDT">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="idxTreeView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="ResList" name="reslist" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
|
||||
@ -289,8 +289,7 @@ void RclMain::init()
|
||||
sideFiltersSPLT->setSizes(sizes);
|
||||
}
|
||||
|
||||
populateFilters();
|
||||
connect(idxTreeView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(setFiltSpec()));
|
||||
populateSideFilters(true);
|
||||
|
||||
enableTrayIcon(prefs.showTrayIcon);
|
||||
|
||||
@ -1151,7 +1150,7 @@ void RclMain::setUIPrefs()
|
||||
return;
|
||||
LOGDEB("Recollmain::setUIPrefs\n");
|
||||
if (nullptr != m_idxtreemodel && m_idxtreemodel->getDepth() != prefs.idxFilterTreeDepth) {
|
||||
populateFilters();
|
||||
populateSideFilters();
|
||||
}
|
||||
emit uiPrefsChanged();
|
||||
enbSynAction->setDisabled(prefs.synFile.isEmpty());
|
||||
@ -1256,6 +1255,13 @@ void RclMain::setFiltSpec()
|
||||
m_filtspec.orCrit(DocSeqFiltSpec::DSFS_QLANG, clause);
|
||||
}
|
||||
|
||||
if (dateFilterCB->isChecked()) {
|
||||
QString mindate = minDateFilterDTEDT->date().toString("yyyy-MM-dd");
|
||||
QString maxdate = maxDateFilterDTEDT->date().toString("yyyy-MM-dd");
|
||||
std::string clause = std::string("date:") + qs2utf8s(mindate) + "/" + qs2utf8s(maxdate);
|
||||
LOGDEB1("RclMain::setFiltSpec: date clause " << clause << "\n");
|
||||
m_filtspec.orCrit(DocSeqFiltSpec::DSFS_QLANG, clause);
|
||||
}
|
||||
if (m_source)
|
||||
m_source->setFiltSpec(m_filtspec);
|
||||
initiateQuery();
|
||||
|
||||
@ -144,7 +144,7 @@ public slots:
|
||||
virtual void startNativeViewer(Rcl::Doc, int pagenum = -1, QString term = QString());
|
||||
virtual void openWith(Rcl::Doc, string);
|
||||
virtual void saveDocToFile(Rcl::Doc);
|
||||
virtual void populateFilters();
|
||||
virtual void populateSideFilters(bool init = false);
|
||||
virtual void previewNextInTab(Preview *, int sid, int docnum);
|
||||
virtual void previewPrevInTab(Preview *, int sid, int docnum);
|
||||
virtual void previewExposed(Preview *, int sid, int docnum);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user