GUI: Only enable the side filters in query language mode
This commit is contained in:
parent
03149a57b4
commit
77024d3f6a
@ -47,6 +47,14 @@ void RclMain::populateSideFilters(bool init)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RclMain::enableSideFilters(bool enable)
|
||||||
|
{
|
||||||
|
idxTreeView->setEnabled(enable);
|
||||||
|
dateFilterCB->setEnabled(enable);
|
||||||
|
minDateFilterDTEDT->setEnabled(enable && dateFilterCB->isChecked());
|
||||||
|
maxDateFilterDTEDT->setEnabled(enable && dateFilterCB->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
void RclMain::clearDirFilter()
|
void RclMain::clearDirFilter()
|
||||||
{
|
{
|
||||||
idxTreeView->clearSelection();
|
idxTreeView->clearSelection();
|
||||||
|
|||||||
@ -40,6 +40,20 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="layoutWidget">
|
<widget class="QWidget" name="layoutWidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayoutsidefilt">
|
<layout class="QVBoxLayout" name="verticalLayoutsidefilt">
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="sideFilterLBL">
|
||||||
|
<property name="text">
|
||||||
|
<string>Query Language Filters</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line2">
|
<widget class="Line" name="line2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|||||||
@ -177,6 +177,7 @@ void RclMain::init()
|
|||||||
|
|
||||||
connect(sSearch, SIGNAL(startSearch(std::shared_ptr<Rcl::SearchData>, bool)),
|
connect(sSearch, SIGNAL(startSearch(std::shared_ptr<Rcl::SearchData>, bool)),
|
||||||
this, SLOT(startSearch(std::shared_ptr<Rcl::SearchData>, bool)));
|
this, SLOT(startSearch(std::shared_ptr<Rcl::SearchData>, bool)));
|
||||||
|
connect(sSearch, SIGNAL(ssearchTypeChanged(int)), this, SLOT(onSSearchTypeChanged(int)));
|
||||||
connect(sSearch, SIGNAL(setDescription(QString)), this, SLOT(onSetDescription(QString)));
|
connect(sSearch, SIGNAL(setDescription(QString)), this, SLOT(onSetDescription(QString)));
|
||||||
connect(sSearch, SIGNAL(clearSearch()), this, SLOT(resetSearch()));
|
connect(sSearch, SIGNAL(clearSearch()), this, SLOT(resetSearch()));
|
||||||
connect(this, SIGNAL(uiPrefsChanged()), sSearch, SLOT(setPrefs()));
|
connect(this, SIGNAL(uiPrefsChanged()), sSearch, SLOT(setPrefs()));
|
||||||
@ -301,6 +302,11 @@ void RclMain::init()
|
|||||||
periodictimer->start(1000);
|
periodictimer->start(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RclMain::onSSearchTypeChanged(int typ)
|
||||||
|
{
|
||||||
|
enableSideFilters(typ == SSearch::SST_LANG);
|
||||||
|
}
|
||||||
|
|
||||||
void RclMain::zoomIn()
|
void RclMain::zoomIn()
|
||||||
{
|
{
|
||||||
prefs.reslistfontsize++;
|
prefs.reslistfontsize++;
|
||||||
@ -1220,7 +1226,9 @@ void RclMain::catgFilter(int id)
|
|||||||
void RclMain::setFiltSpec()
|
void RclMain::setFiltSpec()
|
||||||
{
|
{
|
||||||
m_filtspec.reset();
|
m_filtspec.reset();
|
||||||
|
if (nullptr == m_source)
|
||||||
|
return;
|
||||||
|
|
||||||
// "Category" buttons
|
// "Category" buttons
|
||||||
if (m_catgbutvecidx != 0) {
|
if (m_catgbutvecidx != 0) {
|
||||||
string catg = m_catgbutvec[m_catgbutvecidx];
|
string catg = m_catgbutvec[m_catgbutvecidx];
|
||||||
@ -1238,32 +1246,35 @@ void RclMain::setFiltSpec()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto treedirs = idxTreeGetDirs();
|
if (dateFilterCB->isEnabled()) {
|
||||||
if (!treedirs.empty()) {
|
// The CB is only disabled when we are not in query language mode
|
||||||
bool first{true};
|
auto treedirs = idxTreeGetDirs();
|
||||||
const std::string prefix{"dir:"};
|
if (!treedirs.empty()) {
|
||||||
std::string clause;
|
bool first{true};
|
||||||
for (const auto& dir : treedirs) {
|
const std::string prefix{"dir:"};
|
||||||
if (first) {
|
std::string clause;
|
||||||
first = false;
|
for (const auto& dir : treedirs) {
|
||||||
} else {
|
if (first) {
|
||||||
clause += " OR ";
|
first = false;
|
||||||
}
|
} else {
|
||||||
clause += prefix + makeCString(dir);
|
clause += " OR ";
|
||||||
|
}
|
||||||
|
clause += prefix + makeCString(dir);
|
||||||
|
}
|
||||||
|
LOGDEB0("Sidefilter dir clause: [" << clause << "]\n");
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
LOGDEB0("Sidefilter dir clause: [" << clause << "]\n");
|
|
||||||
m_filtspec.orCrit(DocSeqFiltSpec::DSFS_QLANG, clause);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dateFilterCB->isChecked()) {
|
m_source->setFiltSpec(m_filtspec);
|
||||||
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();
|
initiateQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -177,7 +177,9 @@ public slots:
|
|||||||
virtual void zoomIn();
|
virtual void zoomIn();
|
||||||
virtual void zoomOut();
|
virtual void zoomOut();
|
||||||
virtual void setFiltSpec();
|
virtual void setFiltSpec();
|
||||||
|
virtual void onSSearchTypeChanged(int);
|
||||||
|
virtual void enableSideFilters(bool enable);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
virtual bool updateIdxStatus();
|
virtual bool updateIdxStatus();
|
||||||
virtual void onWebcacheDestroyed(QObject *);
|
virtual void onWebcacheDestroyed(QObject *);
|
||||||
|
|||||||
@ -167,8 +167,7 @@ void SSearch::init()
|
|||||||
this, SLOT(searchTextEdited(const QString&)));
|
this, SLOT(searchTextEdited(const QString&)));
|
||||||
connect(clearqPB, SIGNAL(clicked()), queryText, SLOT(clear()));
|
connect(clearqPB, SIGNAL(clicked()), queryText, SLOT(clear()));
|
||||||
connect(searchPB, SIGNAL(clicked()), this, SLOT(startSimpleSearch()));
|
connect(searchPB, SIGNAL(clicked()), this, SLOT(startSimpleSearch()));
|
||||||
connect(searchTypCMB, SIGNAL(activated(int)), this,
|
connect(searchTypCMB, SIGNAL(activated(int)), this, SLOT(onSearchTypeChanged(int)));
|
||||||
SLOT(onSearchTypeChanged(int)));
|
|
||||||
|
|
||||||
m_completermodel = new RclCompleterModel(this);
|
m_completermodel = new RclCompleterModel(this);
|
||||||
m_completer = new QCompleter(m_completermodel, this);
|
m_completer = new QCompleter(m_completermodel, this);
|
||||||
@ -391,11 +390,9 @@ void SSearch::onSearchTypeChanged(int typ)
|
|||||||
|
|
||||||
// Adjust context help
|
// Adjust context help
|
||||||
if (typ == SST_LANG) {
|
if (typ == SST_LANG) {
|
||||||
HelpClient::installMap((const char *)this->objectName().toUtf8(),
|
HelpClient::installMap((const char *)this->objectName().toUtf8(), "RCL.SEARCH.LANG");
|
||||||
"RCL.SEARCH.LANG");
|
|
||||||
} else {
|
} else {
|
||||||
HelpClient::installMap((const char *)this->objectName().toUtf8(),
|
HelpClient::installMap((const char *)this->objectName().toUtf8(), "RCL.SEARCH.GUI.SIMPLE");
|
||||||
"RCL.SEARCH.GUI.SIMPLE");
|
|
||||||
}
|
}
|
||||||
// Also fix tooltips
|
// Also fix tooltips
|
||||||
switch (typ) {
|
switch (typ) {
|
||||||
@ -447,6 +444,7 @@ void SSearch::onSearchTypeChanged(int typ)
|
|||||||
default:
|
default:
|
||||||
queryText->setToolTip(tr("Enter search terms here."));
|
queryText->setToolTip(tr("Enter search terms here."));
|
||||||
}
|
}
|
||||||
|
emit ssearchTypeChanged(typ);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SSearch::startSimpleSearch()
|
void SSearch::startSimpleSearch()
|
||||||
|
|||||||
@ -112,7 +112,8 @@ signals:
|
|||||||
void setDescription(QString);
|
void setDescription(QString);
|
||||||
void clearSearch();
|
void clearSearch();
|
||||||
void partialWord(int, const QString& text, const QString &partial);
|
void partialWord(int, const QString& text, const QString &partial);
|
||||||
|
void ssearchTypeChanged(int typ);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int getPartialWord(QString& word);
|
int getPartialWord(QString& word);
|
||||||
bool startSimpleSearch(const string& q, int maxexp = -1);
|
bool startSimpleSearch(const string& q, int maxexp = -1);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user