23#include <QNonConstOverload>
30#include "../../backend/config/btconfig.h"
31#include "../../backend/language.h"
32#include "../../backend/managers/btlocalemgr.h"
33#include "../../backend/managers/colormanager.h"
34#include "../../backend/managers/cdisplaytemplatemgr.h"
35#include "../../backend/rendering/cdisplayrendering.h"
36#include "../../backend/rendering/ctextrendering.h"
37#include "../../util/btassert.h"
38#include "../../util/btconnect.h"
39#include "../../util/cresmgr.h"
40#include "../../util/tool.h"
51 QVBoxLayout *mainLayout =
new QVBoxLayout(
this);
53 QFormLayout *formLayout =
new QFormLayout();
59 btConfig().value<bool>(QStringLiteral(
"GUI/showSplashScreen"),
82 mainLayout->addLayout(formLayout);
85 m_previewLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
95 font.setPointSize(font.pointSize()+2);
116 btConfig().value<int>(QStringLiteral(
"GUI/lightDarkMode")));
123 const QString toolTip(tr(
"The languages which can be used for the biblical book names. Translations are provided by the Sword library."));
128 m_showLogoLabel->setToolTip(tr(
"Show the BibleTime logo on startup."));
143 "Did you know? You can help translating the GUI of BibleTime to your "
145 "<a href=\"https://www.transifex.com/bibletime/bibletime/\">Transifex"
153 QString best = atv.takeLast();
155 auto const & swordAbbreviation = localePair.first;
156 if (swordAbbreviation ==
"locales")
160 if (
auto const i = atv.indexOf(abbreviation); i >= 0) {
161 best = std::move(abbreviation);
171 QVector<QString> atv;
175 if (!settingsLanguage.isEmpty())
176 atv.append(settingsLanguage);
179 auto localeLanguageAndCountry = QLocale().name();
180 if (!localeLanguageAndCountry.isEmpty()) {
181 localeLanguageAndCountry.replace(
'_',
'-');
182 atv.append(localeLanguageAndCountry);
183 if (
auto const i = localeLanguageAndCountry.indexOf(
'-'); i > 0)
184 atv.append(localeLanguageAndCountry.left(i));
192 QMap<QString, QString> languageNames;
195 languageNames.insert(defaultLanguage->translatedName(),
196 defaultLanguage->abbrev());
200 auto const & swordAbbreviation = localePair.first;
201 if (swordAbbreviation.size() <= 0)
203 if (swordAbbreviation ==
"locales")
208 languageNames.insert(l->translatedName(), l->abbrev());
213 for (
auto it = languageNames.constBegin(); it != languageNames.constEnd(); ++it) {
214 if (!atv.isEmpty()) {
215 int i = atv.indexOf(it.value());
237 auto const previewText =
238 tr(R
"====(<div class="sectiontitle">CHAPTER 3</div>
240<div xml:lang="en" lang="en" class="sectiontitle">The New Birth</div>
242<span class="entryname">
243 <a name="crossref" href="sword://Bible/WEB/John 3:1">1</a>
245<span lemma="G1161">Now</span>
246<span lemma="G444">there was a man</span>
247<span lemma="G5330">of the Pharisees</span>,
248<span lemma="G3686">named</span>
249<span class="crossreference">
250 <a href="sword://Bible/NASB/John 7:50;" name="crossref">John 7:50</a>;
251 <a href="sword://Bible/NASB/John 19:39;" name="crossref">19:39</a>
253<span lemma="G3530">Nicodemus</span>, a
254<span class="crossreference">
255 <a href="sword://Bible/NASB/Luke 23:13;" name="crossref">Luke 23:13</a>;
256 <a href="sword://Bible/NASB/John 7:26;" name="crossref">John 7:26</a>,<a href="sword://Bible/NASB/John 7:48;" name="crossref">48</a>
258<span lemma="G758">ruler</span>
259<span lemma="G2453">of the Jews</span>;
261<span class="entryname">
262 <a name="crossref" href="sword://Bible/WEB/John 3:2">2</a>
264<span lemma="G3778">this</span>
265<span lemma="G3778">man</span>
266<span lemma="G2064">came</span>
267<span lemma="G3571">to Jesus by night</span>
268<span lemma="G3004">and said</span> to Him,
269<span class="crossreference">
270 <a href="sword://Bible/NASB/Matthew 23:7;" name="crossref">Matt 23:7</a>;
271 <a href="sword://Bible/NASB/John 3:26;" name="crossref">John 3:26</a>
273"<span lemma="G4461">Rabbi</span>,
274<span lemma="G3609a">we know</span>
275<span lemma="G2064">that You have come</span>
276<span lemma="G2316">from God</span>
277<span class="transchange" title="Added text">
278 <span class="added">as</span>
280<span lemma="G1320">a teacher</span>;
281<span lemma="G3762">for no</span>
282<span lemma="G3762">one</span>
283<span lemma="G1410">can</span>
284<span lemma="G4160">do</span>
285<span lemma="G3778">these</span>
286<span class="footnote" note="NASB/John 3:2/1">(1)</span>
287<span class="crossreference">
288 <a href="sword://Bible/NASB/John 2:11;" name="crossref">John 2:11</a>
290<span lemma="G4592">signs</span>
291<span lemma="G4160">that You do</span>
292<span lemma="G1437|G3361">unless</span>
293<span class="crossreference">
294 <a href="sword://Bible/NASB/John 9:33;" name="crossref">John 9:33</a>;
295 <a href="sword://Bible/NASB/John 10:38;" name="crossref">10:38</a>;
296 <a href="sword://Bible/NASB/John 14:10-John 14:11;" name="crossref">
298 <a href="sword://Bible/NASB/Acts 2:22;" name="crossref">Acts 2:22</a>;
299 <a href="sword://Bible/NASB/Acts 10:38;" name="crossref">10:38</a>
301<span lemma="G2316">God</span> is with him."
303<span class="entryname">
304 <a name="crossref" href="sword://Bible/WEB/John 3:3">3</a>
306<span lemma="G2424">Jesus answered and said to him</span>,
307<span class="jesuswords">
308 "Truly, truly, I say to you, unless one
309 <span class="crossreference">
310 <a href="sword://Bible/NASB/II Corinthians 5:17;" name="crossref">
312 <a href="sword://Bible/NASB/I Peter 1:23;" name="crossref">
315 <span lemma="G1080">is born</span>
316 <span class="footnote" note="NASB/John 3:3/1">(1)</span>
317 <span lemma="G509">again</span>
318 <span lemma="G1410|G3756">he cannot</span>
319 <span lemma="G3708">see</span>
320 <span class="crossreference">
321 <a href="sword://Bible/NASB/Matthew 19:24;" name="crossref">
323 <a href="sword://Bible/NASB/Matthew 21:31;" name="crossref">21:31</a>;
324 <a href="sword://Bible/NASB/Mark 9:47;" name="crossref">Mark 9:47</a>;
325 <a href="sword://Bible/NASB/Mark 10:14-Mark 10:15;" name="crossref">
327 <a href="sword://Bible/NASB/John 3:5;" name="crossref">John 3:5</a>
329 <span lemma="G932">the kingdom</span>
330 <span lemma="G2316">of God</span>."
332 "This markup is used to render the preview text in the settings "
333 "dialog. It contains a lot of markup because we want to "
334 "showcase multiple textual features to the user comparing "
335 "different display templates to choose from. For English we "
336 "have chosen to use John 3:1-3 but translations are free to use "
337 "other Bible passages as well as markup specific to the Bible "
338 "translations of the language as long as the text continues to "
339 "serve the intended purpose. At runtime, the translated text is "
340 "automatically split into multiple verses when empty lines (two "
341 "consecutive newline characters) are encountered.");
342 for (
auto const & verse
343 : previewText.split(QStringLiteral(
"\n\n"), Qt::SkipEmptyParts))
344 tree.emplace_back(verse, settings);
349 text.replace(QStringLiteral(
"#CHAPTERTITLE#"), QString());
354 p.setColor(QPalette::WindowText,
BtConfig & btConfig()
This is a shortchand for BtConfig::getInstance().
void setValue(QString const &key, T const &value)
Sets a value for a key.
void setHeaderText(QString const &headerText)
QString booknameLanguage()
static QVector< QString > bookNameAbbreviationsTryVector()
QComboBox * m_swordLocaleCombo
static void resetLanguage()
void initSwordLocaleCombo()
QCheckBox * m_showLogoCheck
CDisplaySettingsPage(CConfigurationDialog *parent=nullptr)
QLabel * m_availableLabel
QComboBox * m_lightDarkCombo
QLabel * m_lightDarkLabel
void save() const final override
QComboBox * m_styleChooserCombo
QLabel * m_stylePreviewViewer
QLabel * m_languageNamesLabel
QLabel * m_transifexLabel
void updateStylePreview()
static QString activeTemplateName()
static CDisplayTemplateMgr * instance()
QStringList const & availableTemplates() const
static std::shared_ptr< Language const > fromAbbrev(QString const &abbrev)
Rendering for the html display widget.
void setDisplayTemplateName(QString displayTemplateName) noexcept
std::list< KeyTreeItem > KeyTree
QString renderKeyTree(KeyTree const &tree) const
std::map< sword::SWBuf, sword::SWLocale * > const & internalSwordLocales()
QString getForegroundColor()
QString getBackgroundColor()
QString replaceColors(QString content)