From 57d47e6784db9295d9be676eeaf7434e128690e7 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Sat, 23 Jan 2021 10:18:56 +0100 Subject: [PATCH] prefs: make the query term css entry a combo so that we can supply some examples --- src/qtgui/uiprefs.ui | 10 ++++++++-- src/qtgui/uiprefs_w.cpp | 11 +++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/qtgui/uiprefs.ui b/src/qtgui/uiprefs.ui index b06cb562..536db2fc 100644 --- a/src/qtgui/uiprefs.ui +++ b/src/qtgui/uiprefs.ui @@ -464,7 +464,7 @@ - + 50 @@ -474,6 +474,12 @@ Query terms highlighting in results. <br>Maybe try something like "color:red;background:yellow" for something more lively than the default blue... + + true + + + QComboBox::NoInsert + @@ -1494,7 +1500,7 @@ May be slow for big documents. - + diff --git a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp index 6889db08..8f339786 100644 --- a/src/qtgui/uiprefs_w.cpp +++ b/src/qtgui/uiprefs_w.cpp @@ -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();