/********* * * This file is part of BibleTime's source code, http://www.bibletime.info/. * * Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ #include "frontend/searchdialog/btsearchsyntaxhelpdialog.h" #include #include #include #include #include "frontend/messagedialog.h" #include "util/directory.h" namespace Search { BtSearchSyntaxHelpDialog::BtSearchSyntaxHelpDialog(QWidget *parent, Qt::WindowFlags wflags) : QDialog(parent, wflags) { resize(550, 340); QVBoxLayout *l = new QVBoxLayout; m_webView = new QWebView(this); m_webView->page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks); connect(m_webView, SIGNAL(linkClicked(QUrl)), this, SLOT(linkClicked(QUrl))); l->addWidget(m_webView); m_buttons = new QDialogButtonBox(QDialogButtonBox::Close, Qt::Horizontal, this); connect(m_buttons, SIGNAL(rejected()), this, SLOT(reject())); l->addWidget(m_buttons); setLayout(l); retranslateUi(); } void BtSearchSyntaxHelpDialog::retranslateUi() { namespace DU = util::directory; QString theTitle(tr("Search Syntax Help")); setWindowTitle(theTitle); QString html(""); html += theTitle; html += "

"; html += tr("This help is mainly for 'Full syntax' option. 'All words' and 'Some words' " "options have more limited syntax; wildcards and " "text fields are supported for them. Some other syntax " "features may give strange or wrong results with All words/Some words."); html += "

"; html += tr("Which words to find"); html += "

"; html += tr("Search terms are separated by spaces. AND (all words), " "OR (some words) and NOT (not the following word) " "can be added between the words. If none is added explicitly OR is used " "automatically. '+word' means the word must be in the results, " "'-word' means it must not be in the results.", "Do not translate \"AND\", \"OR\" or \"NOT\"."); html += "

"; html += tr("jesus AND god", "Do not translate \"AND\"."); html += ""; html += tr("Finds verses with both 'Jesus' and 'God'"); html += "
"; html += tr("jesus OR god", "Do not translate \"OR\"."); html += ""; html += tr("Finds verses with 'Jesus' or 'God' or both"); html += "
"; html += tr("jesus NOT god", "Do not translate \"NOT\"."); html += ""; html += tr("Finds verses with 'Jesus' but with no 'God'"); html += "
"; html += tr("+jesus -god"); html += ""; html += tr("Finds verses with 'Jesus' but with no 'God'"); html += "

"; html += tr("Grouping and order"); html += "

"; html += tr("Words can be grouped with parenthesis. Strict word order " "can be defined with quotes."); html += "

"; html += tr("(a AND b) OR c", "Do not translate \"AND\" or \"OR\"."); html += ""; html += tr("Finds verses with both 'a' AND 'b', and verses with 'c'"); html += "
"; html += tr("\"says lord\""); html += ""; html += ("Finds e.g. '...Isaiah says, \"Lord...' but not '...says the LORD'"); html += "
"; html += tr("\"says the lord\""); html += ""; html += tr("Finds all verses with 'says the LORD'"); html += "

"; html += tr("Wildcards (partial words)"); html += "

"; html += tr("'*' matches any sequence of 0 or more characters, while " "'?' matches any single character. A wildcard can not be used in " "the beginning of a word."); html += "

"; html += tr("a*"); html += ""; html += tr("All words beginning with 'a'"); html += "
"; html += tr("a*a"); html += ""; html += tr("'Assyria', 'aroma', 'abba' etc."); html += "
"; html += tr("a?"); html += ""; html += tr("'at' and 'an'"); html += "
"; html += tr("a??a"); html += ""; html += tr("'abba', 'area', 'Asia' etc."); html += "

"; html += tr("Text fields (different parts of text)"); html += "

"; html += tr("Available text fields:" ); html += "
heading:"; html += tr("Searches headings"); html += "
footnote:"; html += tr("Searches footnotes"); html += "
strong:"; html += tr("Searches Strong's numbers"); html += "
morph:"; html += tr("Searches morphology codes"); html += "

"; html += tr("Examples:" ); html += "
"; html += tr("heading:Jesus", "Do not translate \"heading:\"."); html += ""; html += tr("Finds headings with 'Jesus'"); html += "
"; html += tr("footnote:Jesus AND footnote:said", "Do not translate \"footnote:\" or \"AND\"."); html += ""; html += tr("Finds footnotes with 'Jesus' and 'said'"); html += "
"; html += tr("strong:G846", "Do not translate \"strong:\"."); html += ""; html += tr("Finds verses with Strong's Greek number 846"); html += "
"; html += tr("morph:\"N-NSF\"", "Do not translate \"morph:\"."); html += ""; html += tr("Finds verses with morphology code 'N-NSF'"); html += "

"; html += tr("Other syntax features"); html += "

"; html += tr("BibleTime uses the CLucene search engine. You can read more on the " "lucene syntax web page (in external browser).") .arg("http://lucene.apache.org/java/1_4_3/queryparsersyntax.html"); html += "

"; m_webView->setHtml(html, QUrl::fromLocalFile(DU::getIconDir().path())); message::prepareDialogBox(m_buttons); } void BtSearchSyntaxHelpDialog::linkClicked(const QUrl &url) { QDesktopServices::openUrl(url); } } // namespace Search