15 #include <QApplication>
18 #include <QPushButton>
21 #include <QStringList>
22 #include <QVBoxLayout>
24 #include "../../backend/config/btconfig.h"
25 #include "../../backend/drivers/cswordmoduleinfo.h"
26 #include "../../backend/managers/colormanager.h"
27 #include "../../backend/keys/cswordversekey.h"
28 #include "../../backend/rendering/cdisplayrendering.h"
29 #include "../../util/btassert.h"
30 #include "../../util/btconnect.h"
31 #include "../../util/tool.h"
36 #pragma GCC diagnostic push
37 #pragma GCC diagnostic ignored "-Wextra-semi"
38 #pragma GCC diagnostic ignored "-Wsuggest-override"
39 #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
41 #pragma GCC diagnostic pop
46 QStringLiteral(
"GUI/SearchDialog/SearchResultsArea/mainSplitterSizes");
49 "GUI/SearchDialog/SearchResultsArea/resultSplitterSizes");
57 QVBoxLayout *mainLayout;
59 QVBoxLayout *resultListsWidgetLayout;
65 mainLayout =
new QVBoxLayout(
this);
71 resultListsWidgetLayout =
new QVBoxLayout(resultListsWidget);
72 resultListsWidgetLayout->setContentsMargins(0, 0, 0, 0);
112 frameLayout->setContentsMargins(0, 0, 0, 0);
115 m_previewDisplay->setToolTip(tr(
"Text of the selected search result item"));
153 QStringLiteral(
"<html><head/><body></body></html>"));
165 modules.append(module);
176 static_cast<sword::VerseKey *
>(module->
swordModule().getKey())
184 if (vk.
verse() == 1) {
191 auto const startKey = vk;
198 settings.
keyRenderingFace = CTextRendering::KeyTreeItem::Settings::CompleteShort;
199 text = render.
renderKeyRange(startKey, vk, modules, key, settings);
208 static_cast<sword::VerseKey *
>(module->
swordModule().getKey())
212 if (vk.
verse() == 1) {
218 auto const startKey = vk;
223 text = render.
renderKeyRange(startKey, vk, modules, key, settings);
229 if (modules.count() > 0)
234 text2.replace(QStringLiteral(
"#CHAPTERTITLE#"), QString());
235 text2.replace(QStringLiteral(
"#TEXT_ALIGN#"), QStringLiteral(
"left"));
238 m_previewDisplay->scrollToAnchor( CDisplayRendering::keyToHTMLAnchor(key) );
244 auto const lang = module->
language();
256 if (mainSplitterSizes.count() > 0)
260 int w = this->size().width();
262 mainSplitterSizes << w2 << w - w2;
267 if (resultSplitterSizes.count() > 0)
BtConfig & btConfig()
This is a shortchand for BtConfig::getInstance().
QList< CSwordModuleInfo const * > BtConstModuleList
T value(QString const &key, T const &defaultValue=T()) const
Returns the settings value for the given global key.
void setValue(QString const &key, T const &value)
Sets a value for a key.
A QTextBrowser subclass which adds the ability to start drags for references.
std::shared_ptr< Language const > language() const
sword::SWModule & swordModule() const
CSwordKey implementation for Sword's VerseKey.
bool next(const JumpType type=JumpType::UseVerse)
bool previous(const JumpType type=JumpType::UseVerse)
bool setKey(const QString &key) final override
Rendering for the html display widget.
QString renderSingleKey(const QString &key, const BtConstModuleList &modules, const KeyTreeItem::Settings &settings=KeyTreeItem::Settings())
QString renderKeyRange(CSwordVerseKey const &lowerBound, CSwordVerseKey const &upperBound, const BtConstModuleList &modules, const QString &hightlightKey=QString(), const KeyTreeItem::Settings &settings=KeyTreeItem::Settings())
void loadDialogSettings()
CSearchResultView * m_resultListBox
BtSearchResultArea(QWidget *parent=nullptr)
CModuleResultView * m_moduleListBox
void updatePreview(const QString &key)
void setBrowserFont(const CSwordModuleInfo *const module)
QSplitter * m_resultListSplitter
QAction * m_selectAllAction
QSplitter * m_mainSplitter
void saveDialogSettings() const
void setSearchResult(QString searchedText, CSwordModuleSearch::Results results)
CSwordModuleSearch::Results m_results
BtTextBrowser * m_previewDisplay
CSwordModuleInfo * activeModule()
QSize sizeHint() const override
void strongsSelected(CSwordModuleInfo *, const QStringList &)
void setupTree(const CSwordModuleSearch::Results &results, const QString &searchedText)
void moduleSelected(CSwordModuleInfo const *, CSwordModuleSearch::ModuleResultList const &)
void setupStrongsTree(CSwordModuleInfo *, const QStringList &)
void keySelected(const QString &)
void setupTree(CSwordModuleInfo const *m, CSwordModuleSearch::ModuleResultList const &results)
QString highlightSearchedText(QString const &content, QString const &searchedText, bool plainSearchedText)
std::vector< ModuleSearchResult > Results
QString replaceColors(QString content)
auto const ResultSplitterSizesKey
auto const MainSplitterSizesKey
KeyRenderingFace keyRenderingFace