icon now part of paragraph format

This commit is contained in:
dockes 2007-07-12 08:23:40 +00:00
parent b7396b0a8a
commit 32c0086419
5 changed files with 28 additions and 42 deletions

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.32 2007-05-24 07:48:19 dockes Exp $ (C) 2005 Jean-Francois Dockes";
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.33 2007-07-12 08:23:40 dockes Exp $ (C) 2005 Jean-Francois Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -180,7 +180,6 @@ void rwSettings(bool writing)
}
}
SETTING_RW(prefs.showicons, "/Recoll/prefs/reslist/showicons", Bool, true);
SETTING_RW(prefs.autoSearchOnWS, "/Recoll/prefs/reslist/autoSearchOnWS",
Bool, false);
SETTING_RW(prefs.ssearchAutoPhrase,
@ -191,9 +190,7 @@ void rwSettings(bool writing)
SETTING_RW(prefs.reslistfontsize, "/Recoll/prefs/reslist/fontSize", Num,
10);
QString rlfDflt =
QString::fromAscii("%R %S %L &nbsp;&nbsp;<b>%T</b><br>"
"%M&nbsp;%D&nbsp;&nbsp;&nbsp;<i>%U</i><br>"
"%A %K");
QString::fromAscii(prefs.getDfltResListFormat());
SETTING_RW(prefs.reslistformat, "/Recoll/prefs/reslist/format", , rlfDflt);
if (prefs.reslistformat.stripWhiteSpace().isEmpty())
prefs.reslistformat = rlfDflt;

View File

@ -17,7 +17,7 @@
#ifndef _GUIUTILS_H_INCLUDED_
#define _GUIUTILS_H_INCLUDED_
/*
* @(#$Id: guiutils.h,v 1.21 2007-05-24 07:48:19 dockes Exp $ (C) 2005 Jean-Francois Dockes
* @(#$Id: guiutils.h,v 1.22 2007-07-12 08:23:40 dockes Exp $ (C) 2005 Jean-Francois Dockes
* jean-francois.dockes@wanadoo.fr
*
* This program is free software; you can redistribute it and/or modify
@ -61,7 +61,6 @@ extern bool printableUrl(const string &in, string &out);
/** Holder for preferences (gets saved to user Qt prefs) */
class PrefsPack {
public:
bool showicons;
bool autoSearchOnWS;
int respagesize;
QString reslistfontfamily;
@ -112,17 +111,23 @@ class PrefsPack {
vector<int> advSearchClauses;
PrefsPack() :
showicons(true),
respagesize(8),
reslistfontsize(10),
ssearchTyp(0),
queryBuildAbstract(true),
queryReplaceAbstract(false),
startWithAdvSearchOpen(false),
startWithSortToolOpen(false),
termMatchType(0)
startWithSortToolOpen(false),
termMatchType(0)
{
}
static const char *getDfltResListFormat() {
return "<img src=\"%I\" align=\"left\">"
"%R %S %L &nbsp;&nbsp;<b>%T</b><br>"
"%M&nbsp;%D&nbsp;&nbsp;&nbsp;<i>%U</i><br>"
"%A %K";
}
};
/** Global preferences record */

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.30 2007-07-11 10:05:27 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.31 2007-07-12 08:23:40 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
#include <time.h>
@ -408,17 +408,14 @@ void ResList::resultPageNext()
// Determine icon to display if any
string img_name;
if (prefs.showicons) {
string iconpath;
string iconname = rclconfig->getMimeIconName(doc.mimetype,
&iconpath);
LOGDEB1(("Img file; %s\n", iconpath.c_str()));
QImage image(iconpath.c_str());
if (!image.isNull()) {
img_name = string("img_") + iconname;
QMimeSourceFactory::defaultFactory()->
setImage(img_name.c_str(), image);
}
string iconpath;
string iconname = rclconfig->getMimeIconName(doc.mimetype, &iconpath);
LOGDEB1(("Img file; %s\n", iconpath.c_str()));
QImage image(iconpath.c_str());
if (!image.isNull()) {
img_name = string("img_") + iconname;
QMimeSourceFactory::defaultFactory()->
setImage(img_name.c_str(), image);
}
// Percentage of 'relevance'
@ -501,14 +498,11 @@ void ResList::resultPageNext()
else
result += "<p>";
if (!img_name.empty()) {
result += "<img source=\"" + img_name + "\" align=\"left\">";
}
// Configurable stuff
map<char,string> subs;
subs['A'] = !richabst.empty() ? richabst + "<br>" : "";
subs['D'] = datebuf;
subs['I'] = img_name;
subs['K'] = !doc.meta["keywords"].empty() ?
escapeHtml(doc.meta["keywords"]) + "<br>" : "";
subs['L'] = linksbuf;

View File

@ -154,7 +154,7 @@
<string>Result paragraph&lt;br&gt;format string</string>
</property>
<property name="toolTip" stdset="0">
<string>Defines the format for each result list paragraph. Use qt html format and printf-like replacements:&lt;br&gt;%A Abstract&lt;br&gt; %D Date&lt;br&gt; %K Keywords (if any)&lt;br&gt; %L Preview and Edit links&lt;br&gt; %M Mime type&lt;br&gt; %N Result number&lt;br&gt; %R Relevance percentage&lt;br&gt; %S Size information&lt;br&gt; %T Title&lt;br&gt; %U Url&lt;br&gt;</string>
<string>Defines the format for each result list paragraph. Use qt html format and printf-like replacements:&lt;br&gt;%A Abstract&lt;br&gt; %D Date&lt;br&gt; %I Icon image name%lt;br&gt; %K Keywords (if any)&lt;br&gt; %L Preview and Edit links&lt;br&gt; %M Mime type&lt;br&gt; %N Result number&lt;br&gt; %R Relevance percentage&lt;br&gt; %S Size information&lt;br&gt; %T Title&lt;br&gt; %U Url&lt;br&gt;</string>
</property>
</widget>
<widget class="QTextEdit">
@ -264,17 +264,6 @@
</widget>
</hbox>
</widget>
<widget class="QCheckBox">
<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="QCheckBox">
<property name="name">
<cstring>autoSearchCB</cstring>

View File

@ -1,5 +1,5 @@
#ifndef lint
static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.17 2007-05-24 07:48:19 dockes Exp $ (C) 2005 J.F.Dockes";
static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.18 2007-07-12 08:23:40 dockes Exp $ (C) 2005 J.F.Dockes";
#endif
/*
* This program is free software; you can redistribute it and/or modify
@ -96,8 +96,6 @@ void UIPrefsDialog::setFromPrefs()
{
// Entries per result page spinbox
pageLenSB->setValue(prefs.respagesize);
// Show icons checkbox
useIconsCB->setChecked(prefs.showicons);
autoSearchCB->setChecked(prefs.autoSearchOnWS);
syntlenSB->setValue(prefs.syntAbsLen);
syntctxSB->setValue(prefs.syntAbsCtx);
@ -171,13 +169,16 @@ void UIPrefsDialog::setFromPrefs()
void UIPrefsDialog::accept()
{
prefs.showicons = useIconsCB->isChecked();
prefs.autoSearchOnWS = autoSearchCB->isChecked();
prefs.respagesize = pageLenSB->value();
prefs.reslistfontfamily = reslistFontFamily;
prefs.reslistfontsize = reslistFontSize;
prefs.reslistformat = rlfTE->text();
if (prefs.reslistformat.stripWhiteSpace().isEmpty()) {
prefs.reslistformat = prefs.getDfltResListFormat();
rlfTE->setText(prefs.reslistformat);
}
prefs.htmlBrowser = helpBrowserLE->text();