allow setting query term highlight color in prefs

This commit is contained in:
dockes 2008-05-05 20:28:34 +00:00
parent 2494ac6b50
commit 9f12b2df5e
7 changed files with 55 additions and 8 deletions

View File

@ -24,7 +24,7 @@
Dockes</holder>
</copyright>
<releaseinfo>$Id: usermanual.sgml,v 1.60 2008-01-17 11:13:47 dockes Exp $</releaseinfo>
<releaseinfo>$Id: usermanual.sgml,v 1.61 2008-05-05 20:28:34 dockes Exp $</releaseinfo>
<abstract>
<para>This document introduces full text search notions
@ -1337,6 +1337,15 @@ fvwm
page</guilabel></para>
</listitem>
<listitem><para><guilabel>Highlight color for query
terms</guilabel>
Terms from the user query are highlighted in the result
list samples and the preview window. The color can be
chosen here. Any QT color string should work
(ie <literal>red</literal>, <literal>#ff0000</literal>). The
default is <literal>blue</literal>.</para>
</listitem>
<listitem><para><guilabel>Result list font</guilabel>: There
is quite a lot of information shown in the result list, and
you may want to customize the font and/or font size. The rest

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.35 2007-09-08 17:25:49 dockes Exp $ (C) 2005 Jean-Francois Dockes";
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.36 2008-05-05 20:24:55 dockes Exp $ (C) 2005 Jean-Francois Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -186,6 +186,10 @@ void rwSettings(bool writing)
"/Recoll/prefs/ssearchAutoPhrase", Bool, false);
SETTING_RW(prefs.respagesize, "/Recoll/prefs/reslist/pagelen", Num, 8);
SETTING_RW(prefs.maxhltextmbs, "/Recoll/prefs/preview/maxhltextmbs", Num, 3);
SETTING_RW(prefs.qtermcolor, "/Recoll/prefs/qtermcolor", , "blue");
if (!writing && prefs.qtermcolor == "")
prefs.qtermcolor = "blue";
SETTING_RW(prefs.reslistfontfamily, "/Recoll/prefs/reslist/fontFamily", ,
"");
SETTING_RW(prefs.reslistfontsize, "/Recoll/prefs/reslist/fontSize", Num,

View File

@ -17,7 +17,7 @@
#ifndef _GUIUTILS_H_INCLUDED_
#define _GUIUTILS_H_INCLUDED_
/*
* @(#$Id: guiutils.h,v 1.25 2007-09-08 17:25:49 dockes Exp $ (C) 2005 Jean-Francois Dockes
* @(#$Id: guiutils.h,v 1.26 2008-05-05 20:24:55 dockes Exp $ (C) 2005 Jean-Francois Dockes
* jean-francois.dockes@wanadoo.fr
*
* This program is free software; you can redistribute it and/or modify
@ -65,6 +65,7 @@ class PrefsPack {
int respagesize;
int maxhltextmbs;
QString reslistfontfamily;
QString qtermcolor; // Color for query terms in reslist and preview
int reslistfontsize;
// Result list format string
QString reslistformat;

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: preview_w.cpp,v 1.32 2008-04-18 11:38:56 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: preview_w.cpp,v 1.33 2008-05-05 20:24:55 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -880,7 +880,7 @@ bool Preview::loadFileInCurrentTab(string fn, size_t sz, const Rcl::Doc &idoc,
if (highlightTerms) {
QStyleSheetItem *item =
new QStyleSheetItem(editor->styleSheet(), "termtag" );
item->setColor("blue");
item->setColor(prefs.qtermcolor);
item->setFontWeight(QFont::Bold);
}

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.37 2008-05-05 16:38:43 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.38 2008-05-05 20:24:55 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
#include <time.h>
@ -347,7 +347,7 @@ void ResList::resultPageNext()
// Query term colorization
QStyleSheetItem *item = new QStyleSheetItem(styleSheet(), "termtag" );
item->setColor("blue");
item->setColor(prefs.qtermcolor);
// Result paragraph format
string sformat = string(prefs.reslistformat.utf8());

View File

@ -90,6 +90,35 @@
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>qtermcolor</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabelqtc</cstring>
</property>
<property name="text">
<string>Highlight color for query terms</string>
</property>
</widget>
<widget class="QLineEdit">
<property name="name">
<cstring>qtermColorLE</cstring>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout24</cstring>

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.23 2007-12-04 10:16:52 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.24 2008-05-05 20:24:55 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -106,6 +106,9 @@ void UIPrefsDialog::setFromPrefs()
useDesktopOpenCB->setChecked(prefs.useDesktopOpen);
keepSortCB->setChecked(prefs.keepSort);
// Query terms color
qtermColorLE->setText(prefs.qtermcolor);
// Result list font family and size
reslistFontFamily = prefs.reslistfontfamily;
reslistFontSize = prefs.reslistfontsize;
@ -171,6 +174,7 @@ void UIPrefsDialog::accept()
prefs.respagesize = pageLenSB->value();
prefs.maxhltextmbs = maxHLTSB->value();
prefs.qtermcolor = qtermColorLE->text();
prefs.reslistfontfamily = reslistFontFamily;
prefs.reslistfontsize = reslistFontSize;
prefs.reslistformat = rlfTE->text();