GUI: allow setting full CSS style for term highlighting, not only color value
This commit is contained in:
parent
e0aa229c28
commit
4f51c69806
@ -130,9 +130,24 @@ void rwSettings(bool writing)
|
||||
|
||||
SETTING_RW(prefs.previewPlainPre,
|
||||
"/Recoll/prefs/preview/plainPre", Int, PrefsPack::PP_PREWRAP);
|
||||
SETTING_RW(prefs.qtermcolor, "/Recoll/prefs/qtermcolor", String, "blue");
|
||||
if (!writing && prefs.qtermcolor == "")
|
||||
prefs.qtermcolor = "blue";
|
||||
|
||||
// History: used to be able to only set a bare color name. Can now
|
||||
// set any CSS style. Hack on ':' presence to keep compat with old
|
||||
// values
|
||||
SETTING_RW(prefs.qtermstyle, "/Recoll/prefs/qtermcolor", String,
|
||||
"color: blue");
|
||||
if (!writing && prefs.qtermstyle == "")
|
||||
prefs.qtermstyle = "color: blue";
|
||||
{ // histo compatibility hack
|
||||
int colon = prefs.qtermstyle.indexOf(":");
|
||||
int semi = prefs.qtermstyle.indexOf(";");
|
||||
// The 2nd part of the test is to keep compat with the
|
||||
// injection hack of the 1st user who suggested this (had
|
||||
// #ff5000;font-size:110%;... in 'qtermcolor')
|
||||
if (colon == -1 || (colon != -1 && semi != -1 && semi < colon)) {
|
||||
prefs.qtermstyle = QString::fromUtf8("color: ") + prefs.qtermstyle;
|
||||
}
|
||||
}
|
||||
|
||||
// Abstract snippet separator
|
||||
SETTING_RW(prefs.abssep, "/Recoll/prefs/reslist/abssep", String,"…");
|
||||
|
||||
@ -54,7 +54,7 @@ class PrefsPack {
|
||||
// set main character color for webkit/textbrowser reslist and
|
||||
// snippets window.
|
||||
QString fontcolor;
|
||||
QString qtermcolor; // Color for query terms in reslist and preview
|
||||
QString qtermstyle; // CSS style for query terms in reslist and other places
|
||||
int reslistfontsize;
|
||||
// Result list format string
|
||||
QString reslistformat;
|
||||
|
||||
@ -76,9 +76,8 @@ string PlainToRichQtPreview::startMatch(unsigned int grpidx)
|
||||
LOGDEB2("startMatch, ugrpidx " << (grpidx) << "\n" );
|
||||
m_groupanchors[grpidx].push_back(++m_lastanchor);
|
||||
m_groupcuranchors[grpidx] = 0;
|
||||
return string("<span style='color: ").
|
||||
append((const char *)(prefs.qtermcolor.toUtf8())).
|
||||
append(";font-weight: bold;").
|
||||
return string("<span style='").
|
||||
append(qs2utf8s(prefs.qtermstyle)).
|
||||
append("'>").
|
||||
append("<a name=\"").
|
||||
append(termAnchorName(m_lastanchor)).
|
||||
|
||||
@ -286,8 +286,8 @@ public:
|
||||
LOGDEB("Reslist startmatch: group " << (s1) << " user group " << (s2) << "\n" );
|
||||
}
|
||||
|
||||
return string("<span class='rclmatch' style='color: ")
|
||||
+ qs2utf8s(prefs.qtermcolor) + string("'>");
|
||||
return string("<span class='rclmatch' style='")
|
||||
+ qs2utf8s(prefs.qtermstyle) + string("'>");
|
||||
}
|
||||
virtual string endMatch()
|
||||
{
|
||||
|
||||
@ -67,8 +67,8 @@ public:
|
||||
virtual ~PlainToRichQtReslist() {}
|
||||
virtual string startMatch(unsigned int)
|
||||
{
|
||||
return string("<span style='color: ")
|
||||
+ qs2utf8s(prefs.qtermcolor) + string("'>");
|
||||
return string("<span style='")
|
||||
+ qs2utf8s(prefs.qtermstyle) + string("'>");
|
||||
}
|
||||
virtual string endMatch() {return string("</span>");}
|
||||
};
|
||||
|
||||
@ -52,8 +52,8 @@ class PlainToRichQtSnippets : public PlainToRich {
|
||||
public:
|
||||
virtual string startMatch(unsigned int)
|
||||
{
|
||||
return string("<span class='rclmatch' style='color: ")
|
||||
+ qs2utf8s(prefs.qtermcolor) + string("'>");
|
||||
return string("<span class='rclmatch' style='")
|
||||
+ qs2utf8s(prefs.qtermstyle) + string("'>");
|
||||
}
|
||||
virtual string endMatch()
|
||||
{
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
<item>
|
||||
<widget class="QLabel" name="textLabelqtc">
|
||||
<property name="text">
|
||||
<string>Highlight color for query terms</string>
|
||||
<string>Highlight CSS style for query terms</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
@ -44,7 +44,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="qtermColorLE">
|
||||
<widget class="QLineEdit" name="qtermStyleLE">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
|
||||
@ -154,7 +154,7 @@ void UIPrefsDialog::setFromPrefs()
|
||||
break;
|
||||
}
|
||||
// Query terms color
|
||||
qtermColorLE->setText(prefs.qtermcolor);
|
||||
qtermStyleLE->setText(prefs.qtermstyle);
|
||||
// Abstract snippet separator string
|
||||
abssepLE->setText(prefs.abssep);
|
||||
dateformatLE->setText(prefs.reslistdateformat);
|
||||
@ -286,7 +286,7 @@ void UIPrefsDialog::accept()
|
||||
prefs.collapseDuplicates = collapseDupsCB->isChecked();
|
||||
prefs.maxhltextmbs = maxHLTSB->value();
|
||||
|
||||
prefs.qtermcolor = qtermColorLE->text();
|
||||
prefs.qtermstyle = qtermStyleLE->text();
|
||||
prefs.abssep = abssepLE->text();
|
||||
prefs.reslistdateformat = dateformatLE->text();
|
||||
prefs.creslistdateformat = (const char*)prefs.reslistdateformat.toUtf8();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user