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
This commit is contained in:
parent
05a5d0c3b7
commit
f00fa77d45
4 changed files with 24 additions and 10 deletions
|
@ -27,6 +27,7 @@
|
||||||
#include "base64.h"
|
#include "base64.h"
|
||||||
#include "advshist.h"
|
#include "advshist.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
@ -146,6 +147,8 @@ void rwSettings(bool writing)
|
||||||
SETTING_RW(prefs.reslistfontsize, "/Recoll/prefs/reslist/fontSize", Int,
|
SETTING_RW(prefs.reslistfontsize, "/Recoll/prefs/reslist/fontSize", Int,
|
||||||
10);
|
10);
|
||||||
|
|
||||||
|
prefs.fontcolor = QApplication::palette().text().color().name();
|
||||||
|
|
||||||
QString rlfDflt = QString::fromUtf8(prefs.dfltResListFormat);
|
QString rlfDflt = QString::fromUtf8(prefs.dfltResListFormat);
|
||||||
if (writing) {
|
if (writing) {
|
||||||
if (prefs.reslistformat.compare(rlfDflt)) {
|
if (prefs.reslistformat.compare(rlfDflt)) {
|
||||||
|
|
|
@ -50,6 +50,10 @@ class PrefsPack {
|
||||||
int respagesize;
|
int respagesize;
|
||||||
int maxhltextmbs;
|
int maxhltextmbs;
|
||||||
QString reslistfontfamily;
|
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
|
QString qtermcolor; // Color for query terms in reslist and preview
|
||||||
int reslistfontsize;
|
int reslistfontsize;
|
||||||
// Result list format string
|
// Result list format string
|
||||||
|
|
|
@ -183,15 +183,17 @@ string QtGuiResListPager::prevUrl()
|
||||||
string QtGuiResListPager::headerContent()
|
string QtGuiResListPager::headerContent()
|
||||||
{
|
{
|
||||||
string out;
|
string out;
|
||||||
#ifdef SETFONT_WITH_HEADSTYLE
|
|
||||||
out = "<style type=\"text/css\">\nbody,table,select,input {\n";
|
out = "<style type=\"text/css\">\nbody,table,select,input {\n";
|
||||||
|
#ifdef SETFONT_WITH_HEADSTYLE
|
||||||
char ftsz[30];
|
char ftsz[30];
|
||||||
sprintf(ftsz, "%d", prefs.reslistfontsize);
|
sprintf(ftsz, "%d", prefs.reslistfontsize);
|
||||||
out += string("font-family: \"") + qs2utf8s(prefs.reslistfontfamily)
|
out += string("font-family: \"") + qs2utf8s(prefs.reslistfontfamily)
|
||||||
+ "\";\n";
|
+ "\";\n";
|
||||||
out += string("font-size: ") + ftsz + "pt;\n";
|
out += string("font-size: ") + ftsz + "pt;\n";
|
||||||
out += string("}\n</style>\n");
|
|
||||||
#endif
|
#endif
|
||||||
|
out += string("color: ") + qs2utf8s(prefs.fontcolor) + ";\n";
|
||||||
|
out += string("}\n</style>\n");
|
||||||
out += qs2utf8s(prefs.reslistheadertext);
|
out += qs2utf8s(prefs.reslistheadertext);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,14 +144,19 @@ void SnippetsW::init()
|
||||||
|
|
||||||
ostringstream oss;
|
ostringstream oss;
|
||||||
oss <<
|
oss <<
|
||||||
"<html><head>"
|
"<html><head>"
|
||||||
"<meta http-equiv=\"content-type\" "
|
"<meta http-equiv=\"content-type\" "
|
||||||
"content=\"text/html; charset=utf-8\">"
|
"content=\"text/html; charset=utf-8\">";
|
||||||
"<link type=\"text/css\" rel=\"stylesheet\" href=\"/tmp/style.css\">"
|
|
||||||
"</head>"
|
oss << "<style type=\"text/css\">\nbody,table,select,input {\n";
|
||||||
"<body>"
|
oss << "color: " + qs2utf8s(prefs.fontcolor) + ";\n";
|
||||||
"<table>"
|
oss << "}\n</style>\n";
|
||||||
;
|
|
||||||
|
oss <<
|
||||||
|
"</head>"
|
||||||
|
"<body>"
|
||||||
|
"<table>"
|
||||||
|
;
|
||||||
|
|
||||||
g_hiliter.set_inputhtml(false);
|
g_hiliter.set_inputhtml(false);
|
||||||
bool nomatch = true;
|
bool nomatch = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue