diff options
Diffstat (limited to 'src/frontend/settingsdialogs/bttextfilterstab.cpp')
-rw-r--r-- | src/frontend/settingsdialogs/bttextfilterstab.cpp | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/frontend/settingsdialogs/bttextfilterstab.cpp b/src/frontend/settingsdialogs/bttextfilterstab.cpp new file mode 100644 index 0000000..e8da038 --- /dev/null +++ b/src/frontend/settingsdialogs/bttextfilterstab.cpp @@ -0,0 +1,87 @@ +/********* +* +* This file is part of BibleTime's source code, http://www.bibletime.info/. +* +* Copyright 1999-2014 by the BibleTime developers. +* The BibleTime source code is licensed under the GNU General Public License version 2.0. +* +**********/ + +#include "frontend/settingsdialogs/bttextfilterstab.h" + +#include <QCheckBox> +#include <QLabel> +#include <QVBoxLayout> +#include "backend/config/btconfig.h" +#include "frontend/settingsdialogs/cswordsettings.h" +#include "util/tool.h" + + +#define TEXT_FILTERS_TAB_ADD_ROW(name,def) \ + m_ ## name ## Check = new QCheckBox(this); \ + m_ ## name ## Check->setChecked(btConfig().sessionValue<bool>(#name,(def))); \ + layout->addWidget(m_ ## name ## Check); + +BtTextFiltersTab::BtTextFiltersTab(CSwordSettingsPage *parent) + : QWidget(parent) +{ + QVBoxLayout *layout = new QVBoxLayout(this); + layout->setMargin(5); + layout->setSpacing(2); + + m_explanationLabel = new QLabel(this); + m_explanationLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); + m_explanationLabel->setMaximumHeight(50); + layout->addWidget(m_explanationLabel); + + btConfig().beginGroup("presentation"); + TEXT_FILTERS_TAB_ADD_ROW(lineBreaks, false); + TEXT_FILTERS_TAB_ADD_ROW(verseNumbers, false); + TEXT_FILTERS_TAB_ADD_ROW(headings, true); + TEXT_FILTERS_TAB_ADD_ROW(hebrewPoints, true); + TEXT_FILTERS_TAB_ADD_ROW(hebrewCantillation, true); + TEXT_FILTERS_TAB_ADD_ROW(morphSegmentation, true); + TEXT_FILTERS_TAB_ADD_ROW(greekAccents, true); + TEXT_FILTERS_TAB_ADD_ROW(textualVariants, false); + TEXT_FILTERS_TAB_ADD_ROW(scriptureReferences, true); + btConfig().endGroup(); + + layout->addStretch(4); + + retranslateUi(); +} + +#define TEXT_FILTERS_TAB_SAVE(name) \ + btConfig().setSessionValue(#name, m_ ## name ## Check->isChecked()) + +void BtTextFiltersTab::save() { + btConfig().beginGroup("presentation"); + TEXT_FILTERS_TAB_SAVE(lineBreaks); + TEXT_FILTERS_TAB_SAVE(verseNumbers); + TEXT_FILTERS_TAB_SAVE(headings); + TEXT_FILTERS_TAB_SAVE(hebrewPoints); + TEXT_FILTERS_TAB_SAVE(hebrewCantillation); + TEXT_FILTERS_TAB_SAVE(morphSegmentation); + TEXT_FILTERS_TAB_SAVE(greekAccents); + TEXT_FILTERS_TAB_SAVE(textualVariants); + TEXT_FILTERS_TAB_SAVE(scriptureReferences); + btConfig().endGroup(); +} + + +void BtTextFiltersTab::retranslateUi() { + util::tool::initExplanationLabel(m_explanationLabel, "", + tr("Filters control the appearance of text. Here you can specify " + "default settings for all filters. You can override these " + "settings in each display window.")); + + m_lineBreaksCheck->setText(tr("Insert line break after each verse")); + m_verseNumbersCheck->setText(tr("Show verse numbers")); + m_headingsCheck->setText(tr("Show section headings")); + m_scriptureReferencesCheck->setText(tr("Show scripture cross-references")); + m_greekAccentsCheck->setText(tr("Show Greek accents")); + m_hebrewPointsCheck->setText(tr("Show Hebrew vowel points")); + m_hebrewCantillationCheck->setText(tr("Show Hebrew cantillation marks")); + m_morphSegmentationCheck->setText(tr("Show morph segmentation")); + m_textualVariantsCheck->setText(tr("Use textual variants")); +} |