From 7878db7dbe072f334257cf6a0277ebdda161b2ce Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Tue, 16 Mar 2021 09:52:14 +0100 Subject: [PATCH] Add pref for using click vs shift+click to display text in restable detail area. Compactify prefs pane --- src/qtgui/guiutils.cpp | 16 ++-- src/qtgui/guiutils.h | 1 + src/qtgui/restable.cpp | 12 ++- src/qtgui/uiprefs.ui | 174 ++++++++++++++++++++++++---------------- src/qtgui/uiprefs_w.cpp | 2 + 5 files changed, 124 insertions(+), 81 deletions(-) diff --git a/src/qtgui/guiutils.cpp b/src/qtgui/guiutils.cpp index 391d7bc0..09f26aec 100644 --- a/src/qtgui/guiutils.cpp +++ b/src/qtgui/guiutils.cpp @@ -291,25 +291,21 @@ void rwSettings(bool writing) "/Recoll/prefs/query/asearchIgnFilTyps").toStringList(); } - SETTING_RW(prefs.fileTypesByCats, "/Recoll/prefs/query/asearchFilTypByCat", - Bool, false); + SETTING_RW(prefs.fileTypesByCats, "/Recoll/prefs/query/asearchFilTypByCat", Bool, false); SETTING_RW(prefs.noClearSearch, "/Recoll/prefs/noClearSearch", Bool, false); SETTING_RW(prefs.noToolbars, "/Recoll/prefs/noToolbars", Bool, false); SETTING_RW(prefs.noStatusBar, "/Recoll/prefs/noStatusBar", Bool, false); SETTING_RW(prefs.noMenuBar, "/Recoll/prefs/noMenuBar", Bool, false); SETTING_RW(prefs.noSSTypCMB, "/Recoll/prefs/noSSTypCMB", Bool, false); - SETTING_RW(prefs.noResTableHeader, "/Recoll/prefs/noResTableHeader", - Bool, false); - SETTING_RW(prefs.showResTableVHeader, "/Recoll/prefs/showResTableVHeader", - Bool, false); - SETTING_RW(prefs.noResTableRowJumpSC, "/Recoll/prefs/noResTableRowJumpSC", - Bool, false); + SETTING_RW(prefs.resTableTextNoShift, "/Recoll/prefs/resTableTextNoShift", Bool, false); + SETTING_RW(prefs.noResTableHeader, "/Recoll/prefs/noResTableHeader", Bool, false); + SETTING_RW(prefs.showResTableVHeader, "/Recoll/prefs/showResTableVHeader", Bool, false); + SETTING_RW(prefs.noResTableRowJumpSC, "/Recoll/prefs/noResTableRowJumpSC", Bool, false); SETTING_RW(prefs.showTrayIcon, "/Recoll/prefs/showTrayIcon", Bool, false); SETTING_RW(prefs.closeToTray, "/Recoll/prefs/closeToTray", Bool, false); SETTING_RW(prefs.trayMessages, "/Recoll/prefs/trayMessages", Bool, false); // See qxtconfirmationmessage. Needs to be -1 for the dialog to show. - SETTING_RW(prefs.showTempFileWarning, "Recoll/prefs/showTempFileWarning", - Int, -1); + SETTING_RW(prefs.showTempFileWarning, "Recoll/prefs/showTempFileWarning", Int, -1); if (g_dynconf == 0) { // Happens diff --git a/src/qtgui/guiutils.h b/src/qtgui/guiutils.h index 62721b23..e3fcb0f1 100644 --- a/src/qtgui/guiutils.h +++ b/src/qtgui/guiutils.h @@ -145,6 +145,7 @@ public: bool noStatusBar{false}; bool noMenuBar{false}; bool noSSTypCMB{false}; + bool resTableTextNoShift{false}; bool noResTableHeader{false}; bool showResTableVHeader{false}; bool noResTableRowJumpSC{false}; diff --git a/src/qtgui/restable.cpp b/src/qtgui/restable.cpp index 7d369f60..ad0e783c 100644 --- a/src/qtgui/restable.cpp +++ b/src/qtgui/restable.cpp @@ -103,8 +103,16 @@ bool ResTablePager::append(const string& data) m_data += data; return true; } + bool ResTablePager::flush() { +#ifdef helps_discoverability_of_shiftclick_but_is_ennoying + QString msg = QApplication::translate( + "ResTable", "Use Shift+click to display the text instead."); + if (!prefs.resTableTextNoShift) { + m_data += std::string("

") + qs2utf8s(msg) + "

"; + } +#endif m_parent->m_detail->setHtml(u8s2qs(m_data)); m_data = ""; return true; @@ -881,7 +889,9 @@ void ResTable::onTableView_currentChanged(const QModelIndex& index) m_detaildocnum = index.row(); m_detaildoc = doc; Qt::KeyboardModifiers mods = QApplication::keyboardModifiers(); - if (tableView->selectionModel()->hasSelection() && (mods &= Qt::ShiftModifier)) { + bool showtext = (mods &= Qt::ShiftModifier); + showtext ^= prefs.resTableTextNoShift; + if (tableView->selectionModel()->hasSelection() && showtext) { bool loadok = rcldb->getDocRawText(m_detaildoc); if (loadok) { m_detail->setText(u8s2qs(m_detaildoc.text)); diff --git a/src/qtgui/uiprefs.ui b/src/qtgui/uiprefs.ui index c4bb871d..d7636f23 100644 --- a/src/qtgui/uiprefs.ui +++ b/src/qtgui/uiprefs.ui @@ -7,7 +7,7 @@ 0 0 700 - 850 + 760 @@ -189,39 +189,79 @@ - - - Hide toolbars. - - - false - - + + + + + Hide some user interface elements. + + + Hide: + + + + + + + Toolbars + + + false + + + + + + + Status bar + + + false + + + + + + + Show button instead. + + + Menu bar + + + false + + + + + + + Show choice in menu only. + + + Simple search type + + + false + + + + + + + Clear/Search buttons + + + false + + + + - + - Hide status bar. - - - false - - - - - - - Hide menu bar (show button instead). - - - false - - - - - - - Hide simple search type (show in menu only). + Show text contents when clicking result table row (else use Shift+click). false @@ -259,44 +299,38 @@ - - - Hide Clear and Search buttons. - - - false - - - - - - - Show system tray icon. - - - false - - - - - - - Close to tray instead of exiting. - - - false - - - - - - - Generate desktop notifications. - - - false - - + + + + + Show system tray icon. + + + false + + + + + + + Close to tray instead of exiting. + + + false + + + + + + + Generate desktop notifications. + + + false + + + + @@ -1527,7 +1561,7 @@ May be slow for big documents. - + diff --git a/src/qtgui/uiprefs_w.cpp b/src/qtgui/uiprefs_w.cpp index 7621ae1a..e7b11314 100644 --- a/src/qtgui/uiprefs_w.cpp +++ b/src/qtgui/uiprefs_w.cpp @@ -158,6 +158,7 @@ void UIPrefsDialog::setFromPrefs() noStatusBarCB->setChecked(prefs.noStatusBar); noMenuBarCB->setChecked(prefs.noMenuBar); noSSTypCMBCB->setChecked(prefs.noSSTypCMB); + restabShowTxtNoShiftCB->setChecked(prefs.resTableTextNoShift); noResTableHeaderCB->setChecked(prefs.noResTableHeader); showResTableVHeaderCB->setChecked(prefs.showResTableVHeader); noRowJumpShortcutsCB->setChecked(prefs.noResTableRowJumpSC); @@ -432,6 +433,7 @@ void UIPrefsDialog::accept() prefs.noMenuBar = noMenuBarCB->isChecked(); m_mainWindow->setupMenus(); prefs.noSSTypCMB = noSSTypCMBCB->isChecked(); + prefs.resTableTextNoShift = restabShowTxtNoShiftCB->isChecked(); prefs.noResTableHeader = noResTableHeaderCB->isChecked(); prefs.showResTableVHeader = showResTableVHeaderCB->isChecked(); prefs.noResTableRowJumpSC = noRowJumpShortcutsCB->isChecked();