From b64751e1386bcf2c44ecbde00ff4d7be703e2cb8 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Wed, 2 Oct 2019 08:53:50 +0200 Subject: [PATCH] Make optional the space character hack used to fix Tamil text display inside anchors: the space is sometimes a problem with cut & paste --- src/qtgui/preview_plaintorich.cpp | 10 +- src/qtgui/preview_plaintorich.h | 1 + src/qtgui/uiprefs.ui | 2155 +++++++++++++++-------------- src/qtgui/uiprefs_w.cpp | 10 + 4 files changed, 1110 insertions(+), 1066 deletions(-) diff --git a/src/qtgui/preview_plaintorich.cpp b/src/qtgui/preview_plaintorich.cpp index 032424d7..60d17a60 100644 --- a/src/qtgui/preview_plaintorich.cpp +++ b/src/qtgui/preview_plaintorich.cpp @@ -22,6 +22,7 @@ #include #include +#include #include "preview_plaintorich.h" @@ -43,6 +44,8 @@ void PlainToRichQtPreview::clear() m_lastanchor = 0; m_groupanchors.clear(); m_groupcuranchors.clear(); + QSettings settings("Recoll.org", "recoll"); + m_spacehack = settings.value("anchorSpcHack", 0).toBool(); } bool PlainToRichQtPreview::haveAnchors() @@ -82,9 +85,12 @@ string PlainToRichQtPreview::startMatch(unsigned int grpidx) // Tamil text (qt bug?). Just inserting a space character after // the opening section. Also: having before the match + // term causes the same problem (so not a possible fix). + string hackspace = m_spacehack? " " : ""; string startmarker{ - " " + + "" + hackspace + "" }; return startmarker; diff --git a/src/qtgui/preview_plaintorich.h b/src/qtgui/preview_plaintorich.h index c35bbcf3..94d7fd69 100644 --- a/src/qtgui/preview_plaintorich.h +++ b/src/qtgui/preview_plaintorich.h @@ -50,6 +50,7 @@ private: // in the query (the map key is and index into HighlightData.groups). std::map > m_groupanchors; std::map m_groupcuranchors; + bool m_spacehack{false}; }; /* A thread to convert to rich text (mark search terms) */ diff --git a/src/qtgui/uiprefs.ui b/src/qtgui/uiprefs.ui index 5b362f49..83a9eda5 100644 --- a/src/qtgui/uiprefs.ui +++ b/src/qtgui/uiprefs.ui @@ -16,1076 +16,1103 @@ 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... - - - - - - - - - - - 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 - - - - - - - - - - - - Suppress all beeps. - - - false - - - - - - - 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 - - - - - - - Show warning when opening temporary file. - - - true - - - - - - - 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 weigth). - - - 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... + + + + + + + + + + + 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 + + + + + + + + + + + + Suppress all beeps. + + + false + + + + + + + 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 + + + + + + + Show warning when opening temporary file. + + + true + + + + + + + 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 weigth). + + + 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 - - - - - - - - - + + + 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 4d152554..a06294ad 100644 --- a/src/qtgui/uiprefs_w.cpp +++ b/src/qtgui/uiprefs_w.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include "recoll.h" #include "guiutils.h" @@ -103,6 +104,10 @@ void UIPrefsDialog::init() // Update dialog state from stored prefs void UIPrefsDialog::setFromPrefs() { + // Most values are stored in the prefs struct. Some rarely used + // ones go directly through the settings + QSettings settings("Recoll.org", "recoll"); + // Entries per result page spinbox pageLenSB->setValue(prefs.respagesize); collapseDupsCB->setChecked(prefs.collapseDuplicates); @@ -144,6 +149,7 @@ void UIPrefsDialog::setFromPrefs() closeToTrayCB->setEnabled(showTrayIconCB->checkState()); closeToTrayCB->setChecked(prefs.closeToTray); showTempFileWarningCB->setChecked(prefs.showTempFileWarning == -1); + anchorTamilHackCB->setChecked(settings.value("anchorSpcHack", 0).toBool()); previewHtmlCB->setChecked(prefs.previewHtml); previewActiveLinksCB->setChecked(prefs.previewActiveLinks); switch (prefs.previewPlainPre) { @@ -262,6 +268,9 @@ void UIPrefsDialog::setupReslistFontPB() void UIPrefsDialog::accept() { + // Most values are stored in the prefs struct. Some rarely used + // ones go directly through the settings + QSettings settings("Recoll.org", "recoll"); prefs.noBeeps = noBeepsCB->isChecked(); prefs.ssearchNoComplete = ssNoCompleteCB->isChecked(); prefs.ssearchStartOnComplete = ssSearchOnCompleteCB->isChecked(); @@ -330,6 +339,7 @@ void UIPrefsDialog::accept() prefs.closeToTray = closeToTrayCB->isChecked(); prefs.showTempFileWarning = showTempFileWarningCB->isChecked() ? -1 : 1024; + settings.setValue("anchorSpcHack", anchorTamilHackCB->isChecked()); prefs.previewHtml = previewHtmlCB->isChecked(); prefs.previewActiveLinks = previewActiveLinksCB->isChecked();