From cb344d7493661ac5baa6fffaab37beaaec1baa1e Mon Sep 17 00:00:00 2001 From: dockes Date: Thu, 26 Jan 2006 14:02:01 +0000 Subject: [PATCH] abstract params --- src/qtgui/main.cpp | 16 +- src/qtgui/rclmain.cpp | 16 +- src/qtgui/recoll.h | 4 +- src/qtgui/uiprefs.ui | 457 +++++++++++++++++++++-------------------- src/qtgui/uiprefs.ui.h | 36 +++- 5 files changed, 280 insertions(+), 249 deletions(-) diff --git a/src/qtgui/main.cpp b/src/qtgui/main.cpp index 086f028c..1988c8a7 100644 --- a/src/qtgui/main.cpp +++ b/src/qtgui/main.cpp @@ -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", diff --git a/src/qtgui/rclmain.cpp b/src/qtgui/rclmain.cpp index aead4697..1b73c915 100644 --- a/src/qtgui/rclmain.cpp +++ b/src/qtgui/rclmain.cpp @@ -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) diff --git a/src/qtgui/recoll.h b/src/qtgui/recoll.h index 73e042fd..27b41e74 100644 --- a/src/qtgui/recoll.h +++ b/src/qtgui/recoll.h @@ -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 #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; diff --git a/src/qtgui/uiprefs.ui b/src/qtgui/uiprefs.ui index 9d3eb72d..e6ec58b8 100644 --- a/src/qtgui/uiprefs.ui +++ b/src/qtgui/uiprefs.ui @@ -22,236 +22,249 @@ unnamed + + + tabWidget2 + + + + tab + + + User interface + + + + unnamed + + + + layout4 + + + + unnamed + + + + textLabel1 + + + Number of entries in a result page + + + + + textLabel3 + + + Result list font + + + + + reslistFontPB + + + Helvetica-10 + + + Opens a dialog to select the result list font + + + + + pageLenSB + + + 1 + + + 8 + + + + + useIconsCB + + + Show document type icons in result list + + + true + + + + + resetFontPB + + + Reset + + + Resets the result list font to the system default + + + + + + + + + tab + + + Search parameters + + + + unnamed + + + + layout7 + + + + unnamed + + + + layout6 + + + + unnamed + + + + textLabel1_2 + + + Stemming language + + + + + stemLangCMB + + + + + + + buildAbsCB + + + Dynamically build abstracts + + + Do we try to build abstracts for result list entries by using the context of query terms ? +May be slow for big documents. + + + + + replAbsCB + + + Replace abstracts from documents + + + Do we synthetize an abstract even if the document seemed to have one? + + + + + spacer2 + + + Vertical + + + Expanding + + + + 20 + 70 + + + + + + + + - layout5 + Layout1 - + unnamed - + + 0 + + + 6 + + - tabWidget2 + Horizontal Spacing2 - - - tab - - - User interface - - - - unnamed - - - - layout4 - - - - unnamed - - - - textLabel1 - - - Number of entries in a result page - - - - - textLabel3 - - - Result list font - - - - - reslistFontPB - - - Helvetica-10 - - - Opens a dialog to select the result list font - - - - - pageLenSB - - - 1 - - - 8 - - - - - useIconsCB - - - Show document type icons in result list - - - true - - - - - resetFontPB - - - Reset - - - Resets the result list font to the system default - - - - - - - - - tab - - - Search parameters - - - - unnamed - - - - layout7 - - - - unnamed - - - - layout6 - - - - unnamed - - - - textLabel1_2 - - - Stemming language - - - - - stemLangCMB - - - - - - - spacer2 - - - Vertical - - - Expanding - - - - 20 - 40 - - - - - - - - - + + Horizontal + + + Expanding + + + + 20 + 20 + + + + - Layout1 + buttonOk + + + &OK + + + + + + true + + + true + + + Apply changes - - - unnamed - - - 0 - - - 6 - - - - Horizontal Spacing2 - - - Horizontal - - - Expanding - - - - 20 - 20 - - - - - - buttonOk - - - &OK - - - - - - true - - - true - - - Apply changes - - - - - buttonCancel - - - &Cancel - - - - - - true - - - Discard changes - - - - + + + buttonCancel + + + &Cancel + + + + + + true + + + Discard changes + + + @@ -268,6 +281,12 @@ uiPrefsDialog reject() + + buildAbsCB + toggled(bool) + replAbsCB + setEnabled(bool) + uiprefs.ui.h diff --git a/src/qtgui/uiprefs.ui.h b/src/qtgui/uiprefs.ui.h index 7e30460d..7c982bbc 100644 --- a/src/qtgui/uiprefs.ui.h +++ b/src/qtgui/uiprefs.ui.h @@ -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 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::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(); }