BibleTime
src
frontend
searchdialog
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-2021 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"
20
#include "
analysis/csearchanalysisdialog.h
"
21
#include "../bttextbrowser.h"
22
23
24
namespace
Search
{
25
class
CModuleResultView;
26
class
CSearchResultView;
27
}
28
class
CSwordModuleInfo
;
29
class
QAction
;
30
class
QFrame
;
31
class
QHBoxLayout;
32
class
QMenu
;
33
class
QTreeWidget
;
34
35
namespace
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
*/
50
class
StrongsResult
{
51
public
:
// methods:
52
StrongsResult
() {}
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
*/
78
class
BtSearchResultArea
:
public
QWidget
{
79
Q_OBJECT
80
public
:
// methods:
81
BtSearchResultArea
(
QWidget
* parent =
nullptr
);
82
~BtSearchResultArea
()
override
{
saveDialogSettings
(); }
83
84
/**
85
* Sets the modules which contain the result of each.
86
*/
87
void
setSearchResult
(QString searchedText,
88
CSwordModuleSearch::Results
results);
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. */
105
void
showAnalysis
()
106
{
CSearchAnalysisDialog
(
m_searchedText
,
m_results
,
this
).exec(); }
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
*/
136
void
copySelection
() {
137
m_previewDisplay
->copy();
138
}
139
140
private
:
// fields:
141
QString
m_searchedText
;
142
CSwordModuleSearch::Results
m_results
;
143
144
CModuleResultView
*
m_moduleListBox
;
145
CSearchResultView
*
m_resultListBox
;
146
147
QFrame
*
m_displayFrame
;
148
149
QMenu
*
m_contextMenu
;
150
QAction
*
m_selectAllAction
;
151
QAction
*
m_copyAction
;
152
153
BtTextBrowser
*
m_previewDisplay
;
154
155
QSplitter *
m_mainSplitter
;
156
QSplitter *
m_resultListSplitter
;
157
};
158
159
}
//namespace Search
BtTextBrowser
A QTextBrowser subclass which adds the ability to start drags for references.
Definition:
bttextbrowser.h:24
CSwordModuleInfo
Definition:
cswordmoduleinfo.h:49
QAction
QFrame
QMenu
QTreeWidget
QWidget
Search::BtSearchResultArea
Definition:
btsearchresultarea.h:78
Search::BtSearchResultArea::loadDialogSettings
void loadDialogSettings()
Definition:
btsearchresultarea.cpp:254
Search::BtSearchResultArea::m_resultListBox
CSearchResultView * m_resultListBox
Definition:
btsearchresultarea.h:145
Search::BtSearchResultArea::m_searchedText
QString m_searchedText
Definition:
btsearchresultarea.h:141
Search::BtSearchResultArea::BtSearchResultArea
BtSearchResultArea(QWidget *parent=nullptr)
Definition:
btsearchresultarea.cpp:54
Search::BtSearchResultArea::m_moduleListBox
CModuleResultView * m_moduleListBox
Definition:
btsearchresultarea.h:144
Search::BtSearchResultArea::m_contextMenu
QMenu * m_contextMenu
Definition:
btsearchresultarea.h:149
Search::BtSearchResultArea::sizeHint
QSize sizeHint() const override
Definition:
btsearchresultarea.h:90
Search::BtSearchResultArea::updatePreview
void updatePreview(const QString &key)
Definition:
btsearchresultarea.cpp:156
Search::BtSearchResultArea::~BtSearchResultArea
~BtSearchResultArea() override
Definition:
btsearchresultarea.h:82
Search::BtSearchResultArea::setBrowserFont
void setBrowserFont(const CSwordModuleInfo *const module)
Definition:
btsearchresultarea.cpp:242
Search::BtSearchResultArea::m_copyAction
QAction * m_copyAction
Definition:
btsearchresultarea.h:151
Search::BtSearchResultArea::m_resultListSplitter
QSplitter * m_resultListSplitter
Definition:
btsearchresultarea.h:156
Search::BtSearchResultArea::showAnalysis
void showAnalysis()
Definition:
btsearchresultarea.h:105
Search::BtSearchResultArea::minimumSizeHint
QSize minimumSizeHint() const override
Definition:
btsearchresultarea.h:94
Search::BtSearchResultArea::m_selectAllAction
QAction * m_selectAllAction
Definition:
btsearchresultarea.h:150
Search::BtSearchResultArea::m_displayFrame
QFrame * m_displayFrame
Definition:
btsearchresultarea.h:147
Search::BtSearchResultArea::m_mainSplitter
QSplitter * m_mainSplitter
Definition:
btsearchresultarea.h:155
Search::BtSearchResultArea::saveDialogSettings
void saveDialogSettings() const
Definition:
btsearchresultarea.cpp:274
Search::BtSearchResultArea::setSearchResult
void setSearchResult(QString searchedText, CSwordModuleSearch::Results results)
Definition:
btsearchresultarea.cpp:130
Search::BtSearchResultArea::reset
void reset()
Definition:
btsearchresultarea.cpp:145
Search::BtSearchResultArea::m_results
CSwordModuleSearch::Results m_results
Definition:
btsearchresultarea.h:142
Search::BtSearchResultArea::clearPreview
void clearPreview()
Definition:
btsearchresultarea.cpp:151
Search::BtSearchResultArea::m_previewDisplay
BtTextBrowser * m_previewDisplay
Definition:
btsearchresultarea.h:153
Search::BtSearchResultArea::copySelection
void copySelection()
Definition:
btsearchresultarea.h:136
Search::CModuleResultView
Definition:
cmoduleresultview.h:36
Search::CSearchAnalysisDialog
Definition:
csearchanalysisdialog.h:31
Search::CSearchResultView
Definition:
csearchresultview.h:27
Search::StrongsResult
Definition:
btsearchresultarea.h:50
Search::StrongsResult::StrongsResult
StrongsResult(QString const &text, QString const &keyName)
Definition:
btsearchresultarea.h:53
Search::StrongsResult::keyText
const QString & keyText() const
Definition:
btsearchresultarea.h:60
Search::StrongsResult::m_text
QString m_text
Definition:
btsearchresultarea.h:70
Search::StrongsResult::StrongsResult
StrongsResult()
Definition:
btsearchresultarea.h:52
Search::StrongsResult::keyCount
int keyCount() const
Definition:
btsearchresultarea.h:61
Search::StrongsResult::m_keyNameList
QStringList m_keyNameList
Definition:
btsearchresultarea.h:71
Search::StrongsResult::addKeyName
void addKeyName(QString const &keyName)
Definition:
btsearchresultarea.h:62
Search::StrongsResult::getKeyList
QStringList const & getKeyList() const
Definition:
btsearchresultarea.h:67
csearchanalysisdialog.h
CSwordModuleSearch::Results
std::vector< ModuleSearchResult > Results
Definition:
cswordmodulesearch.h:50
Search
Definition:
bibletime.h:25
Generated by
1.9.1