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
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
/*
* This program is free software; you can redistribute it and/or modify
@ -74,13 +74,21 @@ static string dbdir;
static RclMainBase *mainWindow;
static string recollsharedir;
bool maybeOpenDb(string &reason)
bool maybeOpenDb(string &reason, bool force)
{
if (!rcldb) {
reason = "Internal error: db not created";
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 " +
dbdir + " wait for indexing to complete?";
return false;
@ -199,7 +207,7 @@ int main( int argc, char ** argv )
mainWindow, SLOT(periodic100()));
timer->start(100);
if (!rcldb->open(dbdir, Rcl::Db::DbRO)) {
if (!maybeOpenDb(reason)) {
startindexing = 1;
switch (QMessageBox::
question(0, "Recoll",

View File

@ -1,5 +1,5 @@
#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
/*
* 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;
}
// This could be handled inside the dialog's accept(), but we may want to
// do something (ie: redisplay reslist?)
// Called when the uiprefs dialog is ok'd
void RclMain::setUIPrefs()
{
if (!uiprefs)
return;
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()) {
QFont nfont(prefs.reslistfontfamily, prefs.reslistfontsize);
resList->setFont(nfont);
} else {
resList->setFont(this->font());
}
if (uiprefs->stemLangCMB->currentItem() == 0) {
prefs.queryStemLang = "";
} else {
prefs.queryStemLang = uiprefs->stemLangCMB->currentText();
}
}
void RclMain::enableNextPage(bool yesno)

View File

@ -1,6 +1,6 @@
#ifndef _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 "rclconfig.h"
@ -8,7 +8,7 @@
#include "idxthread.h"
// 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 Rcl::Db *rcldb;

View File

@ -22,236 +22,249 @@
<property name="name">
<cstring>unnamed</cstring>
</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">
<property name="name">
<cstring>layout5</cstring>
<cstring>Layout1</cstring>
</property>
<vbox>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QTabWidget">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<spacer>
<property name="name">
<cstring>tabWidget2</cstring>
<cstring>Horizontal Spacing2</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>
<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="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>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>
<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>
</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>
</vbox>
</widget>
@ -268,6 +281,12 @@
<receiver>uiPrefsDialog</receiver>
<slot>reject()</slot>
</connection>
<connection>
<sender>buildAbsCB</sender>
<signal>toggled(bool)</signal>
<receiver>replAbsCB</receiver>
<slot>setEnabled(bool)</slot>
</connection>
</connections>
<includes>
<include location="local" impldecl="in implementation">uiprefs.ui.h</include>

View File

@ -29,27 +29,20 @@ void UIPrefsDialog::init()
QString s;
if (prefs.reslistfontfamily.length() == 0) {
reslistFontPB->setText(this->font().family() + "-" +
s.setNum(this->font().pointSize()));
s.setNum(this->font().pointSize()));
} else {
reslistFontPB->setText(reslistFontFamily + "-" +
s.setNum(reslistFontSize));
s.setNum(reslistFontSize));
}
// Stemming language combobox
stemLangCMB->insertItem("(no stemming)");
list<string> langs;
#if 0
string slangs;
if (rclconfig->getConfParam("indexstemminglanguages", slangs)) {
stringToStrings(slangs, langs);
}
#else
string reason;
if (!maybeOpenDb(reason)) {
QMessageBox::critical(0, "Recoll", QString(reason.c_str()));
exit(1);
}
langs = rcldb->getStemLangs();
#endif
int i = 0, cur = -1;
for (list<string>::const_iterator it = langs.begin();
@ -64,7 +57,13 @@ void UIPrefsDialog::init()
}
if (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(resetFontPB, SIGNAL(clicked()), this, SLOT(resetReslistFont()));
@ -72,6 +71,23 @@ void UIPrefsDialog::init()
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();
QDialog::accept();
}