GUI: enable synonyms in preferences and query
This commit is contained in:
parent
183c6d312c
commit
a724c76967
@ -202,6 +202,10 @@ void rwSettings(bool writing)
|
|||||||
SETTING_RW(prefs.autoSuffsEnable,
|
SETTING_RW(prefs.autoSuffsEnable,
|
||||||
"/Recoll/prefs/query/autoSuffsEnable", Bool, false);
|
"/Recoll/prefs/query/autoSuffsEnable", Bool, false);
|
||||||
|
|
||||||
|
SETTING_RW(prefs.synFileEnable,
|
||||||
|
"/Recoll/prefs/query/synFileEnable", Bool, false);
|
||||||
|
SETTING_RW(prefs.synFile, "/Recoll/prefs/query/synfile", String, "");
|
||||||
|
|
||||||
SETTING_RW(prefs.termMatchType, "/Recoll/prefs/query/termMatchType",
|
SETTING_RW(prefs.termMatchType, "/Recoll/prefs/query/termMatchType",
|
||||||
Int, 0);
|
Int, 0);
|
||||||
// This is not really the current program version, just a value to
|
// This is not really the current program version, just a value to
|
||||||
|
|||||||
@ -115,6 +115,9 @@ class PrefsPack {
|
|||||||
// language entry.
|
// language entry.
|
||||||
QString autoSuffs;
|
QString autoSuffs;
|
||||||
bool autoSuffsEnable;
|
bool autoSuffsEnable;
|
||||||
|
// Synonyms file
|
||||||
|
QString synFile;
|
||||||
|
bool synFileEnable;
|
||||||
|
|
||||||
QStringList restableFields;
|
QStringList restableFields;
|
||||||
vector<int> restableColWidths;
|
vector<int> restableColWidths;
|
||||||
|
|||||||
@ -109,6 +109,8 @@
|
|||||||
<addaction name="queryPrefsAction"/>
|
<addaction name="queryPrefsAction"/>
|
||||||
<addaction name="extIdxAction"/>
|
<addaction name="extIdxAction"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
<addaction name="enbSynAction"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="helpMenu">
|
<widget class="QMenu" name="helpMenu">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -346,7 +348,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="indexScheduleAction">
|
<action name="indexScheduleAction">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Indexing schedule</string>
|
<string>Indexing &schedule</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="name" stdset="0">
|
<property name="name" stdset="0">
|
||||||
<cstring>indexScheduleAction</cstring>
|
<cstring>indexScheduleAction</cstring>
|
||||||
@ -371,6 +373,20 @@
|
|||||||
<cstring>extIdxAction</cstring>
|
<cstring>extIdxAction</cstring>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="enbSynAction">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable synonyms</string>
|
||||||
|
</property>
|
||||||
|
<property name="iconText">
|
||||||
|
<string>Enable synonyms</string>
|
||||||
|
</property>
|
||||||
|
<property name="name" stdset="0">
|
||||||
|
<cstring>enbSynAction</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
<action name="toggleFullScreenAction">
|
<action name="toggleFullScreenAction">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Full Screen</string>
|
<string>&Full Screen</string>
|
||||||
|
|||||||
@ -153,6 +153,9 @@ void RclMain::init()
|
|||||||
// Set the focus to the search terms entry:
|
// Set the focus to the search terms entry:
|
||||||
sSearch->queryText->setFocus();
|
sSearch->queryText->setFocus();
|
||||||
|
|
||||||
|
enbSynAction->setDisabled(prefs.synFile.isEmpty());
|
||||||
|
enbSynAction->setChecked(prefs.synFileEnable);
|
||||||
|
|
||||||
// Stemming language menu
|
// Stemming language menu
|
||||||
g_stringNoStem = tr("(no stemming)");
|
g_stringNoStem = tr("(no stemming)");
|
||||||
g_stringAllStem = tr("(all languages)");
|
g_stringAllStem = tr("(all languages)");
|
||||||
@ -341,6 +344,8 @@ void RclMain::init()
|
|||||||
this, SLOT(showUIPrefs()));
|
this, SLOT(showUIPrefs()));
|
||||||
connect(extIdxAction, SIGNAL(triggered()),
|
connect(extIdxAction, SIGNAL(triggered()),
|
||||||
this, SLOT(showExtIdxDialog()));
|
this, SLOT(showExtIdxDialog()));
|
||||||
|
connect(enbSynAction, SIGNAL(toggled(bool)),
|
||||||
|
this, SLOT(setSynEnabled(bool)));
|
||||||
|
|
||||||
connect(toggleFullScreenAction, SIGNAL(triggered()),
|
connect(toggleFullScreenAction, SIGNAL(triggered()),
|
||||||
this, SLOT(toggleFullScreen()));
|
this, SLOT(toggleFullScreen()));
|
||||||
@ -459,6 +464,13 @@ void RclMain::init()
|
|||||||
periodictimer->start(1000);
|
periodictimer->start(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RclMain::setSynEnabled(bool on)
|
||||||
|
{
|
||||||
|
prefs.synFileEnable = on;
|
||||||
|
if (uiprefs)
|
||||||
|
uiprefs->synFileCB->setChecked(prefs.synFileEnable);
|
||||||
|
}
|
||||||
|
|
||||||
void RclMain::resultCount(int n)
|
void RclMain::resultCount(int n)
|
||||||
{
|
{
|
||||||
actionSortByDateAsc->setEnabled(n>0);
|
actionSortByDateAsc->setEnabled(n>0);
|
||||||
@ -679,6 +691,17 @@ void RclMain::startSearch(STD_SHARED_PTR<Rcl::SearchData> sdata, bool issimple)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prefs.synFileEnable && !prefs.synFile.isEmpty()) {
|
||||||
|
string sf = (const char *)prefs.synFile.toLocal8Bit();
|
||||||
|
if (!rcldb->setSynGroupsFile(sf)) {
|
||||||
|
QMessageBox::warning(0, "Recoll",
|
||||||
|
tr("Can't set synonyms file (parse error?)"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rcldb->setSynGroupsFile("");
|
||||||
|
}
|
||||||
|
|
||||||
Rcl::Query *query = new Rcl::Query(rcldb);
|
Rcl::Query *query = new Rcl::Query(rcldb);
|
||||||
query->setCollapseDuplicates(prefs.collapseDuplicates);
|
query->setCollapseDuplicates(prefs.collapseDuplicates);
|
||||||
|
|
||||||
@ -1014,6 +1037,8 @@ void RclMain::setUIPrefs()
|
|||||||
LOGDEB(("Recollmain::setUIPrefs\n"));
|
LOGDEB(("Recollmain::setUIPrefs\n"));
|
||||||
reslist->setFont();
|
reslist->setFont();
|
||||||
sSearch->setPrefs();
|
sSearch->setPrefs();
|
||||||
|
enbSynAction->setDisabled(prefs.synFile.isEmpty());
|
||||||
|
enbSynAction->setChecked(prefs.synFileEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RclMain::enableNextPage(bool yesno)
|
void RclMain::enableNextPage(bool yesno)
|
||||||
|
|||||||
@ -130,6 +130,7 @@ public slots:
|
|||||||
virtual void startManual(const string&);
|
virtual void startManual(const string&);
|
||||||
virtual void showDocHistory();
|
virtual void showDocHistory();
|
||||||
virtual void showExtIdxDialog();
|
virtual void showExtIdxDialog();
|
||||||
|
virtual void setSynEnabled(bool);
|
||||||
virtual void showUIPrefs();
|
virtual void showUIPrefs();
|
||||||
virtual void showIndexConfig();
|
virtual void showIndexConfig();
|
||||||
virtual void execIndexConfig();
|
virtual void execIndexConfig();
|
||||||
|
|||||||
@ -778,6 +778,56 @@ May be slow for big documents.</string>
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line3">
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::HLine</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Sunken</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="textLabelSG">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Synonyms file</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="synFileCB">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="synFilePB">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>30</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Choose</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="spacer2">
|
<spacer name="spacer2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|||||||
@ -45,7 +45,6 @@
|
|||||||
|
|
||||||
#include "recoll.h"
|
#include "recoll.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include "rcldb.h"
|
|
||||||
#include "rclconfig.h"
|
#include "rclconfig.h"
|
||||||
#include "pathut.h"
|
#include "pathut.h"
|
||||||
#include "uiprefs_w.h"
|
#include "uiprefs_w.h"
|
||||||
@ -73,6 +72,7 @@ void UIPrefsDialog::init()
|
|||||||
connect(stylesheetPB, SIGNAL(clicked()),this, SLOT(showStylesheetDialog()));
|
connect(stylesheetPB, SIGNAL(clicked()),this, SLOT(showStylesheetDialog()));
|
||||||
connect(resetSSPB, SIGNAL(clicked()), this, SLOT(resetStylesheet()));
|
connect(resetSSPB, SIGNAL(clicked()), this, SLOT(resetStylesheet()));
|
||||||
connect(snipCssPB, SIGNAL(clicked()),this, SLOT(showSnipCssDialog()));
|
connect(snipCssPB, SIGNAL(clicked()),this, SLOT(showSnipCssDialog()));
|
||||||
|
connect(synFilePB, SIGNAL(clicked()),this, SLOT(showSynFileDialog()));
|
||||||
connect(resetSnipCssPB, SIGNAL(clicked()), this, SLOT(resetSnipCss()));
|
connect(resetSnipCssPB, SIGNAL(clicked()), this, SLOT(resetSnipCss()));
|
||||||
|
|
||||||
connect(idxLV, SIGNAL(itemSelectionChanged()),
|
connect(idxLV, SIGNAL(itemSelectionChanged()),
|
||||||
@ -214,6 +214,15 @@ void UIPrefsDialog::setFromPrefs()
|
|||||||
autoSuffsCB->setChecked(prefs.autoSuffsEnable);
|
autoSuffsCB->setChecked(prefs.autoSuffsEnable);
|
||||||
autoSuffsLE->setText(prefs.autoSuffs);
|
autoSuffsLE->setText(prefs.autoSuffs);
|
||||||
|
|
||||||
|
synFileCB->setChecked(prefs.synFileEnable);
|
||||||
|
synFile = prefs.synFile;
|
||||||
|
if (synFile.isEmpty()) {
|
||||||
|
synFilePB->setText(tr("Choose"));
|
||||||
|
} else {
|
||||||
|
string nm = path_getsimple((const char *)synFile.toLocal8Bit());
|
||||||
|
synFilePB->setText(QString::fromLocal8Bit(nm.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize the extra indexes listboxes
|
// Initialize the extra indexes listboxes
|
||||||
idxLV->clear();
|
idxLV->clear();
|
||||||
for (list<string>::iterator it = prefs.allExtraDbs.begin();
|
for (list<string>::iterator it = prefs.allExtraDbs.begin();
|
||||||
@ -326,10 +335,12 @@ void UIPrefsDialog::accept()
|
|||||||
prefs.syntAbsLen = syntlenSB->value();
|
prefs.syntAbsLen = syntlenSB->value();
|
||||||
prefs.syntAbsCtx = syntctxSB->value();
|
prefs.syntAbsCtx = syntctxSB->value();
|
||||||
|
|
||||||
|
|
||||||
prefs.autoSuffsEnable = autoSuffsCB->isChecked();
|
prefs.autoSuffsEnable = autoSuffsCB->isChecked();
|
||||||
prefs.autoSuffs = autoSuffsLE->text();
|
prefs.autoSuffs = autoSuffsLE->text();
|
||||||
|
|
||||||
|
prefs.synFileEnable = synFileCB->isChecked();
|
||||||
|
prefs.synFile = synFile;
|
||||||
|
|
||||||
prefs.allExtraDbs.clear();
|
prefs.allExtraDbs.clear();
|
||||||
prefs.activeExtraDbs.clear();
|
prefs.activeExtraDbs.clear();
|
||||||
for (int i = 0; i < idxLV->count(); i++) {
|
for (int i = 0; i < idxLV->count(); i++) {
|
||||||
@ -441,6 +452,15 @@ void UIPrefsDialog::resetSnipCss()
|
|||||||
snipCssPB->setText(tr("Choose"));
|
snipCssPB->setText(tr("Choose"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UIPrefsDialog::showSynFileDialog()
|
||||||
|
{
|
||||||
|
synFile = myGetFileName(false, "Select synonyms file", true);
|
||||||
|
if (synFile.isEmpty())
|
||||||
|
return;
|
||||||
|
string nm = path_getsimple((const char *)synFile.toLocal8Bit());
|
||||||
|
synFilePB->setText(QString::fromLocal8Bit(nm.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
void UIPrefsDialog::resetReslistFont()
|
void UIPrefsDialog::resetReslistFont()
|
||||||
{
|
{
|
||||||
reslistFontFamily = "";
|
reslistFontFamily = "";
|
||||||
|
|||||||
@ -42,6 +42,7 @@ public:
|
|||||||
int reslistFontSize;
|
int reslistFontSize;
|
||||||
QString qssFile;
|
QString qssFile;
|
||||||
QString snipCssFile;
|
QString snipCssFile;
|
||||||
|
QString synFile;
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
|
|
||||||
@ -49,6 +50,7 @@ public slots:
|
|||||||
virtual void showFontDialog();
|
virtual void showFontDialog();
|
||||||
virtual void resetReslistFont();
|
virtual void resetReslistFont();
|
||||||
virtual void showStylesheetDialog();
|
virtual void showStylesheetDialog();
|
||||||
|
virtual void showSynFileDialog();
|
||||||
virtual void showSnipCssDialog();
|
virtual void showSnipCssDialog();
|
||||||
virtual void resetStylesheet();
|
virtual void resetStylesheet();
|
||||||
virtual void resetSnipCss();
|
virtual void resetSnipCss();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user