*** empty log message ***
This commit is contained in:
parent
e859f6a71c
commit
1c0971daad
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: main.cpp,v 1.24 2005-12-14 16:15:39 dockes Exp $ (C) 2005 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: main.cpp,v 1.25 2005-12-15 13:41:10 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -45,20 +45,13 @@ bool prefs_showicons;
|
|||||||
int prefs_respagesize = 8;
|
int prefs_respagesize = 8;
|
||||||
QString prefs_reslistfontfamily;
|
QString prefs_reslistfontfamily;
|
||||||
int prefs_reslistfontsize;
|
int prefs_reslistfontsize;
|
||||||
|
QString prefs_queryStemLang;
|
||||||
|
int prefs_mainwidth;
|
||||||
|
int prefs_mainheight;
|
||||||
|
bool prefs_ssall;
|
||||||
|
|
||||||
static string dbdir;
|
static string dbdir;
|
||||||
|
|
||||||
void getQueryStemming(bool &dostem, std::string &stemlang)
|
|
||||||
{
|
|
||||||
string param;
|
|
||||||
if (rclconfig->getConfParam("querystemming", param))
|
|
||||||
dostem = stringToBool(param);
|
|
||||||
else
|
|
||||||
dostem = false;
|
|
||||||
if (!rclconfig->getConfParam("querystemminglanguage", stemlang))
|
|
||||||
stemlang = "english";
|
|
||||||
}
|
|
||||||
|
|
||||||
bool maybeOpenDb(string &reason)
|
bool maybeOpenDb(string &reason)
|
||||||
{
|
{
|
||||||
if (!rcldb) {
|
if (!rcldb) {
|
||||||
@ -75,27 +68,60 @@ bool maybeOpenDb(string &reason)
|
|||||||
|
|
||||||
RecollMain *mainWindow;
|
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()
|
||||||
{
|
{
|
||||||
QSettings settings;
|
saveSettings();
|
||||||
if (mainWindow) {
|
|
||||||
int width = mainWindow->width();
|
|
||||||
int height = mainWindow->height();
|
|
||||||
settings.setPath("Recoll.org", "Recoll");
|
|
||||||
settings.writeEntry( "/Recoll/geometry/width", width);
|
|
||||||
settings.writeEntry("/Recoll/geometry/height", height);
|
|
||||||
settings.writeEntry("/Recoll/prefs/simpleSearchAll",
|
|
||||||
mainWindow->allTermsCB->isChecked());
|
|
||||||
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);;
|
|
||||||
}
|
|
||||||
|
|
||||||
stop_idxthread();
|
stop_idxthread();
|
||||||
delete rcldb;
|
delete rcldb;
|
||||||
rcldb = 0;
|
rcldb = 0;
|
||||||
@ -127,28 +153,14 @@ int main( int argc, char ** argv )
|
|||||||
qt.load( QString( "qt_" ) + QTextCodec::locale(), "." );
|
qt.load( QString( "qt_" ) + QTextCodec::locale(), "." );
|
||||||
a.installTranslator( &qt );
|
a.installTranslator( &qt );
|
||||||
|
|
||||||
// Restore some settings from previous session
|
readSettings();
|
||||||
QSettings settings;
|
|
||||||
settings.setPath("Recoll.org", "Recoll");
|
|
||||||
int width = settings.readNumEntry("/Recoll/geometry/width", 590);
|
|
||||||
int height = settings.readNumEntry("/Recoll/geometry/height", 810);
|
|
||||||
bool ssall = settings.readBoolEntry("/Recoll/prefs/simpleSearchAll", 0);
|
|
||||||
QSize s(width, height);
|
|
||||||
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);;
|
|
||||||
|
|
||||||
|
|
||||||
// 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);
|
||||||
w.resize(s);
|
w.resize(s);
|
||||||
w.allTermsCB->setDown(ssall);
|
w.allTermsCB->setChecked(prefs_ssall);
|
||||||
string reason;
|
string reason;
|
||||||
rclconfig = recollinit(recollCleanup, sigcleanup, reason);
|
rclconfig = recollinit(recollCleanup, sigcleanup, reason);
|
||||||
if (!rclconfig || !rclconfig->ok()) {
|
if (!rclconfig || !rclconfig->ok()) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user