GUI: preferences: separate tab for result table preferences. Add option to disable showing meta while hovering. Show doc text on ctrl+... if this is the default for a mouse click (no Shift)

This commit is contained in:
Jean-Francois Dockes 2021-04-10 15:26:00 +02:00
parent 289e781d90
commit 8603409def
6 changed files with 124 additions and 76 deletions

View File

@ -307,6 +307,7 @@ void rwSettings(bool writing)
SETTING_RW(prefs.noMenuBar, "/Recoll/prefs/noMenuBar", Bool, false);
SETTING_RW(prefs.noSSTypCMB, "/Recoll/prefs/noSSTypCMB", Bool, false);
SETTING_RW(prefs.resTableTextNoShift, "/Recoll/prefs/resTableTextNoShift", Bool, false);
SETTING_RW(prefs.resTableNoHoverMeta, "/Recoll/prefs/resTableNoHoverMeta", 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);

View File

@ -153,6 +153,7 @@ public:
bool noMenuBar{false};
bool noSSTypCMB{false};
bool resTableTextNoShift{false};
bool resTableNoHoverMeta{false};
bool noResTableHeader{false};
bool showResTableVHeader{false};
bool noResTableRowJumpSC{false};

View File

@ -326,7 +326,7 @@ void RclMain::showUIPrefs()
void RclMain::showExtIdxDialog()
{
showUIPrefs();
uiprefs->tabWidget->setCurrentIndex(4);
uiprefs->tabWidget->setCurrentIndex(5);
}
void RclMain::showAboutDialog()

View File

@ -706,14 +706,14 @@ void ResTable::onNewShortcuts()
auto sc = new QShortcut(QKeySequence(qs2utf8s(qs).c_str()), this);
m_rowlinks.push_back(new SCData(this, setrow, i));
m_rowsc.push_back(sc);
connect(sc, SIGNAL(activated()),m_rowlinks.back(),SLOT(activate()));
connect(sc, SIGNAL(activated()), m_rowlinks.back(), SLOT(activate()));
if (i > 9)
continue;
qs = QString("Ctrl+%1").arg(i);
sc = new QShortcut(QKeySequence(qs2utf8s(qs).c_str()), this);
m_rowsc.push_back(sc);
m_rowlinks.push_back(new SCData(this, setrow, i));
connect(sc, SIGNAL(activated()),m_rowlinks.back(),SLOT(activate()));
connect(sc, SIGNAL(activated()), m_rowlinks.back(), SLOT(activate()));
}
}
SETSHORTCUT(this, "restable:704", tr("Result Table"),
@ -891,8 +891,10 @@ void ResTable::saveColState()
void ResTable::onTableView_currentChanged(const QModelIndex& index)
{
bool hasselection = tableView->selectionModel()->hasSelection();
LOGDEB2("ResTable::onTableView_currentChanged(" << index.row() << ", " <<
index.column() << ") from kbd " << m_rowchangefromkbd << "\n");
index.column() << ") from kbd " << m_rowchangefromkbd << " hasselection " <<
hasselection << "\n");
if (!m_model || !m_model->getDocSource())
return;
@ -901,18 +903,30 @@ void ResTable::onTableView_currentChanged(const QModelIndex& index)
m_detail->init();
m_detaildocnum = index.row();
m_detaildoc = doc;
bool isShift = (QApplication::keyboardModifiers() & Qt::ShiftModifier) &&
!m_rowchangefromkbd;
bool showtext = isShift ^ prefs.resTableTextNoShift;
if (tableView->selectionModel()->hasSelection() && showtext) {
m_rowchangefromkbd = false;
bool loadok = rcldb->getDocRawText(m_detaildoc);
if (loadok) {
m_detail->setPlainText(u8s2qs(m_detaildoc.text));
bool isShift = (QApplication::keyboardModifiers() & Qt::ShiftModifier);
bool showtext{false};
bool showmeta{false};
if (m_rowchangefromkbd) {
// Ctrl+... jump to row. Show text/meta as for simple click
if (hasselection) {
// When getting here from ctrl+... we get called twice, once with row 0
// and no selection, once with the actual row and selection. Only
// reset fromkbd and set showtext in the second case.
m_rowchangefromkbd = false;
showtext = prefs.resTableTextNoShift;
}
} else {
m_pager->displaySingleDoc(theconfig, m_detaildocnum, m_detaildoc,
m_model->m_hdata);
} else {
// Mouse click. Show text or meta depending on shift key. Never show text when hovering
// (no selection).
showtext = hasselection && (isShift ^ prefs.resTableTextNoShift);
}
if (!showtext) {
showmeta = hasselection || !prefs.resTableNoHoverMeta;
}
if (showtext && rcldb->getDocRawText(m_detaildoc)) {
m_detail->setPlainText(u8s2qs(m_detaildoc.text));
} else if (showmeta) {
m_pager->displaySingleDoc(theconfig, m_detaildocnum, m_detaildoc, m_model->m_hdata);
}
emit(detailDocChanged(doc, m_model->getDocSource()));
} else {

View File

@ -22,7 +22,7 @@
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<widget class="QWidget" name="tab_ui">
<attribute name="title">
<string>User interface</string>
</attribute>
@ -258,61 +258,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="restabShowTxtLBL">
<property name="text">
<string>To display document text instead of metadata in result table detail area, use:</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="restabShowTxtNoShiftRB">
<property name="text">
<string>left mouse click</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="restabShowTxtShiftRB">
<property name="text">
<string>Shift+click</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="noResTableHeaderCB">
<property name="text">
<string>Hide result table header.</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showResTableVHeaderCB">
<property name="text">
<string>Show result table row headers.</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="noRowJumpShortcutsCB">
<property name="text">
<string>Disable the Ctrl+[0-9]/Shift+[a-z] shortcuts for jumping to table rows.</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
@ -628,7 +573,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="sctab">
<widget class="QWidget" name="tab_shortcuts">
<attribute name="title">
<string>Shortcuts</string>
</attribute>
@ -673,7 +618,7 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<widget class="QWidget" name="tab_reslist">
<attribute name="title">
<string>Result List</string>
</attribute>
@ -988,7 +933,92 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab1">
<widget class="QWidget" name="tab_restable">
<attribute name="title">
<string>Result Table</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_rst3">
<item>
<widget class="QCheckBox" name="noResTableHeaderCB">
<property name="text">
<string>Hide result table header.</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="showResTableVHeaderCB">
<property name="text">
<string>Show result table row headers.</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="noRowJumpShortcutsCB">
<property name="text">
<string>Disable the Ctrl+[0-9]/Shift+[a-z] shortcuts for jumping to table rows.</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="restabShowTxtLBL">
<property name="text">
<string>To display document text instead of metadata in result table detail area, use:</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="restabShowTxtNoShiftRB">
<property name="text">
<string>left mouse click</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="restabShowTxtShiftRB">
<property name="text">
<string>Shift+click</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="resTableNoHoverMetaCB">
<property name="text">
<string>Do not display metadata when hovering over rows.</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_rst2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_search">
<attribute name="title">
<string>Search parameters</string>
</attribute>
@ -1386,7 +1416,7 @@ May be slow for big documents.</string>
</item>
</layout>
</widget>
<widget class="QWidget" name="ExtraDb">
<widget class="QWidget" name="tab_extradbs">
<attribute name="title">
<string>External Indexes</string>
</attribute>
@ -1492,7 +1522,7 @@ May be slow for big documents.</string>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<widget class="QWidget" name="tab_misc">
<attribute name="title">
<string>Misc</string>
</attribute>

View File

@ -159,6 +159,7 @@ void UIPrefsDialog::setFromPrefs()
noSSTypCMBCB->setChecked(prefs.noSSTypCMB);
restabShowTxtNoShiftRB->setChecked(prefs.resTableTextNoShift);
restabShowTxtShiftRB->setChecked(!prefs.resTableTextNoShift);
resTableNoHoverMetaCB->setChecked(prefs.resTableNoHoverMeta);
noResTableHeaderCB->setChecked(prefs.noResTableHeader);
showResTableVHeaderCB->setChecked(prefs.showResTableVHeader);
noRowJumpShortcutsCB->setChecked(prefs.noResTableRowJumpSC);
@ -437,6 +438,7 @@ void UIPrefsDialog::accept()
m_mainWindow->setupMenus();
prefs.noSSTypCMB = noSSTypCMBCB->isChecked();
prefs.resTableTextNoShift = restabShowTxtNoShiftRB->isChecked();
prefs.resTableNoHoverMeta = resTableNoHoverMetaCB->isChecked();
prefs.noResTableHeader = noResTableHeaderCB->isChecked();
prefs.showResTableVHeader = showResTableVHeaderCB->isChecked();
prefs.noResTableRowJumpSC = noRowJumpShortcutsCB->isChecked();