16 #include <QFormLayout>
18 #include <QSizePolicy>
19 #include <QStringList>
20 #include <QVBoxLayout>
21 #include "../../backend/config/btconfig.h"
22 #include "../../backend/drivers/cswordlexiconmoduleinfo.h"
23 #include "../../backend/drivers/cswordmoduleinfo.h"
24 #include "../../backend/managers/cswordbackend.h"
25 #include "../../util/tool.h"
32 QVBoxLayout *mainLayout =
new QVBoxLayout(
this);
33 mainLayout->setContentsMargins(5, 5, 5, 5);
34 mainLayout->setSpacing(2);
38 QSizePolicy::Preferred);
43 QFormLayout *formLayout =
new QFormLayout;
44 formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
46 static constexpr
auto const toLexModule =
49 #define STANDARD_WORKS_TAB_ADD_ROW(fname,...) \
51 m_ ## fname ## Label = new QLabel(this); \
52 m_ ## fname ## Combo = new QComboBox(this); \
53 formLayout->addRow(m_ ## fname ## Label, m_ ## fname ## Combo); \
54 auto const * const defaultModule = \
55 btConfig().getDefaultSwordModuleByType(#fname); \
56 for (auto const * const m : CSwordBackend::instance().moduleList()) { \
57 if (m->type() == CSwordModuleInfo::__VA_ARGS__) { \
59 if (auto description = \
60 m->config(CSwordModuleInfo::Description); \
61 !description.isEmpty()) \
65 "module name: module description").arg( \
67 std::move(description)); \
69 itemText = m->name(); \
72 QVariant::fromValue( \
73 const_cast<void *>(static_cast<void const *>(m))); \
74 m_ ## fname ## Combo->addItem(std::move(itemText), \
75 std::move(itemData)); \
76 if (m == defaultModule) \
77 m_ ## fname ## Combo->setCurrentIndex( \
78 m_ ## fname ## Combo->count() - 1); \
90 && toLexModule(m)->hasStrongsKeys())
92 && toLexModule(m)->hasStrongsKeys())
96 standardDailyDevotional,
99 standardHebrewStrongsLexicon,
102 && toLexModule(m)->hasStrongsKeys());
104 standardGreekStrongsLexicon,
107 && toLexModule(m)->hasStrongsKeys());
109 standardHebrewMorphLexicon,
112 standardGreekMorphLexicon,
114 #undef STANDARD_WORKS_TAB_ADD_ROW
116 mainLayout->addLayout(formLayout);
117 mainLayout->addStretch();
122 #define STANDARD_WORKS_SET_DEFAULT(name) \
123 btConfig().setDefaultSwordModuleByType(\
125 static_cast<CSwordModuleInfo const *>( \
126 m_ ## name ## Combo->currentData().value<void *>()))
137 #undef STANDARD_WORKS_SET_DEFAULT
142 tr(
"Standard works are used when no particular work is specified, for "
143 "example when a hyperlink into a Bible or lexicon was clicked."));
145 m_standardBibleLabel->setText(tr(
"Bible:"));
146 m_standardBibleCombo->setToolTip(
147 tr(
"The standard Bible is used when a hyperlink into a Bible "
150 m_standardCommentaryLabel->setText(tr(
"Commentary:"));
151 m_standardCommentaryCombo->setToolTip(
152 tr(
"The standard commentary is used when a hyperlink into a "
153 "commentary is clicked"));
155 m_standardLexiconLabel->setText(tr(
"Lexicon:"));
156 m_standardLexiconCombo->setToolTip(
157 tr(
"The standard lexicon is used when a hyperlink into a "
158 "lexicon is clicked"));
160 m_standardDailyDevotionalLabel->setText(tr(
"Daily devotional:"));
161 m_standardDailyDevotionalCombo->setToolTip(
162 tr(
"The standard devotional will be used to display a short "
163 "start up devotional"));
165 m_standardHebrewStrongsLexiconLabel->setText(
166 tr(
"Hebrew Strong's lexicon:"));
167 m_standardHebrewStrongsLexiconCombo->setToolTip(
168 tr(
"The standard Hebrew lexicon is used when a hyperlink into "
169 "a Hebrew lexicon is clicked"));
171 m_standardGreekStrongsLexiconLabel->setText(tr(
"Greek Strong's lexicon:"));
172 m_standardGreekStrongsLexiconCombo->setToolTip(
173 tr(
"The standard Greek lexicon is used when a hyperlink into a "
174 "Greek lexicon is clicked"));
176 m_standardHebrewMorphLexiconLabel->setText(
177 tr(
"Hebrew morphological lexicon:"));
178 m_standardHebrewMorphLexiconCombo->setToolTip(
179 tr(
"The standard morphological lexicon for Hebrew texts is "
180 "used when a hyperlink of a morphological tag in a Hebrew "
183 m_standardGreekMorphLexiconLabel->setText(
184 tr(
"Greek morphological lexicon:"));
185 m_standardGreekMorphLexiconCombo->setToolTip(
186 tr(
"The standard morphological lexicon for Greek texts is used "
187 "when a hyperlink of a morphological tag in a Greek text is "
#define STANDARD_WORKS_SET_DEFAULT(name)
#define STANDARD_WORKS_TAB_ADD_ROW(fname,...)
QLabel * m_explanationLabel
BtStandardWorksTab(CSwordSettingsPage *parent)