BibleTime
btsearchresultarea.h
Go to the documentation of this file.
1/*********
2*
3* In the name of the Father, and of the Son, and of the Holy Spirit.
4*
5* This file is part of BibleTime's source code, https://bibletime.info/
6*
7* Copyright 1999-2025 by the BibleTime developers.
8* The BibleTime source code is licensed under the GNU General Public License
9* version 2.0.
10*
11**********/
12
13#pragma once
14
15#include <QList>
16#include <QSplitter>
17#include <QStringList>
18#include <QWidget>
19#include "../../backend/cswordmodulesearch.h"
21#include "../bttextbrowser.h"
22
23
24namespace Search {
25class CModuleResultView;
26class CSearchResultView;
27}
29class QAction;
30class QFrame;
31class QHBoxLayout;
32class QMenu;
33class QTreeWidget;
34
35namespace Search {
36
37/**
38* This class is used to keep track of the text strongs results.
39* It only keeps track of one instance of a strongs text result.
40*
41* The functions of the class are:
42* - Store an instance of a strongs text result.
43* - Each strongs text result will contain a list of verses (keyNames).
44* - The number of verses (keyNames) is returned by keyCount().
45* - The text for the strongs text result is returned by keyText().
46* - The list of verses (keyNames) is returned by getKeyList() [as QStringList].
47*
48* To add a new verse to a strongs text result use addKeyName.
49*/
51 public: // methods:
53 StrongsResult(QString const & text,
54 QString const & keyName)
55 : m_text(text)
56 {
57 m_keyNameList.append(keyName);
58 }
59
60 const QString &keyText() const { return m_text; }
61 int keyCount() const { return m_keyNameList.count(); }
62 void addKeyName(QString const & keyName) {
63 if (m_keyNameList.contains(keyName)) return;
64 m_keyNameList.append(keyName);
65 }
66
67 QStringList const & getKeyList() const { return m_keyNameList; }
68
69 private: // fields:
70 QString m_text;
71 QStringList m_keyNameList;
72};
73
74
75/** The page of the search dialog which contains the search result part.
76 * @author The BibleTime team
77 */
79 Q_OBJECT
80 public: // methods:
81 BtSearchResultArea(QWidget * parent = nullptr);
83
84 /**
85 * Sets the modules which contain the result of each.
86 */
87 void setSearchResult(QString searchedText,
89
90 QSize sizeHint() const override {
91 return baseSize();
92 }
93
94 QSize minimumSizeHint() const override {
95 return minimumSize();
96 }
97
98 public Q_SLOTS:
99 /**
100 * Resets the current list of modules and the displayed list of found entries.
101 */
102 void reset();
103
104 /** Shows a dialog with the search analysis of the current search. */
107
108 protected: // methods:
109
110 /**
111 * Load the settings from the resource file
112 */
113 void loadDialogSettings();
114
115 /**
116 * Save the settings to the resource file
117 */
118 void saveDialogSettings() const;
119
120 void setBrowserFont(const CSwordModuleInfo* const module);
121
122 protected Q_SLOTS:
123 /**
124 * Update the preview of the selected key.
125 */
126 void updatePreview(const QString& key);
127
128 /**
129 * Clear the preview of the selected key.
130 */
131 void clearPreview();
132
133 /**
134 * Copy selected text
135 */
137 m_previewDisplay->copy();
138 }
139
140 private: // fields:
143
146
148
152
154
155 QSplitter *m_mainSplitter;
157};
158
159} //namespace Search
A QTextBrowser subclass which adds the ability to start drags for references.
CSearchResultView * m_resultListBox
CModuleResultView * m_moduleListBox
QSize sizeHint() const override
void updatePreview(const QString &key)
void setBrowserFont(const CSwordModuleInfo *const module)
QSize minimumSizeHint() const override
void setSearchResult(QString searchedText, CSwordModuleSearch::Results results)
CSwordModuleSearch::Results m_results
StrongsResult(QString const &text, QString const &keyName)
const QString & keyText() const
void addKeyName(QString const &keyName)
QStringList const & getKeyList() const
std::vector< ModuleSearchResult > Results