make result list paragraph format user-adjustable
This commit is contained in:
parent
974f731f9b
commit
3d88716b9a
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.22 2006-10-30 12:59:44 dockes Exp $ (C) 2005 Jean-Francois Dockes";
|
||||
static char rcsid[] = "@(#$Id: guiutils.cpp,v 1.23 2006-11-10 13:32:08 dockes Exp $ (C) 2005 Jean-Francois Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -157,7 +157,13 @@ void rwSettings(bool writing)
|
||||
"");
|
||||
SETTING_RW(prefs.reslistfontsize, "/Recoll/prefs/reslist/fontSize", Num,
|
||||
0);
|
||||
|
||||
QString rlfDflt =QString::fromAscii(
|
||||
"%R %S %L <b>%T</b><br>"
|
||||
"%M %D <i>%U</i><br>"
|
||||
"%A %K");
|
||||
SETTING_RW(prefs.reslistformat, "/Recoll/prefs/reslist/format", , rlfDflt);
|
||||
if (prefs.reslistformat.stripWhiteSpace().isEmpty())
|
||||
prefs.reslistformat = rlfDflt;
|
||||
SETTING_RW(prefs.queryStemLang, "/Recoll/prefs/query/stemLang", ,
|
||||
"english");
|
||||
SETTING_RW(prefs.queryBuildAbstract,
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
#ifndef _GUIUTILS_H_INCLUDED_
|
||||
#define _GUIUTILS_H_INCLUDED_
|
||||
/*
|
||||
* @(#$Id: guiutils.h,v 1.14 2006-10-30 12:59:44 dockes Exp $ (C) 2005 Jean-Francois Dockes
|
||||
* @(#$Id: guiutils.h,v 1.15 2006-11-10 13:32:08 dockes Exp $ (C) 2005 Jean-Francois Dockes
|
||||
* jean-francois.dockes@wanadoo.fr
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -60,6 +60,8 @@ class PrefsPack {
|
||||
int respagesize;
|
||||
QString reslistfontfamily;
|
||||
int reslistfontsize;
|
||||
// Result list format string
|
||||
QString reslistformat;
|
||||
QString queryStemLang;
|
||||
int mainwidth;
|
||||
int mainheight;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.4 2006-10-30 12:59:44 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: rclmain_w.cpp,v 1.5 2006-11-10 13:32:08 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -635,23 +635,10 @@ void RclMain::startNativeViewer(int docnum)
|
||||
|
||||
// Substitute %u (url) and %f (file name) inside prototype command
|
||||
string ncmd;
|
||||
string::const_iterator it1;
|
||||
for (it1 = cmd.begin(); it1 != cmd.end();it1++) {
|
||||
if (*it1 == '%') {
|
||||
if (++it1 == cmd.end()) {
|
||||
ncmd += '%';
|
||||
break;
|
||||
}
|
||||
if (*it1 == '%')
|
||||
ncmd += '%';
|
||||
if (*it1 == 'u')
|
||||
ncmd += "'" + url + "'";
|
||||
if (*it1 == 'f')
|
||||
ncmd += "'" + fn + "'";
|
||||
} else {
|
||||
ncmd += *it1;
|
||||
}
|
||||
}
|
||||
map<char, string> subs;
|
||||
subs['u'] = string("'") + url + "'";
|
||||
subs['f'] = string("'") + fn + "'";
|
||||
pcSubst(cmd, ncmd, subs);
|
||||
|
||||
ncmd += " &";
|
||||
QStatusBar *stb = statusBar();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.5 2006-11-09 17:37:58 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: reslist.cpp,v 1.6 2006-11-10 13:32:08 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
@ -269,6 +269,10 @@ void ResList::resultPageNext()
|
||||
list<string> qTerms;
|
||||
m_docsource->getTerms(qTerms);
|
||||
|
||||
// Result paragraph format
|
||||
string sformat = string(prefs.reslistformat.utf8());
|
||||
LOGDEB(("resultPageNext: format: [%s]\n", sformat.c_str()));
|
||||
|
||||
// Insert results if any in result list window. We have to send
|
||||
// the text to the widgets, because we need the paragraph number
|
||||
// each time we add a result paragraph (its diffult and
|
||||
@ -372,43 +376,49 @@ void ResList::resultPageNext()
|
||||
// Abstract
|
||||
string abst;
|
||||
plaintorich(doc.abstract, abst, qTerms, 0, true);
|
||||
//string abst = escapeHtml(doc.abstract);
|
||||
LOGDEB1(("Abstract: {%s}\n", abst.c_str()));
|
||||
|
||||
// Links;
|
||||
string linksbuf;
|
||||
char vlbuf[100];
|
||||
if (canIntern(doc.mimetype, rclconfig)) {
|
||||
sprintf(vlbuf, "\"P%d\"", m_winfirst+i);
|
||||
linksbuf += string("<a href=") + vlbuf + ">" + "Preview" + "</a>"
|
||||
+ " ";
|
||||
}
|
||||
if (!rclconfig->getMimeViewerDef(doc.mimetype).empty()) {
|
||||
sprintf(vlbuf, "E%d", m_winfirst+i);
|
||||
linksbuf += string("<a href=") + vlbuf + ">" + "Edit" + "</a>";
|
||||
}
|
||||
|
||||
// Concatenate chunks to build the result list paragraph:
|
||||
string result;
|
||||
|
||||
// Subheader: this is used by history
|
||||
if (!sh.empty())
|
||||
result += string("<p><b>") + sh + "</p>\n<p>";
|
||||
else
|
||||
result += "<p>";
|
||||
|
||||
// Percent relevant + size + preview/edit links + title
|
||||
result += string(perbuf) + sizebuf;
|
||||
char vlbuf[100];
|
||||
if (canIntern(doc.mimetype, rclconfig)) {
|
||||
sprintf(vlbuf, "\"P%d\"", m_winfirst+i);
|
||||
result += string("<a href=") + vlbuf + ">" + "Preview" + "</a>"
|
||||
+ " ";
|
||||
}
|
||||
if (!rclconfig->getMimeViewerDef(doc.mimetype).empty()) {
|
||||
sprintf(vlbuf, "E%d", m_winfirst+i);
|
||||
result += string("<a href=") + vlbuf + ">" + "Edit" + "</a>";
|
||||
}
|
||||
result += " <b>" + doc.title + "</b><br>";
|
||||
|
||||
// Mime type, date modified, url
|
||||
result += doc.mimetype + " ";
|
||||
result += string(datebuf) + " ";
|
||||
if (!img_name.empty()) {
|
||||
result += "<img source=\"" + img_name + "\" align=\"left\">";
|
||||
}
|
||||
result += "<i>" + url + +"</i><br>";
|
||||
|
||||
// Text: abstract and keywords
|
||||
if (!abst.empty())
|
||||
result += abst + "<br>";
|
||||
if (!doc.keywords.empty())
|
||||
result += doc.keywords + "<br>";
|
||||
// Configurable stuff
|
||||
map<char,string> subs;
|
||||
subs['A'] = !doc.abstract.empty() ? doc.abstract + "<br>" : "";
|
||||
subs['D'] = datebuf;
|
||||
subs['K'] = !doc.keywords.empty() ? doc.keywords + "<br>" : "";
|
||||
subs['L'] = linksbuf;
|
||||
subs['M'] = doc.mimetype;
|
||||
subs['R'] = perbuf;
|
||||
subs['S'] = sizebuf;
|
||||
subs['T'] = doc.title;
|
||||
subs['U'] = url;
|
||||
|
||||
string formatted;
|
||||
pcSubst(sformat, formatted, subs);
|
||||
result += formatted;
|
||||
|
||||
result += "</p>\n";
|
||||
|
||||
|
||||
1192
src/qtgui/uiprefs.ui
1192
src/qtgui/uiprefs.ui
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.9 2006-11-07 09:04:28 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.10 2006-11-10 13:32:08 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -40,6 +40,7 @@ static char rcsid[] = "@(#$Id: uiprefs_w.cpp,v 1.9 2006-11-07 09:04:28 dockes Ex
|
||||
#include <qlayout.h>
|
||||
#include <qtooltip.h>
|
||||
#include <qwhatsthis.h>
|
||||
#include <qtextedit.h>
|
||||
|
||||
#include "recoll.h"
|
||||
#include "guiutils.h"
|
||||
@ -93,6 +94,7 @@ void UIPrefsDialog::setFromPrefs()
|
||||
reslistFontPB->setText(reslistFontFamily + "-" +
|
||||
s.setNum(reslistFontSize));
|
||||
}
|
||||
rlfTE->setText(prefs.reslistformat);
|
||||
helpBrowserLE->setText(prefs.htmlBrowser);
|
||||
|
||||
// Stemming language combobox
|
||||
@ -152,6 +154,7 @@ void UIPrefsDialog::accept()
|
||||
|
||||
prefs.reslistfontfamily = reslistFontFamily;
|
||||
prefs.reslistfontsize = reslistFontSize;
|
||||
prefs.reslistformat = rlfTE->text();
|
||||
|
||||
prefs.htmlBrowser = helpBrowserLE->text();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user