BibleTime
bttextfilterstab.cpp
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#include "bttextfilterstab.h"
14
15#include <QCheckBox>
16#include <QLabel>
17#include <QSizePolicy>
18#include <QVBoxLayout>
19#include "../../backend/config/btconfig.h"
20#include "../../backend/config/btconfigcore.h"
21#include "../../util/tool.h"
22#include "cswordsettings.h"
23
24
25#define TEXT_FILTERS_TAB_ADD_ROW(name,def) \
26 m_ ## name ## Check = new QCheckBox(this); \
27 m_ ## name ## Check->setChecked(conf.value<bool>(#name,(def))); \
28 layout->addWidget(m_ ## name ## Check)
29
31 : QWidget(parent)
32{
33 QVBoxLayout *layout = new QVBoxLayout(this);
34 layout->setContentsMargins(5, 5, 5, 5);
35 layout->setSpacing(2);
36
37 m_explanationLabel = new QLabel(this);
38 m_explanationLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
39 m_explanationLabel->setMaximumHeight(50);
40 layout->addWidget(m_explanationLabel);
41
42 {
43 auto const conf =
44 btConfig().session().group(QStringLiteral("presentation"));
45 TEXT_FILTERS_TAB_ADD_ROW(verseNumbers, true);
46 TEXT_FILTERS_TAB_ADD_ROW(headings, true);
47 TEXT_FILTERS_TAB_ADD_ROW(hebrewPoints, true);
48 TEXT_FILTERS_TAB_ADD_ROW(hebrewCantillation, true);
49 TEXT_FILTERS_TAB_ADD_ROW(morphSegmentation, true);
50 TEXT_FILTERS_TAB_ADD_ROW(greekAccents, true);
51 TEXT_FILTERS_TAB_ADD_ROW(textualVariants, false);
52 TEXT_FILTERS_TAB_ADD_ROW(scriptureReferences, true);
53 }
54
55 layout->addStretch(4);
56
58}
59
60#define TEXT_FILTERS_TAB_SAVE(name) \
61 conf.setValue(#name, m_ ## name ## Check->isChecked())
62
64 auto conf = btConfig().session().group(QStringLiteral("presentation"));
65 TEXT_FILTERS_TAB_SAVE(verseNumbers);
66 TEXT_FILTERS_TAB_SAVE(headings);
67 TEXT_FILTERS_TAB_SAVE(hebrewPoints);
68 TEXT_FILTERS_TAB_SAVE(hebrewCantillation);
69 TEXT_FILTERS_TAB_SAVE(morphSegmentation);
70 TEXT_FILTERS_TAB_SAVE(greekAccents);
71 TEXT_FILTERS_TAB_SAVE(textualVariants);
72 TEXT_FILTERS_TAB_SAVE(scriptureReferences);
73}
74
75
78 tr("Filters control the appearance of text. Here you can specify "
79 "default settings for all filters. These settings apply to newly "
80 "opened display windows only. You can override these settings in "
81 "each display window."));
82
83 m_verseNumbersCheck->setText(tr("Show verse numbers"));
84 m_headingsCheck->setText(tr("Show section headings"));
85 m_scriptureReferencesCheck->setText(tr("Show scripture cross-references"));
86 m_greekAccentsCheck->setText(tr("Show Greek accents"));
87 m_hebrewPointsCheck->setText(tr("Show Hebrew vowel points"));
88 m_hebrewCantillationCheck->setText(tr("Show Hebrew cantillation marks"));
89 m_morphSegmentationCheck->setText(tr("Show morph segmentation"));
90 m_textualVariantsCheck->setText(tr("Use textual variants"));
91}
BtConfig & btConfig()
This is a shortchand for BtConfig::getInstance().
Definition btconfig.h:305
#define TEXT_FILTERS_TAB_SAVE(name)
#define TEXT_FILTERS_TAB_ADD_ROW(name, def)
BtConfigCore group(Prefix &&prefix) const &
BtConfigCore session() const
Definition btconfig.cpp:213
BtTextFiltersTab(CSwordSettingsPage *parent)
QLabel * m_explanationLabel
void initExplanationLabel(QLabel *const label, const QString &heading, const QString &text)
Initializes a QLabel to explain difficult things of dialogs.
Definition tool.cpp:116