abstract params

This commit is contained in:
dockes 2006-01-26 14:02:01 +00:00
parent 6d419ce407
commit cb344d7493
5 changed files with 280 additions and 249 deletions

View File

@ -1,5 +1,5 @@
#ifndef lint #ifndef lint
static char rcsid[] = "@(#$Id: main.cpp,v 1.34 2006-01-23 13:32:05 dockes Exp $ (C) 2005 J.F.Dockes"; static char rcsid[] = "@(#$Id: main.cpp,v 1.35 2006-01-26 14:00:18 dockes Exp $ (C) 2005 J.F.Dockes";
#endif #endif
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -74,13 +74,21 @@ static string dbdir;
static RclMainBase *mainWindow; static RclMainBase *mainWindow;
static string recollsharedir; static string recollsharedir;
bool maybeOpenDb(string &reason) bool maybeOpenDb(string &reason, bool force)
{ {
if (!rcldb) { if (!rcldb) {
reason = "Internal error: db not created"; reason = "Internal error: db not created";
return false; return false;
} }
if (!rcldb->isopen() && !rcldb->open(dbdir, Rcl::Db::DbRO)) {
int qopts = 0;
if (prefs.queryBuildAbstract)
qopts |= Rcl::Db::QO_BUILD_ABSTRACT;
if (prefs.queryReplaceAbstract)
qopts |= Rcl::Db::QO_REPLACE_ABSTRACT;
if (force)
rcldb->close();
if (!rcldb->isopen() && !rcldb->open(dbdir, Rcl::Db::DbRO, qopts)) {
reason = "Could not open database in " + reason = "Could not open database in " +
dbdir + " wait for indexing to complete?"; dbdir + " wait for indexing to complete?";
return false; return false;
@ -199,7 +207,7 @@ int main( int argc, char ** argv )
mainWindow, SLOT(periodic100())); mainWindow, SLOT(periodic100()));
timer->start(100); timer->start(100);
if (!rcldb->open(dbdir, Rcl::Db::DbRO)) { if (!maybeOpenDb(reason)) {
startindexing = 1; startindexing = 1;
switch (QMessageBox:: switch (QMessageBox::
question(0, "Recoll", question(0, "Recoll",

View File

@ -1,5 +1,5 @@
#ifndef lint #ifndef lint
static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.8 2006-01-24 12:22:58 dockes Exp $ (C) 2005 J.F.Dockes"; static char rcsid[] = "@(#$Id: rclmain.cpp,v 1.9 2006-01-26 14:02:01 dockes Exp $ (C) 2005 J.F.Dockes";
#endif #endif
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -532,30 +532,18 @@ void RclMain::sortDataChanged(int cnt, RclSortSpec spec)
sortspecs = spec; sortspecs = spec;
} }
// This could be handled inside the dialog's accept(), but we may want to // Called when the uiprefs dialog is ok'd
// do something (ie: redisplay reslist?)
void RclMain::setUIPrefs() void RclMain::setUIPrefs()
{ {
if (!uiprefs) if (!uiprefs)
return; return;
LOGDEB(("Recollmain::setUIPrefs\n")); LOGDEB(("Recollmain::setUIPrefs\n"));
prefs.showicons = uiprefs->useIconsCB->isChecked();
prefs.respagesize = uiprefs->pageLenSB->value();
prefs.reslistfontfamily = uiprefs->reslistFontFamily;
prefs.reslistfontsize = uiprefs->reslistFontSize;
if (prefs.reslistfontfamily.length()) { if (prefs.reslistfontfamily.length()) {
QFont nfont(prefs.reslistfontfamily, prefs.reslistfontsize); QFont nfont(prefs.reslistfontfamily, prefs.reslistfontsize);
resList->setFont(nfont); resList->setFont(nfont);
} else { } else {
resList->setFont(this->font()); resList->setFont(this->font());
} }
if (uiprefs->stemLangCMB->currentItem() == 0) {
prefs.queryStemLang = "";
} else {
prefs.queryStemLang = uiprefs->stemLangCMB->currentText();
}
} }
void RclMain::enableNextPage(bool yesno) void RclMain::enableNextPage(bool yesno)

View File

@ -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.12 2006-01-23 13:32:06 dockes Exp $ (C) 2004 J.F.Dockes */ /* @(#$Id: recoll.h,v 1.13 2006-01-26 14:00:04 dockes Exp $ (C) 2004 J.F.Dockes */
#include <string> #include <string>
#include "rclconfig.h" #include "rclconfig.h"
@ -8,7 +8,7 @@
#include "idxthread.h" #include "idxthread.h"
// Misc declarations in need of sharing between the UI files // Misc declarations in need of sharing between the UI files
extern bool maybeOpenDb(std::string &reason); extern bool maybeOpenDb(std::string &reason, bool force = false);
extern RclConfig *rclconfig; extern RclConfig *rclconfig;
extern Rcl::Db *rcldb; extern Rcl::Db *rcldb;

View File

@ -22,236 +22,249 @@
<property name="name"> <property name="name">
<cstring>unnamed</cstring> <cstring>unnamed</cstring>
</property> </property>
<widget class="QTabWidget">
<property name="name">
<cstring>tabWidget2</cstring>
</property>
<widget class="QWidget">
<property name="name">
<cstring>tab</cstring>
</property>
<attribute name="title">
<string>User interface</string>
</attribute>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout4</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Number of entries in a result page</string>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>textLabel3</cstring>
</property>
<property name="text">
<string>Result list font</string>
</property>
</widget>
<widget class="QPushButton" row="1" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>reslistFontPB</cstring>
</property>
<property name="text">
<string>Helvetica-10</string>
</property>
<property name="toolTip" stdset="0">
<string>Opens a dialog to select the result list font</string>
</property>
</widget>
<widget class="QSpinBox" row="0" column="2" rowspan="1" colspan="2">
<property name="name">
<cstring>pageLenSB</cstring>
</property>
<property name="minValue">
<number>1</number>
</property>
<property name="value">
<number>8</number>
</property>
</widget>
<widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="4">
<property name="name">
<cstring>useIconsCB</cstring>
</property>
<property name="text">
<string>Show document type icons in result list</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" row="1" column="3">
<property name="name">
<cstring>resetFontPB</cstring>
</property>
<property name="text">
<string>Reset</string>
</property>
<property name="toolTip" stdset="0">
<string>Resets the result list font to the system default</string>
</property>
</widget>
</grid>
</widget>
</vbox>
</widget>
<widget class="QWidget">
<property name="name">
<cstring>tab</cstring>
</property>
<attribute name="title">
<string>Search parameters</string>
</attribute>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout7</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout6</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel1_2</cstring>
</property>
<property name="text">
<string>Stemming language</string>
</property>
</widget>
<widget class="QComboBox">
<property name="name">
<cstring>stemLangCMB</cstring>
</property>
</widget>
</hbox>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>buildAbsCB</cstring>
</property>
<property name="text">
<string>Dynamically build abstracts</string>
</property>
<property name="toolTip" stdset="0">
<string>Do we try to build abstracts for result list entries by using the context of query terms ?
May be slow for big documents.</string>
</property>
</widget>
<widget class="QCheckBox">
<property name="name">
<cstring>replAbsCB</cstring>
</property>
<property name="text">
<string>Replace abstracts from documents</string>
</property>
<property name="toolTip" stdset="0">
<string>Do we synthetize an abstract even if the document seemed to have one?</string>
</property>
</widget>
<spacer>
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>70</height>
</size>
</property>
</spacer>
</vbox>
</widget>
</vbox>
</widget>
</widget>
<widget class="QLayoutWidget"> <widget class="QLayoutWidget">
<property name="name"> <property name="name">
<cstring>layout5</cstring> <cstring>Layout1</cstring>
</property> </property>
<vbox> <hbox>
<property name="name"> <property name="name">
<cstring>unnamed</cstring> <cstring>unnamed</cstring>
</property> </property>
<widget class="QTabWidget"> <property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<spacer>
<property name="name"> <property name="name">
<cstring>tabWidget2</cstring> <cstring>Horizontal Spacing2</cstring>
</property> </property>
<widget class="QWidget"> <property name="orientation">
<property name="name"> <enum>Horizontal</enum>
<cstring>tab</cstring> </property>
</property> <property name="sizeType">
<attribute name="title"> <enum>Expanding</enum>
<string>User interface</string> </property>
</attribute> <property name="sizeHint">
<vbox> <size>
<property name="name"> <width>20</width>
<cstring>unnamed</cstring> <height>20</height>
</property> </size>
<widget class="QLayoutWidget"> </property>
<property name="name"> </spacer>
<cstring>layout4</cstring> <widget class="QPushButton">
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Number of entries in a result page</string>
</property>
</widget>
<widget class="QLabel" row="1" column="0">
<property name="name">
<cstring>textLabel3</cstring>
</property>
<property name="text">
<string>Result list font</string>
</property>
</widget>
<widget class="QPushButton" row="1" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>reslistFontPB</cstring>
</property>
<property name="text">
<string>Helvetica-10</string>
</property>
<property name="toolTip" stdset="0">
<string>Opens a dialog to select the result list font</string>
</property>
</widget>
<widget class="QSpinBox" row="0" column="2" rowspan="1" colspan="2">
<property name="name">
<cstring>pageLenSB</cstring>
</property>
<property name="minValue">
<number>1</number>
</property>
<property name="value">
<number>8</number>
</property>
</widget>
<widget class="QCheckBox" row="2" column="0" rowspan="1" colspan="4">
<property name="name">
<cstring>useIconsCB</cstring>
</property>
<property name="text">
<string>Show document type icons in result list</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" row="1" column="3">
<property name="name">
<cstring>resetFontPB</cstring>
</property>
<property name="text">
<string>Reset</string>
</property>
<property name="toolTip" stdset="0">
<string>Resets the result list font to the system default</string>
</property>
</widget>
</grid>
</widget>
</vbox>
</widget>
<widget class="QWidget">
<property name="name">
<cstring>tab</cstring>
</property>
<attribute name="title">
<string>Search parameters</string>
</attribute>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout7</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout6</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel1_2</cstring>
</property>
<property name="text">
<string>Stemming language</string>
</property>
</widget>
<widget class="QComboBox">
<property name="name">
<cstring>stemLangCMB</cstring>
</property>
</widget>
</hbox>
</widget>
<spacer>
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</vbox>
</widget>
</vbox>
</widget>
</widget>
<widget class="QLayoutWidget">
<property name="name"> <property name="name">
<cstring>Layout1</cstring> <cstring>buttonOk</cstring>
</property>
<property name="text">
<string>&amp;OK</string>
</property>
<property name="accel">
<string></string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
<property name="toolTip" stdset="0">
<string>Apply changes</string>
</property> </property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<spacer>
<property name="name">
<cstring>Horizontal Spacing2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>buttonOk</cstring>
</property>
<property name="text">
<string>&amp;OK</string>
</property>
<property name="accel">
<string></string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
<property name="toolTip" stdset="0">
<string>Apply changes</string>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>buttonCancel</cstring>
</property>
<property name="text">
<string>&amp;Cancel</string>
</property>
<property name="accel">
<string></string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="toolTip" stdset="0">
<string>Discard changes</string>
</property>
</widget>
</hbox>
</widget> </widget>
</vbox> <widget class="QPushButton">
<property name="name">
<cstring>buttonCancel</cstring>
</property>
<property name="text">
<string>&amp;Cancel</string>
</property>
<property name="accel">
<string></string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="toolTip" stdset="0">
<string>Discard changes</string>
</property>
</widget>
</hbox>
</widget> </widget>
</vbox> </vbox>
</widget> </widget>
@ -268,6 +281,12 @@
<receiver>uiPrefsDialog</receiver> <receiver>uiPrefsDialog</receiver>
<slot>reject()</slot> <slot>reject()</slot>
</connection> </connection>
<connection>
<sender>buildAbsCB</sender>
<signal>toggled(bool)</signal>
<receiver>replAbsCB</receiver>
<slot>setEnabled(bool)</slot>
</connection>
</connections> </connections>
<includes> <includes>
<include location="local" impldecl="in implementation">uiprefs.ui.h</include> <include location="local" impldecl="in implementation">uiprefs.ui.h</include>

View File

@ -29,27 +29,20 @@ void UIPrefsDialog::init()
QString s; QString s;
if (prefs.reslistfontfamily.length() == 0) { if (prefs.reslistfontfamily.length() == 0) {
reslistFontPB->setText(this->font().family() + "-" + reslistFontPB->setText(this->font().family() + "-" +
s.setNum(this->font().pointSize())); s.setNum(this->font().pointSize()));
} else { } else {
reslistFontPB->setText(reslistFontFamily + "-" + reslistFontPB->setText(reslistFontFamily + "-" +
s.setNum(reslistFontSize)); s.setNum(reslistFontSize));
} }
// Stemming language combobox // Stemming language combobox
stemLangCMB->insertItem("(no stemming)"); stemLangCMB->insertItem("(no stemming)");
list<string> langs; list<string> langs;
#if 0
string slangs;
if (rclconfig->getConfParam("indexstemminglanguages", slangs)) {
stringToStrings(slangs, langs);
}
#else
string reason; string reason;
if (!maybeOpenDb(reason)) { if (!maybeOpenDb(reason)) {
QMessageBox::critical(0, "Recoll", QString(reason.c_str())); QMessageBox::critical(0, "Recoll", QString(reason.c_str()));
exit(1); exit(1);
} }
langs = rcldb->getStemLangs(); langs = rcldb->getStemLangs();
#endif
int i = 0, cur = -1; int i = 0, cur = -1;
for (list<string>::const_iterator it = langs.begin(); for (list<string>::const_iterator it = langs.begin();
@ -64,7 +57,13 @@ void UIPrefsDialog::init()
} }
if (cur < 0) if (cur < 0)
cur = 0; cur = 0;
stemLangCMB->setCurrentItem(cur); stemLangCMB->setCurrentItem(cur);
buildAbsCB->setDown(prefs.queryBuildAbstract);
if (!prefs.queryBuildAbstract) {
replAbsCB->setEnabled(false);
}
replAbsCB->setDown(prefs.queryReplaceAbstract);
connect(reslistFontPB, SIGNAL(clicked()), this, SLOT(showFontDialog())); connect(reslistFontPB, SIGNAL(clicked()), this, SLOT(showFontDialog()));
connect(resetFontPB, SIGNAL(clicked()), this, SLOT(resetReslistFont())); connect(resetFontPB, SIGNAL(clicked()), this, SLOT(resetReslistFont()));
@ -72,6 +71,23 @@ void UIPrefsDialog::init()
void UIPrefsDialog::accept() void UIPrefsDialog::accept()
{ {
prefs.showicons = useIconsCB->isChecked();
prefs.respagesize = pageLenSB->value();
prefs.reslistfontfamily = reslistFontFamily;
prefs.reslistfontsize = reslistFontSize;
if (stemLangCMB->currentItem() == 0) {
prefs.queryStemLang = "";
} else {
prefs.queryStemLang = stemLangCMB->currentText();
}
prefs.queryBuildAbstract = buildAbsCB->isChecked();
prefs.queryReplaceAbstract = buildAbsCB->isChecked() &&
replAbsCB->isChecked();
rwSettings(true);
string reason;
maybeOpenDb(reason, true);
emit uiprefsDone(); emit uiprefsDone();
QDialog::accept(); QDialog::accept();
} }