Commit 622cacf9 authored by Jean-Francois Dockes's avatar Jean-Francois Dockes
Browse files

Retrieve font color from qt defaults and use it to set color in webkit-based...

Retrieve font color from qt defaults and use it to set color in webkit-based elements (reslist and snippets window). User still needs to use the prefs to fix the font size. Closes issue #251
parent 87dd18fe
......@@ -27,6 +27,7 @@
#include "base64.h"
#include "advshist.h"
#include <QApplication>
#include <QSettings>
#include <QStringList>
#include <QFileDialog>
......@@ -146,6 +147,8 @@ void rwSettings(bool writing)
SETTING_RW(prefs.reslistfontsize, "/Recoll/prefs/reslist/fontSize", Int,
10);
prefs.fontcolor = QApplication::palette().text().color().name();
QString rlfDflt = QString::fromUtf8(prefs.dfltResListFormat);
if (writing) {
if (prefs.reslistformat.compare(rlfDflt)) {
......
......@@ -50,6 +50,10 @@ class PrefsPack {
int respagesize;
int maxhltextmbs;
QString reslistfontfamily;
// Not saved in prefs for now. Computed from qt defaults and used to
// set main character color for webkit/textbrowser reslist and
// snippets window.
QString fontcolor;
QString qtermcolor; // Color for query terms in reslist and preview
int reslistfontsize;
// Result list format string
......
......@@ -183,15 +183,17 @@ string QtGuiResListPager::prevUrl()
string QtGuiResListPager::headerContent()
{
string out;
#ifdef SETFONT_WITH_HEADSTYLE
out = "<style type=\"text/css\">\nbody,table,select,input {\n";
#ifdef SETFONT_WITH_HEADSTYLE
char ftsz[30];
sprintf(ftsz, "%d", prefs.reslistfontsize);
out += string("font-family: \"") + qs2utf8s(prefs.reslistfontfamily)
+ "\";\n";
out += string("font-size: ") + ftsz + "pt;\n";
out += string("}\n</style>\n");
#endif
out += string("color: ") + qs2utf8s(prefs.fontcolor) + ";\n";
out += string("}\n</style>\n");
out += qs2utf8s(prefs.reslistheadertext);
return out;
}
......
......@@ -144,14 +144,19 @@ void SnippetsW::init()
ostringstream oss;
oss <<
"<html><head>"
"<meta http-equiv=\"content-type\" "
"content=\"text/html; charset=utf-8\">"
"<link type=\"text/css\" rel=\"stylesheet\" href=\"/tmp/style.css\">"
"</head>"
"<body>"
"<table>"
;
"<html><head>"
"<meta http-equiv=\"content-type\" "
"content=\"text/html; charset=utf-8\">";
oss << "<style type=\"text/css\">\nbody,table,select,input {\n";
oss << "color: " + qs2utf8s(prefs.fontcolor) + ";\n";
oss << "}\n</style>\n";
oss <<
"</head>"
"<body>"
"<table>"
;
g_hiliter.set_inputhtml(false);
bool nomatch = true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment