GUI preview: use kbytes not mbytes for specifying the threshold size for not highlighting preview: with a slow splitter 1MB could be too high

This commit is contained in:
Jean-Francois Dockes 2020-03-25 17:01:21 +01:00
parent 5719cada57
commit ac5ff471f2
4 changed files with 1163 additions and 1149 deletions

View File

@ -158,7 +158,15 @@ void rwSettings(bool writing)
"/Recoll/prefs/reslist/collapseDuplicates", Bool, false);
SETTING_RW(prefs.showResultsAsTable,
"/Recoll/prefs/showResultsAsTable", Bool, false);
SETTING_RW(prefs.maxhltextmbs, "/Recoll/prefs/preview/maxhltextmbs", Int, 3);
SETTING_RW(prefs.maxhltextkbs, "/Recoll/prefs/preview/maxhltextkbs", Int,
3000);
// Compat: if maxhltextkbs is not set but old maxhltextmbs is set use it
if (!writing && !settings.contains("/Recoll/prefs/preview/maxhltextkbs") &&
settings.contains("/Recoll/prefs/preview/maxhltextmbs")) {
prefs.maxhltextkbs = settings.value(
"/Recoll/prefs/preview/maxhltextmbs").toInt() * 1024;
}
SETTING_RW(prefs.previewPlainPre,
"/Recoll/prefs/preview/plainPre", Int, PrefsPack::PP_PREWRAP);

View File

@ -46,7 +46,7 @@ class PrefsPack {
int filterCtlStyle;
int respagesize{8};
int historysize{0};
int maxhltextmbs;
int maxhltextkbs;
QString reslistfontfamily;
// Not saved in prefs for now. Computed from qt defaults and used to
// set main character color for webkit/textbrowser reslist and

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>542</width>
<height>449</height>
<height>641</height>
</rect>
</property>
<property name="windowTitle">
@ -104,7 +104,7 @@
<string>Texts over this size will not be highlighted in preview (too slow).</string>
</property>
<property name="text">
<string>Maximum text size highlighted for preview (megabytes)</string>
<string>Maximum text size highlighted for preview (kilobytes)</string>
</property>
<property name="wordWrap">
<bool>false</bool>
@ -114,10 +114,16 @@
<item>
<widget class="QSpinBox" name="maxHLTSB">
<property name="minimum">
<number>1</number>
<number>0</number>
</property>
<property name="maximum">
<number>5000</number>
</property>
<property name="singleStep">
<number>100</number>
</property>
<property name="value">
<number>3</number>
<number>3000</number>
</property>
</widget>
</item>

View File

@ -112,7 +112,7 @@ void UIPrefsDialog::setFromPrefs()
pageLenSB->setValue(prefs.respagesize);
maxHistSizeSB->setValue(prefs.historysize);
collapseDupsCB->setChecked(prefs.collapseDuplicates);
maxHLTSB->setValue(prefs.maxhltextmbs);
maxHLTSB->setValue(prefs.maxhltextkbs);
if (prefs.ssearchTypSav) {
ssearchTypCMB->setCurrentIndex(4);
@ -304,7 +304,7 @@ void UIPrefsDialog::accept()
prefs.respagesize = pageLenSB->value();
prefs.historysize = maxHistSizeSB->value();
prefs.collapseDuplicates = collapseDupsCB->isChecked();
prefs.maxhltextmbs = maxHLTSB->value();
prefs.maxhltextkbs = maxHLTSB->value();
prefs.qtermstyle = qtermStyleLE->text();
prefs.abssep = abssepLE->text();