user prefs tweaks. Allow switching stemlang from ui
This commit is contained in:
parent
1c0971daad
commit
89d287dbe7
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: main.cpp,v 1.25 2005-12-15 13:41:10 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: main.cpp,v 1.26 2005-12-15 14:39:57 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -37,6 +37,8 @@ int recollNeedsExit;
|
|||||||
string tmpdir;
|
string tmpdir;
|
||||||
string iconsdir;
|
string iconsdir;
|
||||||
RclDHistory *history;
|
RclDHistory *history;
|
||||||
|
static string dbdir;
|
||||||
|
static RecollMain *mainWindow;
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// Global variables for user preferences. These are set in the user preference
|
// Global variables for user preferences. These are set in the user preference
|
||||||
@ -50,7 +52,38 @@ int prefs_mainwidth;
|
|||||||
int prefs_mainheight;
|
int prefs_mainheight;
|
||||||
bool prefs_ssall;
|
bool prefs_ssall;
|
||||||
|
|
||||||
static string dbdir;
|
#define SETTING_RW(var, nm, tp, def) \
|
||||||
|
if (writing) { \
|
||||||
|
settings.writeEntry(nm , var); \
|
||||||
|
} else { \
|
||||||
|
var = settings.read##tp##Entry(nm, def); \
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rwSettings(bool writing)
|
||||||
|
{
|
||||||
|
if (writing) {
|
||||||
|
if (!mainWindow)
|
||||||
|
return;
|
||||||
|
prefs_mainwidth = mainWindow->width();
|
||||||
|
prefs_mainheight = mainWindow->height();
|
||||||
|
prefs_ssall = mainWindow->allTermsCB->isChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
QSettings settings;
|
||||||
|
settings.setPath("Recoll.org", "Recoll");
|
||||||
|
|
||||||
|
SETTING_RW(prefs_mainwidth, "/Recoll/geometry/width", Num, 590);
|
||||||
|
SETTING_RW(prefs_mainheight, "/Recoll/geometry/height", Num, 810);
|
||||||
|
SETTING_RW(prefs_ssall, "/Recoll/prefs/simpleSearchAll", Bool, false);
|
||||||
|
SETTING_RW(prefs_showicons, "/Recoll/prefs/reslist/showicons", Bool, true);
|
||||||
|
SETTING_RW(prefs_respagesize, "/Recoll/prefs/reslist/pagelen", Num, 8);
|
||||||
|
SETTING_RW(prefs_reslistfontfamily, "/Recoll/prefs/reslist/fontFamily", ,
|
||||||
|
"");
|
||||||
|
SETTING_RW(prefs_reslistfontsize, "/Recoll/prefs/reslist/fontSize", Num,
|
||||||
|
0);
|
||||||
|
SETTING_RW(prefs_queryStemLang, "/Recoll/prefs/query/stemLang", ,
|
||||||
|
"english");
|
||||||
|
}
|
||||||
|
|
||||||
bool maybeOpenDb(string &reason)
|
bool maybeOpenDb(string &reason)
|
||||||
{
|
{
|
||||||
@ -66,62 +99,9 @@ bool maybeOpenDb(string &reason)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
RecollMain *mainWindow;
|
|
||||||
|
|
||||||
#define SETTING_RW(var, nm, tp, def) { \
|
|
||||||
if (writing) { \
|
|
||||||
settings.writeEntry(#nm , var); \
|
|
||||||
} else { \
|
|
||||||
var = settings.read##tp(#nm, def) \
|
|
||||||
}
|
|
||||||
|
|
||||||
static void saveSettings()
|
|
||||||
{
|
|
||||||
if (!mainWindow)
|
|
||||||
return;
|
|
||||||
prefs_mainwidth = mainWindow->width();
|
|
||||||
prefs_mainheight = mainWindow->height();
|
|
||||||
prefs_ssall = mainWindow->allTermsCB->isChecked();
|
|
||||||
|
|
||||||
QSettings settings;
|
|
||||||
settings.setPath("Recoll.org", "Recoll");
|
|
||||||
|
|
||||||
settings.writeEntry("/Recoll/geometry/width", prefs_mainwidth);
|
|
||||||
settings.writeEntry("/Recoll/geometry/height", prefs_mainheight);
|
|
||||||
settings.writeEntry("/Recoll/prefs/simpleSearchAll", prefs_ssall);
|
|
||||||
settings.writeEntry("/Recoll/prefs/reslist/showicons", prefs_showicons);
|
|
||||||
settings.writeEntry("/Recoll/prefs/reslist/pagelen", prefs_respagesize);
|
|
||||||
settings.writeEntry("/Recoll/prefs/reslist/fontFamily",
|
|
||||||
prefs_reslistfontfamily);
|
|
||||||
settings.writeEntry("/Recoll/prefs/reslist/fontSize",
|
|
||||||
prefs_reslistfontsize);;
|
|
||||||
settings.writeEntry("/Recoll/prefs/query/stemLang", prefs_queryStemLang);;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void readSettings()
|
|
||||||
{
|
|
||||||
// Restore some settings from previous session
|
|
||||||
QSettings settings;
|
|
||||||
settings.setPath("Recoll.org", "Recoll");
|
|
||||||
|
|
||||||
prefs_mainwidth = settings.readNumEntry("/Recoll/geometry/width", 590);
|
|
||||||
prefs_mainheight = settings.readNumEntry("/Recoll/geometry/height", 810);
|
|
||||||
prefs_ssall = settings.readBoolEntry("/Recoll/prefs/simpleSearchAll", 0);
|
|
||||||
prefs_showicons =
|
|
||||||
settings.readBoolEntry("/Recoll/prefs/reslist/showicons", true);
|
|
||||||
prefs_respagesize =
|
|
||||||
settings.readNumEntry("/Recoll/prefs/reslist/pagelen", 8);
|
|
||||||
prefs_reslistfontfamily =
|
|
||||||
settings.readEntry("/Recoll/prefs/reslist/fontFamily", "");
|
|
||||||
prefs_reslistfontsize =
|
|
||||||
settings.readNumEntry("/Recoll/prefs/reslist/fontSize", 0);;
|
|
||||||
prefs_queryStemLang =
|
|
||||||
settings.readEntry("/Recoll/prefs/query/stemLang", "english");
|
|
||||||
}
|
|
||||||
|
|
||||||
void recollCleanup()
|
void recollCleanup()
|
||||||
{
|
{
|
||||||
saveSettings();
|
rwSettings(true);
|
||||||
stop_idxthread();
|
stop_idxthread();
|
||||||
delete rcldb;
|
delete rcldb;
|
||||||
rcldb = 0;
|
rcldb = 0;
|
||||||
@ -153,11 +133,12 @@ int main( int argc, char ** argv )
|
|||||||
qt.load( QString( "qt_" ) + QTextCodec::locale(), "." );
|
qt.load( QString( "qt_" ) + QTextCodec::locale(), "." );
|
||||||
a.installTranslator( &qt );
|
a.installTranslator( &qt );
|
||||||
|
|
||||||
readSettings();
|
rwSettings(false);
|
||||||
|
|
||||||
// Create main window and set its size to previous session's
|
// Create main window and set its size to previous session's
|
||||||
RecollMain w;
|
RecollMain w;
|
||||||
mainWindow = &w;
|
mainWindow = &w;
|
||||||
|
|
||||||
QSize s(prefs_mainwidth, prefs_mainheight);
|
QSize s(prefs_mainwidth, prefs_mainheight);
|
||||||
w.resize(s);
|
w.resize(s);
|
||||||
w.allTermsCB->setChecked(prefs_ssall);
|
w.allTermsCB->setChecked(prefs_ssall);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#ifndef _RECOLL_H_INCLUDED_
|
#ifndef _RECOLL_H_INCLUDED_
|
||||||
#define _RECOLL_H_INCLUDED_
|
#define _RECOLL_H_INCLUDED_
|
||||||
/* @(#$Id: recoll.h,v 1.8 2005-12-14 16:15:39 dockes Exp $ (C) 2004 J.F.Dockes */
|
/* @(#$Id: recoll.h,v 1.9 2005-12-15 14:39:57 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
// Misc declarations in need of sharing between the UI files
|
// Misc declarations in need of sharing between the UI files
|
||||||
extern void recollCleanup();
|
extern void recollCleanup();
|
||||||
extern void getQueryStemming(bool &dostem, std::string &stemlang);
|
|
||||||
extern bool maybeOpenDb(std::string &reason);
|
extern bool maybeOpenDb(std::string &reason);
|
||||||
|
|
||||||
extern RclConfig *rclconfig;
|
extern RclConfig *rclconfig;
|
||||||
@ -27,6 +26,6 @@ extern bool prefs_showicons;
|
|||||||
extern int prefs_respagesize;
|
extern int prefs_respagesize;
|
||||||
extern QString prefs_reslistfontfamily;
|
extern QString prefs_reslistfontfamily;
|
||||||
extern int prefs_reslistfontsize;
|
extern int prefs_reslistfontsize;
|
||||||
|
extern QString prefs_queryStemLang;
|
||||||
|
|
||||||
#endif /* _RECOLL_H_INCLUDED_ */
|
#endif /* _RECOLL_H_INCLUDED_ */
|
||||||
|
|||||||
@ -169,7 +169,7 @@
|
|||||||
<action name="toolsSort_parametersAction"/>
|
<action name="toolsSort_parametersAction"/>
|
||||||
</item>
|
</item>
|
||||||
<item text="&Preferences" name="Preferences">
|
<item text="&Preferences" name="Preferences">
|
||||||
<action name="preferencesUser_InterfaceAction"/>
|
<action name="preferencesQuery_PrefsAction"/>
|
||||||
</item>
|
</item>
|
||||||
<separator/>
|
<separator/>
|
||||||
<item text="&Help" name="Help">
|
<item text="&Help" name="Help">
|
||||||
@ -329,13 +329,13 @@
|
|||||||
</action>
|
</action>
|
||||||
<action>
|
<action>
|
||||||
<property name="name">
|
<property name="name">
|
||||||
<cstring>preferencesUser_InterfaceAction</cstring>
|
<cstring>preferencesQuery_PrefsAction</cstring>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&User Interface</string>
|
<string>&Query configuration</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="menuText">
|
<property name="menuText">
|
||||||
<string>&User Interface</string>
|
<string>&Query configuration</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</actions>
|
</actions>
|
||||||
@ -425,7 +425,7 @@
|
|||||||
<slot>showResultPage()</slot>
|
<slot>showResultPage()</slot>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>preferencesUser_InterfaceAction</sender>
|
<sender>preferencesQuery_PrefsAction</sender>
|
||||||
<signal>activated()</signal>
|
<signal>activated()</signal>
|
||||||
<receiver>RecollMain</receiver>
|
<receiver>RecollMain</receiver>
|
||||||
<slot>showUIPrefs()</slot>
|
<slot>showUIPrefs()</slot>
|
||||||
@ -448,8 +448,6 @@
|
|||||||
<variable>int reslist_car;</variable>
|
<variable>int reslist_car;</variable>
|
||||||
<variable>bool reslist_waitingdbl;</variable>
|
<variable>bool reslist_waitingdbl;</variable>
|
||||||
<variable>bool reslist_dblclck;</variable>
|
<variable>bool reslist_dblclck;</variable>
|
||||||
<variable>bool dostem;</variable>
|
|
||||||
<variable>std::string stemlang;</variable>
|
|
||||||
<variable>Preview *curPreview;</variable>
|
<variable>Preview *curPreview;</variable>
|
||||||
<variable>advsearch *asearchform;</variable>
|
<variable>advsearch *asearchform;</variable>
|
||||||
<variable>SortForm *sortform;</variable>
|
<variable>SortForm *sortform;</variable>
|
||||||
|
|||||||
@ -32,6 +32,7 @@ using std::pair;
|
|||||||
#include <qcheckbox.h>
|
#include <qcheckbox.h>
|
||||||
#include <qfontdialog.h>
|
#include <qfontdialog.h>
|
||||||
#include <qspinbox.h>
|
#include <qspinbox.h>
|
||||||
|
#include <qcombobox.h>
|
||||||
|
|
||||||
#include "recoll.h"
|
#include "recoll.h"
|
||||||
#include "debuglog.h"
|
#include "debuglog.h"
|
||||||
@ -59,7 +60,6 @@ void RecollMain::init()
|
|||||||
reslist_car = -1;
|
reslist_car = -1;
|
||||||
reslist_waitingdbl = false;
|
reslist_waitingdbl = false;
|
||||||
reslist_dblclck = false;
|
reslist_dblclck = false;
|
||||||
dostem = false;
|
|
||||||
curPreview = 0;
|
curPreview = 0;
|
||||||
asearchform = 0;
|
asearchform = 0;
|
||||||
sortform = 0;
|
sortform = 0;
|
||||||
@ -377,13 +377,12 @@ void RecollMain::startAdvSearch(Rcl::AdvSearchData sdata)
|
|||||||
QMessageBox::critical(0, "Recoll", QString(reason.c_str()));
|
QMessageBox::critical(0, "Recoll", QString(reason.c_str()));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (stemlang.empty())
|
|
||||||
getQueryStemming(dostem, stemlang);
|
|
||||||
|
|
||||||
reslist_winfirst = -1;
|
reslist_winfirst = -1;
|
||||||
|
|
||||||
if (!rcldb->setQuery(sdata, dostem ?
|
if (!rcldb->setQuery(sdata, prefs_queryStemLang.length() > 0 ?
|
||||||
Rcl::Db::QO_STEM : Rcl::Db::QO_NONE, stemlang))
|
Rcl::Db::QO_STEM : Rcl::Db::QO_NONE,
|
||||||
|
prefs_queryStemLang.ascii()))
|
||||||
return;
|
return;
|
||||||
curPreview = 0;
|
curPreview = 0;
|
||||||
if (docsource)
|
if (docsource)
|
||||||
@ -591,7 +590,9 @@ void RecollMain::showResultPage()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (reslist_winfirst >= 0 && (reslist_winfirst + prefs_respagesize >= resCnt)) {
|
if (reslist_winfirst < 0 ||
|
||||||
|
(reslist_winfirst >= 0 &&
|
||||||
|
reslist_winfirst + prefs_respagesize >= resCnt)) {
|
||||||
nextPageAction->setEnabled(false);
|
nextPageAction->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
nextPageAction->setEnabled(true);
|
nextPageAction->setEnabled(true);
|
||||||
@ -823,15 +824,19 @@ void RecollMain::setUIPrefs()
|
|||||||
LOGDEB(("Recollmain::setUIPrefs\n"));
|
LOGDEB(("Recollmain::setUIPrefs\n"));
|
||||||
prefs_showicons = uiprefs->useIconsCB->isChecked();
|
prefs_showicons = uiprefs->useIconsCB->isChecked();
|
||||||
prefs_respagesize = uiprefs->pageLenSB->value();
|
prefs_respagesize = uiprefs->pageLenSB->value();
|
||||||
|
|
||||||
prefs_reslistfontfamily = uiprefs->reslistFontFamily;
|
prefs_reslistfontfamily = uiprefs->reslistFontFamily;
|
||||||
prefs_reslistfontsize = uiprefs->reslistFontSize;
|
prefs_reslistfontsize = uiprefs->reslistFontSize;
|
||||||
|
|
||||||
if (prefs_reslistfontfamily.length()) {
|
if (prefs_reslistfontfamily.length()) {
|
||||||
QFont nfont(prefs_reslistfontfamily, prefs_reslistfontsize);
|
QFont nfont(prefs_reslistfontfamily, prefs_reslistfontsize);
|
||||||
reslistTE->setFont(nfont);
|
reslistTE->setFont(nfont);
|
||||||
} else {
|
} else {
|
||||||
reslistTE->setFont(this->font());
|
reslistTE->setFont(this->font());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (uiprefs->stemLangCMB->currentItem() == 0) {
|
||||||
|
prefs_queryStemLang = "";
|
||||||
|
} else {
|
||||||
|
prefs_queryStemLang = uiprefs->stemLangCMB->currentText();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,17 @@
|
|||||||
# @(#$Id: recoll.conf.in,v 1.4 2005-12-02 16:17:29 dockes Exp $ (C) 2004 J.F.Dockes
|
# @(#$Id: recoll.conf.in,v 1.5 2005-12-15 14:39:58 dockes Exp $ (C) 2004 J.F.Dockes
|
||||||
|
#
|
||||||
# Recoll default configuration file. This should be copied to
|
# Recoll default configuration file. This should be copied to
|
||||||
# ~/.recoll/recoll.conf
|
# ~/.recoll/recoll.conf
|
||||||
|
|
||||||
# Space-separated list of directories to index. Next line indexes $HOME
|
# Space-separated list of directories to index. Next line indexes $HOME
|
||||||
topdirs = ~
|
topdirs = ~
|
||||||
|
|
||||||
# Wildcard expressions for names of files and directories that we should
|
# Wildcard expressions for names of files and directories that we should
|
||||||
# ignore:
|
# ignore. If you need index mozilla/thunderbird mail folders, don't put
|
||||||
skippedNames = *~ #* .* bin CVS Cache caughtspam tmp
|
# ".*" in there (as was the case with an older sample config)
|
||||||
|
skippedNames = *~ #* bin CVS Cache caughtspam tmp
|
||||||
|
|
||||||
# Debug messages
|
# Debug messages. 4 is quite verbose. 3 would be errors only.
|
||||||
loglevel = 4
|
loglevel = 4
|
||||||
logfilename = stderr
|
logfilename = stderr
|
||||||
|
|
||||||
@ -19,24 +20,17 @@ logfilename = stderr
|
|||||||
filtersdir = @prefix@/share/recoll/filters
|
filtersdir = @prefix@/share/recoll/filters
|
||||||
|
|
||||||
# Languages for which to build stemming databases at the end of
|
# Languages for which to build stemming databases at the end of
|
||||||
# indexing. Stemmer names can be found on the xapian site
|
# indexing. Stemmer names can be found on http://www.xapian.org
|
||||||
|
# The flag to perform stem expansion at query time is now set from the GUI
|
||||||
indexstemminglanguages = english french
|
indexstemminglanguages = english french
|
||||||
|
|
||||||
# Use stemming of query terms or not (ie: expand search for floors to
|
# Name of the file suffix to mime-type map file.
|
||||||
# floor, flooring, etc... )
|
|
||||||
querystemming = 1
|
|
||||||
querystemminglanguage = english
|
|
||||||
|
|
||||||
# Name of file suffix to mime-type map file.
|
|
||||||
mimemapfile = mimemap
|
mimemapfile = mimemap
|
||||||
# Name of mime-type to filter type/name map file.
|
# Name of the mime-type to filter type/name map file.
|
||||||
mimeconffile = mimeconf
|
mimeconffile = mimeconf
|
||||||
|
|
||||||
# Decide if we do show icons in the result list. This looks a bit more
|
# The only reason to change this would be if you want to change the icons
|
||||||
# beaglish, but I'm not quite sure it's useful. If you wish to have them,
|
# displayed in the result list
|
||||||
# you will have to copy the pngs from the distribution to wherever you want
|
|
||||||
# to store them (the associations are decided in mimeconf)
|
|
||||||
showicons = 1
|
|
||||||
iconsdir = @prefix@/share/recoll/images
|
iconsdir = @prefix@/share/recoll/images
|
||||||
|
|
||||||
# Where to store the database.
|
# Where to store the database.
|
||||||
@ -44,8 +38,10 @@ dbdir = ~/.recoll/xapiandb
|
|||||||
|
|
||||||
# Default character set. Values found inside files, ie content tag in html
|
# Default character set. Values found inside files, ie content tag in html
|
||||||
# documents, will override this. It can be specified per directory (see
|
# documents, will override this. It can be specified per directory (see
|
||||||
# below). Used when converting to utf-8 (internal storage format).
|
# below). Used when converting to utf-8 (internal storage format), so it
|
||||||
|
# may be quite important for pure text files.
|
||||||
defaultcharset = iso-8859-1
|
defaultcharset = iso-8859-1
|
||||||
|
# defaultlanguage is currently not used by the program.
|
||||||
defaultlanguage = english
|
defaultlanguage = english
|
||||||
|
|
||||||
# Guessing charsets usually does not work well
|
# Guessing charsets usually does not work well
|
||||||
@ -56,7 +52,6 @@ guesscharset = 0
|
|||||||
# indexation of many bogus 'text' files
|
# indexation of many bogus 'text' files
|
||||||
usesystemfilecommand = 1
|
usesystemfilecommand = 1
|
||||||
|
|
||||||
# You could specify different parameters for a subdirectory like this.
|
# You could specify different parameters for a subdirectory like this:
|
||||||
#[~/englishdocs/plain]
|
#[~/hungariandocs/plain]
|
||||||
#defaultcharset = iso-8859-2
|
#defaultcharset = iso-8859-2
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user