21#include <QNonConstOverload>
28#include "../../backend/config/btconfig.h"
29#include "../../backend/language.h"
30#include "../../backend/managers/btlocalemgr.h"
31#include "../../backend/managers/colormanager.h"
32#include "../../backend/managers/cdisplaytemplatemgr.h"
33#include "../../backend/rendering/cdisplayrendering.h"
34#include "../../backend/rendering/ctextrendering.h"
35#include "../../util/btassert.h"
36#include "../../util/btconnect.h"
37#include "../../util/cresmgr.h"
38#include "../../util/tool.h"
49 QVBoxLayout *mainLayout =
new QVBoxLayout(
this);
51 QFormLayout *formLayout =
new QFormLayout();
57 btConfig().value<bool>(QStringLiteral(
"GUI/showSplashScreen"),
80 mainLayout->addLayout(formLayout);
83 m_previewLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
93 font.setPointSize(font.pointSize()+2);
114 btConfig().value<int>(QStringLiteral(
"GUI/lightDarkMode")));
121 const QString toolTip(tr(
"The languages which can be used for the biblical book names. Translations are provided by the Sword library."));
126 m_showLogoLabel->setToolTip(tr(
"Show the BibleTime logo on startup."));
141 "Did you know? You can help translating the GUI of BibleTime to your "
143 "<a href=\"https://www.transifex.com/bibletime/bibletime/\">Transifex"
151 QString best = atv.takeLast();
153 auto const & swordAbbreviation = localePair.first;
154 if (swordAbbreviation ==
"locales")
158 if (
auto const i = atv.indexOf(abbreviation); i >= 0) {
159 best = std::move(abbreviation);
173 if (!settingsLanguage.isEmpty())
174 atv.append(settingsLanguage);
177 auto localeLanguageAndCountry = QLocale().name();
178 if (!localeLanguageAndCountry.isEmpty()) {
179 localeLanguageAndCountry.replace(
'_',
'-');
180 atv.append(localeLanguageAndCountry);
181 if (
auto const i = localeLanguageAndCountry.indexOf(
'-'); i > 0)
182 atv.append(localeLanguageAndCountry.left(i));
190 QMap<QString, QString> languageNames;
193 languageNames.insert(defaultLanguage->translatedName(),
194 defaultLanguage->abbrev());
198 auto const & swordAbbreviation = localePair.first;
199 if (swordAbbreviation.size() <= 0)
201 if (swordAbbreviation ==
"locales")
206 languageNames.insert(l->translatedName(), l->abbrev());
211 for (
auto it = languageNames.constBegin(); it != languageNames.constEnd(); ++it) {
212 if (!atv.isEmpty()) {
213 int i = atv.indexOf(it.value());
235 auto const previewText =
236 tr(R
"====(<div class="sectiontitle">CHAPTER 3</div>
238<div xml:lang="en" lang="en" class="sectiontitle">The New Birth</div>
240<span class="entryname">
241 <a name="crossref" href="sword://Bible/WEB/John 3:1">1</a>
243<span lemma="G1161">Now</span>
244<span lemma="G444">there was a man</span>
245<span lemma="G5330">of the Pharisees</span>,
246<span lemma="G3686">named</span>
247<span class="crossreference">
248 <a href="sword://Bible/NASB/John 7:50;" name="crossref">John 7:50</a>;
249 <a href="sword://Bible/NASB/John 19:39;" name="crossref">19:39</a>
251<span lemma="G3530">Nicodemus</span>, a
252<span class="crossreference">
253 <a href="sword://Bible/NASB/Luke 23:13;" name="crossref">Luke 23:13</a>;
254 <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>
256<span lemma="G758">ruler</span>
257<span lemma="G2453">of the Jews</span>;
259<span class="entryname">
260 <a name="crossref" href="sword://Bible/WEB/John 3:2">2</a>
262<span lemma="G3778">this</span>
263<span lemma="G3778">man</span>
264<span lemma="G2064">came</span>
265<span lemma="G3571">to Jesus by night</span>
266<span lemma="G3004">and said</span> to Him,
267<span class="crossreference">
268 <a href="sword://Bible/NASB/Matthew 23:7;" name="crossref">Matt 23:7</a>;
269 <a href="sword://Bible/NASB/John 3:26;" name="crossref">John 3:26</a>
271"<span lemma="G4461">Rabbi</span>,
272<span lemma="G3609a">we know</span>
273<span lemma="G2064">that You have come</span>
274<span lemma="G2316">from God</span>
275<span class="transchange" title="Added text">
276 <span class="added">as</span>
278<span lemma="G1320">a teacher</span>;
279<span lemma="G3762">for no</span>
280<span lemma="G3762">one</span>
281<span lemma="G1410">can</span>
282<span lemma="G4160">do</span>
283<span lemma="G3778">these</span>
284<span class="footnote" note="NASB/John 3:2/1">(1)</span>
285<span class="crossreference">
286 <a href="sword://Bible/NASB/John 2:11;" name="crossref">John 2:11</a>
288<span lemma="G4592">signs</span>
289<span lemma="G4160">that You do</span>
290<span lemma="G1437|G3361">unless</span>
291<span class="crossreference">
292 <a href="sword://Bible/NASB/John 9:33;" name="crossref">John 9:33</a>;
293 <a href="sword://Bible/NASB/John 10:38;" name="crossref">10:38</a>;
294 <a href="sword://Bible/NASB/John 14:10-John 14:11;" name="crossref">
296 <a href="sword://Bible/NASB/Acts 2:22;" name="crossref">Acts 2:22</a>;
297 <a href="sword://Bible/NASB/Acts 10:38;" name="crossref">10:38</a>
299<span lemma="G2316">God</span> is with him."
301<span class="entryname">
302 <a name="crossref" href="sword://Bible/WEB/John 3:3">3</a>
304<span lemma="G2424">Jesus answered and said to him</span>,
305<span class="jesuswords">
306 "Truly, truly, I say to you, unless one
307 <span class="crossreference">
308 <a href="sword://Bible/NASB/II Corinthians 5:17;" name="crossref">
310 <a href="sword://Bible/NASB/I Peter 1:23;" name="crossref">
313 <span lemma="G1080">is born</span>
314 <span class="footnote" note="NASB/John 3:3/1">(1)</span>
315 <span lemma="G509">again</span>
316 <span lemma="G1410|G3756">he cannot</span>
317 <span lemma="G3708">see</span>
318 <span class="crossreference">
319 <a href="sword://Bible/NASB/Matthew 19:24;" name="crossref">
321 <a href="sword://Bible/NASB/Matthew 21:31;" name="crossref">21:31</a>;
322 <a href="sword://Bible/NASB/Mark 9:47;" name="crossref">Mark 9:47</a>;
323 <a href="sword://Bible/NASB/Mark 10:14-Mark 10:15;" name="crossref">
325 <a href="sword://Bible/NASB/John 3:5;" name="crossref">John 3:5</a>
327 <span lemma="G932">the kingdom</span>
328 <span lemma="G2316">of God</span>."
330 "This markup is used to render the preview text in the settings "
331 "dialog. It contains a lot of markup because we want to "
332 "showcase multiple textual features to the user comparing "
333 "different display templates to choose from. For English we "
334 "have chosen to use John 3:1-3 but translations are free to use "
335 "other Bible passages as well as markup specific to the Bible "
336 "translations of the language as long as the text continues to "
337 "serve the intended purpose. At runtime, the translated text is "
338 "automatically split into multiple verses when empty lines (two "
339 "consecutive newline characters) are encountered.");
340 for (
auto const & verse
341 : previewText.split(QStringLiteral(
"\n\n"), Qt::SkipEmptyParts))
342 tree.emplace_back(verse, settings);
347 text.replace(QStringLiteral(
"#CHAPTERTITLE#"), QString());
352 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()
QComboBox * m_swordLocaleCombo
static void resetLanguage()
void initSwordLocaleCombo()
QCheckBox * m_showLogoCheck
CDisplaySettingsPage(CConfigurationDialog *parent=nullptr)
QLabel * m_availableLabel
static QList< QString > bookNameAbbreviationsTryVector()
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)