prefs: make the query term css entry a combo so that we can supply some examples

This commit is contained in:
Jean-Francois Dockes 2021-01-23 10:18:56 +01:00
parent 78984b9fda
commit 57d47e6784
2 changed files with 17 additions and 4 deletions

View File

@ -464,7 +464,7 @@
</widget>
</item>
<item>
<widget class="QLineEdit" name="qtermStyleLE">
<widget class="QComboBox" name="qtermStyleCMB">
<property name="minimumSize">
<size>
<width>50</width>
@ -474,6 +474,12 @@
<property name="toolTip">
<string>Query terms highlighting in results. &lt;br&gt;Maybe try something like &quot;color:red;background:yellow&quot; for something more lively than the default blue...</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
<property name="insertPolicy">
<enum>QComboBox::NoInsert</enum>
</property>
</widget>
</item>
</layout>
@ -1494,7 +1500,7 @@ May be slow for big documents.</string>
<resources/>
<connections/>
<buttongroups>
<buttongroup name="buttonGroup_2"/>
<buttongroup name="buttonGroup"/>
<buttongroup name="buttonGroup_2"/>
</buttongroups>
</ui>

View File

@ -183,7 +183,14 @@ void UIPrefsDialog::setFromPrefs()
break;
}
// Query terms color
qtermStyleLE->setText(prefs.qtermstyle);
qtermStyleCMB->setCurrentText(prefs.qtermstyle);
if (qtermStyleCMB->count() <=1) {
qtermStyleCMB->addItem(prefs.qtermstyle);
qtermStyleCMB->addItem("color: blue");
qtermStyleCMB->addItem("color: red;background: yellow");
qtermStyleCMB->addItem(
"color: #dddddd; background: black; font-weight: bold");
}
// Abstract snippet separator string
abssepLE->setText(prefs.abssep);
dateformatLE->setText(prefs.reslistdateformat);
@ -374,7 +381,7 @@ void UIPrefsDialog::accept()
prefs.collapseDuplicates = collapseDupsCB->isChecked();
prefs.maxhltextkbs = maxHLTSB->value();
prefs.qtermstyle = qtermStyleLE->text();
prefs.qtermstyle = qtermStyleCMB->currentText();
prefs.abssep = abssepLE->text();
prefs.reslistdateformat = dateformatLE->text();
prefs.creslistdateformat = (const char*)prefs.reslistdateformat.toUtf8();