GUI snippets window: add options for the max list length and for sorting the snippets by page number

This commit is contained in:
Jean-Francois Dockes
2019-06-28 14:20:47 +02:00
parent eb83ebfec6
commit 3ccd2364b9
13 changed files with 290 additions and 224 deletions
+7 -4
View File
@@ -164,10 +164,6 @@ void rwSettings(bool writing)
}
}
// Abstract snippet separator
SETTING_RW(prefs.abssep, "/Recoll/prefs/reslist/abssep", String,"…");
if (!writing && prefs.abssep == "")
prefs.abssep = "…";
SETTING_RW(prefs.reslistdateformat, "/Recoll/prefs/reslist/dateformat",
String," %Y-%m-%d %H:%M:%S %z");
if (!writing && prefs.reslistdateformat == "")
@@ -224,6 +220,13 @@ void rwSettings(bool writing)
Int, 250);
SETTING_RW(prefs.syntAbsCtx, "/Recoll/prefs/query/syntAbsCtx",
Int, 4);
// Abstract snippet separator
SETTING_RW(prefs.abssep, "/Recoll/prefs/reslist/abssep", String,"…");
if (!writing && prefs.abssep == "")
prefs.abssep = "…";
SETTING_RW(prefs.snipwMaxLength, "/Recoll/prefs/snipwin/maxlen", Int, 1000);
SETTING_RW(prefs.snipwSortByPage,"/Recoll/prefs/snipwin/bypage", Bool, false);
SETTING_RW(prefs.autoSuffs, "/Recoll/prefs/query/autoSuffs", String, "");
SETTING_RW(prefs.autoSuffsEnable,
"/Recoll/prefs/query/autoSuffsEnable", Bool, false);
+9 -6
View File
@@ -57,8 +57,6 @@ class PrefsPack {
QString reslistformat;
string creslistformat;
QString reslistheadertext;
// Abstract snippet separator
QString abssep;
// Date strftime format
QString reslistdateformat;
string creslistdateformat;
@@ -86,6 +84,15 @@ class PrefsPack {
// Abstract preferences. Building abstracts can slow result display
bool queryBuildAbstract;
bool queryReplaceAbstract;
// Synthetized abstract length (chars) and word context size (words)
int syntAbsLen;
int syntAbsCtx;
// Abstract snippet separator
QString abssep;
// Snippets window max list size
int snipwMaxLength;
// Snippets window sort by page (dflt: by weight)
bool snipwSortByPage;
bool startWithAdvSearchOpen;
// Try to display html if it exists in the internfile stack.
bool previewHtml;
@@ -122,10 +129,6 @@ class PrefsPack {
QStringList restableFields;
vector<int> restableColWidths;
// Synthetized abstract length and word context size
int syntAbsLen;
int syntAbsCtx;
// Remembered term match mode
int termMatchType;
+3 -1
View File
@@ -107,6 +107,7 @@ void SnippetsW::init()
connect(nextPB, SIGNAL(clicked()), this, SLOT(slotEditFindNext()));
connect(prevPB, SIGNAL(clicked()), this, SLOT(slotEditFindPrevious()));
delete browserw;
#if defined(USING_WEBKIT)
browserw = new QWebView(this);
verticalLayout->insertWidget(0, browserw);
@@ -165,7 +166,8 @@ void SnippetsW::init()
setWindowTitle(title);
vector<Rcl::Snippet> vpabs;
m_source->getAbstract(m_doc, vpabs);
m_source->getAbstract(m_doc, vpabs,
prefs.snipwMaxLength, prefs.snipwSortByPage);
HighlightData hdata;
m_source->getTerms(hdata);
+55 -9
View File
@@ -45,15 +45,15 @@
</item>
<item>
<widget class="QLineEdit" name="qtermStyleLE">
<property name="toolTip">
<string>Query terms highlighting in results. &lt;br&gt;Maybe try something like "color:red;background:yellow" for something more lively than the default blue...</string>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Query terms highlighting in results. &lt;br&gt;Maybe try something like &quot;color:red;background:yellow&quot; for something more lively than the default blue...</string>
</property>
</widget>
</item>
</layout>
@@ -137,12 +137,12 @@
</item>
<item>
<widget class="QCheckBox" name="previewActiveLinksCB">
<property name="toolTip">
<string>Make links inside the preview window clickable, and start an external browser when they are clicked.</string>
</property>
<property name="text">
<string>Activate links in preview.</string>
</property>
<property name="toolTip">
<string>Make links inside the preview window clickable, and start an external browser when they are clicked.</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
@@ -527,6 +527,52 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="snipwMaxLenLBL">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Maximum number of snippets displayed in the snippets window</string>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="snipwMaxLenSB">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10000000</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="snipwByPageCB">
<property name="text">
<string>Sort snippets by page number (default: by weigth).</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
@@ -903,12 +949,12 @@ May be slow for big documents.</string>
</item>
<item>
<widget class="QPushButton" name="ptransPB">
<property name="text">
<string>Paths translations</string>
</property>
<property name="toolTip">
<string>Set path translations for the selected index or for the main one if no selection exists.</string>
</property>
<property name="text">
<string>Paths translations</string>
</property>
</widget>
</item>
</layout>
+4 -1
View File
@@ -184,7 +184,8 @@ void UIPrefsDialog::setFromPrefs()
string nm = path_getsimple((const char *)snipCssFile.toLocal8Bit());
snipCssPB->setText(QString::fromLocal8Bit(nm.c_str()));
}
snipwMaxLenSB->setValue(prefs.snipwMaxLength);
snipwByPageCB->setChecked(prefs.snipwSortByPage);
paraFormat = prefs.reslistformat;
headerText = prefs.reslistheadertext;
@@ -301,6 +302,8 @@ void UIPrefsDialog::accept()
prefs.reslistformat = prefs.dfltResListFormat;
paraFormat = prefs.reslistformat;
}
prefs.snipwMaxLength = snipwMaxLenSB->value();
prefs.snipwSortByPage = snipwByPageCB->isChecked();
prefs.creslistformat = (const char*)prefs.reslistformat.toUtf8();