Modified the query language help tooltip to table form, hopefully improved

This commit is contained in:
Jean-Francois Dockes 2019-10-03 11:03:47 +02:00
parent 05354373e1
commit 8a9fe576a2
4 changed files with 79 additions and 14 deletions

View File

@ -298,20 +298,43 @@ void SSearch::searchTypeChanged(int typ)
switch (typ) {
case SST_LANG:
queryText->setToolTip(
tr(
"Enter query language expression. Cheat sheet:<br>\n"
"<i>term1 term2</i> : 'term1' and 'term2' in any field.<br>\n"
"<i>field:term1</i> : 'term1' in field 'field'.<br>\n"
" Standard field names/synonyms:<br>\n"
" title/subject/caption, author/from, recipient/to, filename, ext.<br>\n"
" Pseudo-fields: dir, mime/format, type/rclcat, date, size.<br>\n"
" Two date interval exemples: 2009-03-01/2009-05-20 2009-03-01/P2M.<br>\n"
"<i>term1 term2 OR term3</i> : term1 AND (term2 OR term3).<br>\n"
" You can use parentheses to make things clearer.<br>\n"
"<i>\"term1 term2\"</i> : phrase (must occur exactly). Possible modifiers:<br>\n"
"<i>\"term1 term2\"p</i> : unordered proximity search with default distance.<br>\n"
"Use <b>Show Query</b> link when in doubt about result and see manual (&lt;F1>) for more detail.\n"
));
// Do not modify the text here, test with the
// sshelp/qhelp.html file and a browser, then use
// sshelp/helphtmltoc.sh to turn to code and insert here
tr("<html><head><style>") +
tr("table, th, td {") +
tr("border: 1px solid black;") +
tr("border-collapse: collapse;") +
tr("}") +
tr("th,td {") +
tr("text-align: center;") +
tr("}") +
tr("</style></head><body>") +
tr("<p>Query language cheat-sheet. In doubt: click <b>Show Query</b>.&nbsp;") +
tr("You should really look at the manual (F1)</p>") +
tr("<table border='1' cellspacing='0'>") +
tr("<tr><th>What</th><th>Examples</th>") +
tr("<tr><td>And</td><td>one two&nbsp;&nbsp;&nbsp;one AND two&nbsp;&nbsp;&nbsp;one && two</td></tr>") +
tr("<tr><td>Or</td><td>one OR two&nbsp;&nbsp;&nbsp;one || two</td></tr>") +
tr("<tr><td>Complex boolean. OR has priority, use parentheses&nbsp;") +
tr("where needed</td><td>(one AND two) OR three</td></tr>") +
tr("<tr><td>Not</td><td>-term</td></tr>") +
tr("<tr><td>Phrase</td><td>\"pride and prejudice\"</td></tr>") +
tr("<tr><td>Ordered proximity (slack=1)</td><td>\"pride prejudice\"o1</td></tr>") +
tr("<tr><td>Unordered proximity (slack=1)</td><td>\"prejudice pride\"po1</td></tr>") +
tr("<tr><td>Unordered prox. (default slack=10)</td><td>\"prejudice&nbsp;pride\"p</td></tr>") +
tr("<tr><td>No stem expansion: capitalize</td><td>Floor</td></tr>") +
tr("<tr><td>Field-specific</td><td>author:austen&nbsp;&nbsp;title:prejudice</td></tr>") +
tr("<tr><td>AND inside field (no order)</td><td>author:jane,austen</td></tr>") +
tr("<tr><td>OR inside field</td><td>author:austen/bronte</td></tr>") +
tr("<tr><td>Field names</td><td>title/subject/caption&nbsp;&nbsp;author/from<br>recipient/to&nbsp;&nbsp;filename&nbsp;&nbsp;ext</td></tr>") +
tr("<tr><td>Directory path filter</td><td>dir:/home/me&nbsp;&nbsp;dir:doc</td></tr>") +
tr("<tr><td>MIME type filter</td><td>mime:text/plain mime:video/*</td></tr>") +
tr("<tr><td>Date intervals</td><td>date:2018-01-01/2018-31-12<br>") +
tr("date:2018&nbsp;&nbsp;date:2018-01-01/P12M</td></tr>") +
tr("<tr><td>Size</td><td>size&gt;100k size&lt;1M</td></tr>") +
tr("</table></body></html>")
);
break;
case SST_FNM:
queryText->setToolTip(tr("Enter file name wildcard expression."));

View File

@ -0,0 +1,2 @@
Simple search query language tooltip. Try it out in the html file, then
use helphtmltoc.sh to turn it into code.

View File

@ -0,0 +1,7 @@
#!/bin/sh
fn=qhelp.html
while read line; do
line=`echo $line| sed -e 's/"/\\\\"/g'`
echo 'tr('"\"$line\""')' +
done < $fn

View File

@ -0,0 +1,33 @@
<html><head><style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th,td {
text-align: center;
}
</style></head><body>
<p>Query language cheat-sheet. In doubt: click <b>Show Query</b>.&nbsp;
You should really look at the manual (F1)</p>
<table border='1' cellspacing='0'>
<tr><th>What</th><th>Examples</th>
<tr><td>And</td><td>one two&nbsp;&nbsp;&nbsp;one AND two&nbsp;&nbsp;&nbsp;one && two</td></tr>
<tr><td>Or</td><td>one OR two&nbsp;&nbsp;&nbsp;one || two</td></tr>
<tr><td>Complex boolean. OR has priority, use parentheses&nbsp;
where needed</td><td>(one AND two) OR three</td></tr>
<tr><td>Not</td><td>-term</td></tr>
<tr><td>Phrase</td><td>"pride and prejudice"</td></tr>
<tr><td>Ordered proximity (slack=1)</td><td>"pride prejudice"o1</td></tr>
<tr><td>Unordered proximity (slack=1)</td><td>"prejudice pride"po1</td></tr>
<tr><td>Unordered prox. (default slack=10)</td><td>"prejudice&nbsp;pride"p</td></tr>
<tr><td>No stem expansion: capitalize</td><td>Floor</td></tr>
<tr><td>Field-specific</td><td>author:austen&nbsp;&nbsp;title:prejudice</td></tr>
<tr><td>AND inside field (no order)</td><td>author:jane,austen</td></tr>
<tr><td>OR inside field</td><td>author:austen/bronte</td></tr>
<tr><td>Field names</td><td>title/subject/caption&nbsp;&nbsp;author/from<br>recipient/to&nbsp;&nbsp;filename&nbsp;&nbsp;ext</td></tr>
<tr><td>Directory path filter</td><td>dir:/home/me&nbsp;&nbsp;dir:doc</td></tr>
<tr><td>MIME type filter</td><td>mime:text/plain mime:video/*</td></tr>
<tr><td>Date intervals</td><td>date:2018-01-01/2018-31-12<br>
date:2018&nbsp;&nbsp;date:2018-01-01/P12M</td></tr>
<tr><td>Size</td><td>size&gt;100k size&lt;1M</td></tr>
</table></body></html>