From ac5ff471f21a28b79dbb08c69e5ca9d4433190d0 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Wed, 25 Mar 2020 17:01:21 +0100 Subject: [PATCH] GUI preview: use kbytes not mbytes for specifying the threshold size for not highlighting preview: with a slow splitter 1MB could be too high --- src/qtgui/guiutils.cpp | 10 +- src/qtgui/guiutils.h | 2 +- src/qtgui/uiprefs.ui | 2296 ++++++++++++++++++++------------------- src/qtgui/uiprefs_w.cpp | 4 +- 4 files changed, 1163 insertions(+), 1149 deletions(-) diff --git a/src/qtgui/guiutils.cpp b/src/qtgui/guiutils.cpp index 7775106c..12906032 100644 --- a/src/qtgui/guiutils.cpp +++ b/src/qtgui/guiutils.cpp @@ -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); diff --git a/src/qtgui/guiutils.h b/src/qtgui/guiutils.h index 1b1c7abf..1b3c8c03 100644 --- a/src/qtgui/guiutils.h +++ b/src/qtgui/guiutils.h @@ -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 diff --git a/src/qtgui/uiprefs.ui b/src/qtgui/uiprefs.ui index 9cb8087e..43f025f9 100644 --- a/src/qtgui/uiprefs.ui +++ b/src/qtgui/uiprefs.ui @@ -7,7 +7,7 @@ 0 0 542 - 449 + 641 @@ -16,1156 +16,1162 @@ true - - - - - 0 - - - - User interface - - - - - - - - - - Highlight CSS style for query terms - - - false - - - - - - - - 50 - 0 - - - - Query terms highlighting in results. <br>Maybe try something like "color:red;background:yellow" for something more lively than the default blue... - - - - - - - - - - - Application Qt style sheet - - - false - - - - - - - Opens a dialog to select the style sheet file - - - Choose - - - - - - - Resets the style sheet to default - - - Reset - - - - - - - - - - - - 1 - 0 - - - - Texts over this size will not be highlighted in preview (too slow). - - - Maximum text size highlighted for preview (megabytes) - - - false - - - - - - - 1 - - - 3 - - - - - - - - - Prefer Html to plain text for preview. - - - false - - - - - - - Make links inside the preview window clickable, and start an external browser when they are clicked. - - - Activate links in preview. - - - false - - - - - - - - - Lines in PRE text are not folded. Using BR loses some indentation. PRE + Wrap style may be what you want. - - - Plain text to HTML line style - - - - - - - <BR> - - - buttonGroup - - - - - - - <PRE> - - - buttonGroup - - - - - - - <PRE> + wrap - - - buttonGroup - - - - - - - - - Choose editor applications - - - - - - - - - Decide if document filters are shown as radio buttons, toolbar combobox, or menu. - - - Document filter choice style: - - - - - - - Buttons Panel - - - buttonGroup_2 - - - - - - - Toolbar Combobox - - - buttonGroup_2 - - - - - - - Menu - - - buttonGroup_2 - - - - - - - - - - - Start with simple search mode - - - false - - - - - - - - - - - - - - - 1 - 0 - - - - Limit the size of the search history. Use 0 to disable, -1 for unlimited. - - - Maximum size of search history (0: disable, -1: unlimited): - - - false - - - - - - - -1 - - - 0 - - - - - - - - - Disable Qt autocompletion in search entry. - - - false - - - - - - - Start search on completer popup activation. - - - true - - - - - - - Start with advanced search dialog open. - - - false - - - - - - - Remember sort activation state. - - - false - - - - - - - Show system tray icon. - - - false - - - - - - - Close to tray instead of exiting. - - - false - - - - - - - Generate desktop notifications. - - - false - - - - - - - Show warning when opening temporary file. - - - true - - - - - - - Suppress all beeps. - - - false - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 70 - - - - - - - - - - - Result List - - - - - - - - - - - 1 - 0 - - - - Number of entries in a result page - - - false - - - - - - - 1 - - - 9999 - - - 8 - - - - - - - - - - - Result list font - - - false - - - - - - - Opens a dialog to select the result list font - - - Helvetica-10 - - - - - - - Resets the result list font to the system default - - - Reset - - - - - - - - - - - Edit result paragraph format string - - - - - - - - - Edit result page html header insert - - - - - - - - - Date format (strftime(3)) - - - false - - - - - - - - 30 - 0 - - - - - - - - - - - - Abstract snippet separator - - - false - - - - - - - - 30 - 0 - - - - - - - - - - - - User style to apply to the snippets window.<br> Note: the result page header insert is also included in the snippets window header. - - - Snippets window CSS file - - - false - - - - - - - Opens a dialog to select the Snippets window CSS style sheet file - - - Choose - - - - - - - Resets the Snippets window style - - - Reset - - - - - - - - - - - - 1 - 0 - - - - Maximum number of snippets displayed in the snippets window - - - false - - - - - - - 1 - - - 10000000 - - - 10 - - - 1000 - - - - - - - - - Sort snippets by page number (default: by weight). - - - false - - - - - - - Display a Snippets link even if the document has no pages (needs restart). - - - false - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Search parameters - - - - - - If checked, results with the same content under different names will only be shown once. - - - Hide duplicate results. - - - false - - - - - - - - - - - Stemming language - - - false - - - - - - - - - - - - QFrame::HLine - - - QFrame::Sunken - - - - - - - A search for [rolling stones] (2 terms) will be changed to [rolling or stones or (rolling phrase 2 stones)]. + + + + + 0 + + + + User interface + + + + + + + + + + Highlight CSS style for query terms + + + false + + + + + + + + 50 + 0 + + + + Query terms highlighting in results. <br>Maybe try something like "color:red;background:yellow" for something more lively than the default blue... + + + + + + + + + + + Application Qt style sheet + + + false + + + + + + + Opens a dialog to select the style sheet file + + + Choose + + + + + + + Resets the style sheet to default + + + Reset + + + + + + + + + + + + 1 + 0 + + + + Texts over this size will not be highlighted in preview (too slow). + + + Maximum text size highlighted for preview (kilobytes) + + + false + + + + + + + 0 + + + 5000 + + + 100 + + + 3000 + + + + + + + + + Prefer Html to plain text for preview. + + + false + + + + + + + Make links inside the preview window clickable, and start an external browser when they are clicked. + + + Activate links in preview. + + + false + + + + + + + + + Lines in PRE text are not folded. Using BR loses some indentation. PRE + Wrap style may be what you want. + + + Plain text to HTML line style + + + + + + + <BR> + + + buttonGroup + + + + + + + <PRE> + + + buttonGroup + + + + + + + <PRE> + wrap + + + buttonGroup + + + + + + + + + Choose editor applications + + + + + + + + + Decide if document filters are shown as radio buttons, toolbar combobox, or menu. + + + Document filter choice style: + + + + + + + Buttons Panel + + + buttonGroup_2 + + + + + + + Toolbar Combobox + + + buttonGroup_2 + + + + + + + Menu + + + buttonGroup_2 + + + + + + + + + + + Start with simple search mode + + + false + + + + + + + + + + + + + + + 1 + 0 + + + + Limit the size of the search history. Use 0 to disable, -1 for unlimited. + + + Maximum size of search history (0: disable, -1: unlimited): + + + false + + + + + + + -1 + + + 0 + + + + + + + + + Disable Qt autocompletion in search entry. + + + false + + + + + + + Start search on completer popup activation. + + + true + + + + + + + Start with advanced search dialog open. + + + false + + + + + + + Remember sort activation state. + + + false + + + + + + + Show system tray icon. + + + false + + + + + + + Close to tray instead of exiting. + + + false + + + + + + + Generate desktop notifications. + + + false + + + + + + + Show warning when opening temporary file. + + + true + + + + + + + Suppress all beeps. + + + false + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 70 + + + + + + + + + + + Result List + + + + + + + + + + + 1 + 0 + + + + Number of entries in a result page + + + false + + + + + + + 1 + + + 9999 + + + 8 + + + + + + + + + + + Result list font + + + false + + + + + + + Opens a dialog to select the result list font + + + Helvetica-10 + + + + + + + Resets the result list font to the system default + + + Reset + + + + + + + + + + + Edit result paragraph format string + + + + + + + + + Edit result page html header insert + + + + + + + + + Date format (strftime(3)) + + + false + + + + + + + + 30 + 0 + + + + + + + + + + + + Abstract snippet separator + + + false + + + + + + + + 30 + 0 + + + + + + + + + + + + User style to apply to the snippets window.<br> Note: the result page header insert is also included in the snippets window header. + + + Snippets window CSS file + + + false + + + + + + + Opens a dialog to select the Snippets window CSS style sheet file + + + Choose + + + + + + + Resets the Snippets window style + + + Reset + + + + + + + + + + + + 1 + 0 + + + + Maximum number of snippets displayed in the snippets window + + + false + + + + + + + 1 + + + 10000000 + + + 10 + + + 1000 + + + + + + + + + Sort snippets by page number (default: by weight). + + + false + + + + + + + Display a Snippets link even if the document has no pages (needs restart). + + + false + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Search parameters + + + + + + If checked, results with the same content under different names will only be shown once. + + + Hide duplicate results. + + + false + + + + + + + + + + + Stemming language + + + false + + + + + + + + + + + + QFrame::HLine + + + QFrame::Sunken + + + + + + + A search for [rolling stones] (2 terms) will be changed to [rolling or stones or (rolling phrase 2 stones)]. This should give higher precedence to the results where the search terms appear exactly as entered. - - - Automatically add phrase to simple searches - - - - - - - - - - 1 - 0 - - - - Frequency percentage threshold over which we do not use terms inside autophrase. + + + Automatically add phrase to simple searches + + + + + + + + + + 1 + 0 + + + + Frequency percentage threshold over which we do not use terms inside autophrase. Frequent terms are a major performance issue with phrases. Skipped terms augment the phrase slack, and reduce the autophrase efficiency. The default value is 2 (percent). - - - Autophrase term frequency threshold percentage - - - false - - - - - - - 0.200000000000000 - - - 2.000000000000000 - - - - - - - - - QFrame::HLine - - - QFrame::Sunken - - - - - - - Do we try to build abstracts for result list entries by using the context of query terms ? + + + Autophrase term frequency threshold percentage + + + false + + + + + + + 0.200000000000000 + + + 2.000000000000000 + + + + + + + + + QFrame::HLine + + + QFrame::Sunken + + + + + + + Do we try to build abstracts for result list entries by using the context of query terms ? May be slow for big documents. - - - Dynamically build abstracts - - - - - - - Do we synthetize an abstract even if the document seemed to have one? - - - Replace abstracts from documents - - - - - - - - - - 2 - 0 - - - - Synthetic abstract size (characters) - - - false - - - - - - - - 1 - 0 - - - - 80 - - - 100000 - - - 10 - - - 250 - - - - - - - - - - - - 1 - 0 - - - - Synthetic abstract context words - - - false - - - - - - - 2 - - - 20000 - - - 4 - - - - - - - - - QFrame::HLine - - - QFrame::Sunken - - - - - - - - - - 1 - 0 - - - - The words in the list will be automatically turned to ext:xxx clauses in the query language entry. - - - Query language magic file name suffixes. - - - false - - - - - - - Enable - - - - - - - - 30 - 0 - - - - - - - - - - QFrame::HLine - - - QFrame::Sunken - - - - - - - - - - 1 - 0 - - - - Synonyms file - - - false - - - - - - - Enable - - - - - - - - 30 - 0 - - - - Choose - - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 70 - - - - - - - - - - - External Indexes - - - - - - - - QAbstractItemView::ExtendedSelection - - - - - - - - - Toggle selected - - - - - - - Activate All - - - - - - - Deactivate All - - - - - - - Set path translations for the selected index or for the main one if no selection exists. - - - Paths translations - - - - - - - - - QFrame::HLine - - - QFrame::Sunken - - - - - - - - - Remove from list. This has no effect on the disk index. - - - Remove selected - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 16 - 20 - - - - - - - - true - - - Click to add another index directory to the list. You can select either a Recoll configuration directory or a Xapian index. - - - Add index - - - - - - - - - - - - Misc - - - - - - - - Work around QTBUG-78923 by inserting space before anchor text - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - + + + Dynamically build abstracts + + + + + + + Do we synthetize an abstract even if the document seemed to have one? + + + Replace abstracts from documents + + + + + + + + + + 2 + 0 + + + + Synthetic abstract size (characters) + + + false + + + + + + + + 1 + 0 + + + + 80 + + + 100000 + + + 10 + + + 250 + + + + + + + + + + + + 1 + 0 + + + + Synthetic abstract context words + + + false + + + + + + + 2 + + + 20000 + + + 4 + + + + + + + + + QFrame::HLine + + + QFrame::Sunken + + + + + + + + + + 1 + 0 + + + + The words in the list will be automatically turned to ext:xxx clauses in the query language entry. + + + Query language magic file name suffixes. + + + false + + + + + + + Enable + + + + + + + + 30 + 0 + + + + + + + + + + QFrame::HLine + + + QFrame::Sunken + + + + + + + + + + 1 + 0 + + + + Synonyms file + + + false + + + + + + + Enable + + + + + + + + 30 + 0 + + + + Choose + + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 70 + + + + + + + - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 210 - 20 - - - - - - - - Apply changes - - - &OK - - - - - - true - - - true - - - - - - - Discard changes - - - &Cancel - - - - - - true - - - - - - + + + External Indexes + + + + + + + + QAbstractItemView::ExtendedSelection + + + + + + + + + Toggle selected + + + + + + + Activate All + + + + + + + Deactivate All + + + + + + + Set path translations for the selected index or for the main one if no selection exists. + + + Paths translations + + + + + + + + + QFrame::HLine + + + QFrame::Sunken + + + + + + + + + Remove from list. This has no effect on the disk index. + + + Remove selected + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 16 + 20 + + + + + + + + true + + + Click to add another index directory to the list. You can select either a Recoll configuration directory or a Xapian index. + + + Add index + + + + + + + + + + + + Misc + + + + + + + + Work around QTBUG-78923 by inserting space before anchor text + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 210 + 20 + + + + + + + + Apply changes + + + &OK + + + + + + true + + + true + + + + + + + Discard changes + + + &Cancel + + + + + + true + + + + + + diff --git a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp index 40bd6e9f..007c1199 100644 --- a/src/qtgui/uiprefs_w.cpp +++ b/src/qtgui/uiprefs_w.cpp @@ -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();