diff options
Diffstat (limited to 'src/frontend/settingsdialogs')
24 files changed, 523 insertions, 482 deletions
diff --git a/src/frontend/settingsdialogs/btfontchooserwidget.cpp b/src/frontend/settingsdialogs/btfontchooserwidget.cpp index 4d943c4..7fcf6b5 100644 --- a/src/frontend/settingsdialogs/btfontchooserwidget.cpp +++ b/src/frontend/settingsdialogs/btfontchooserwidget.cpp @@ -2,7 +2,7 @@ * * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ diff --git a/src/frontend/settingsdialogs/btfontchooserwidget.h b/src/frontend/settingsdialogs/btfontchooserwidget.h index 9eb1f4d..eba5607 100644 --- a/src/frontend/settingsdialogs/btfontchooserwidget.h +++ b/src/frontend/settingsdialogs/btfontchooserwidget.h @@ -1,8 +1,10 @@ /********* * +* In the name of the Father, and of the Son, and of the Holy Spirit. +* * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ diff --git a/src/frontend/settingsdialogs/btfontsettings.cpp b/src/frontend/settingsdialogs/btfontsettings.cpp index 77a8b0b..57a8aba 100644 --- a/src/frontend/settingsdialogs/btfontsettings.cpp +++ b/src/frontend/settingsdialogs/btfontsettings.cpp @@ -2,7 +2,7 @@ * * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ @@ -16,11 +16,13 @@ #include <QLabel> #include <QVBoxLayout> #include <QWidget> +#include "backend/config/btconfig.h" +#include "bibletimeapp.h" #include "frontend/settingsdialogs/btfontchooserwidget.h" #include "frontend/settingsdialogs/cconfigurationdialog.h" #include "util/cresmgr.h" +#include "util/geticon.h" #include "util/tool.h" -#include "util/directory.h" // Sword includes: #include <localemgr.h> @@ -28,10 +30,8 @@ BtFontSettingsPage::BtFontSettingsPage(CConfigurationDialog *parent) - : BtConfigDialog::Page(util::directory::getIcon(CResMgr::settings::fonts::icon), parent) + : BtConfigDialog::Page(util::getIcon(CResMgr::settings::fonts::icon), parent) { - namespace DU = util::directory; - m_languageLabel = new QLabel(this); m_languageComboBox = new QComboBox(this); m_languageLabel->setBuddy(m_languageComboBox); @@ -58,13 +58,13 @@ BtFontSettingsPage::BtFontSettingsPage(CConfigurationDialog *parent) ? &L::abbrev : &L::translatedName; - m_fontMap.insert((l->*f)(), CBTConfig::get(l)); + m_fontMap.insert((l->*f)(), btConfig().getFontForLanguage(*l)); } for (FontMap::ConstIterator it = m_fontMap.constBegin(); it != m_fontMap.constEnd(); ++it) { const QString &k = it.key(); if (m_fontMap[k].first) { // show font icon - m_languageComboBox->addItem(DU::getIcon("fonts.svg"), k); + m_languageComboBox->addItem(util::getIcon("fonts.svg"), k); } else { // don't show icon for font m_languageComboBox->addItem(k); } @@ -84,7 +84,7 @@ BtFontSettingsPage::BtFontSettingsPage(CConfigurationDialog *parent) connect(m_languageComboBox, SIGNAL(activated(const QString&)), this, SLOT(newDisplayWindowFontAreaSelected(const QString&))); - const CBTConfig::FontSettingsPair &v = m_fontMap.value(m_languageComboBox->currentText()); + const BtConfig::FontSettingsPair &v = m_fontMap.value(m_languageComboBox->currentText()); m_fontChooser->setFont(v.second); useOwnFontClicked(v.first); m_languageCheckBox->setChecked(v.first); @@ -116,12 +116,12 @@ void BtFontSettingsPage::save() const { // We possibly use a language, for which we have only the abbrevation if (!lang->abbrev().isEmpty()) { // Create a temp language: - CLanguageMgr::Language l(k, k, k); - CBTConfig::set(&l, it.value()); + const CLanguageMgr::Language l(k, k, k); + btConfig().setFontForLanguage(l, it.value()); } } else { - CBTConfig::set(lang, it.value()); + btConfig().setFontForLanguage(*lang, it.value()); } } } @@ -129,23 +129,21 @@ void BtFontSettingsPage::save() const { void BtFontSettingsPage::newDisplayWindowFontSelected(const QFont &newFont) { const QString languageName = m_languageComboBox->currentText(); m_fontMap.insert(languageName, - CBTConfig::FontSettingsPair(m_fontMap[languageName].first, newFont)); + BtConfig::FontSettingsPair(m_fontMap[languageName].first, newFont)); } void BtFontSettingsPage::newDisplayWindowFontAreaSelected(const QString &usage) { - const CBTConfig::FontSettingsPair &p = m_fontMap[usage]; + const BtConfig::FontSettingsPair &p = m_fontMap[usage]; useOwnFontClicked(p.first); m_languageCheckBox->setChecked(p.first); m_fontChooser->setFont(p.second); } void BtFontSettingsPage::useOwnFontClicked(bool isOn) { - namespace DU = util::directory; - m_fontChooser->setEnabled(isOn); m_fontMap[m_languageComboBox->currentText()].first = isOn; m_languageComboBox->setItemIcon(m_languageComboBox->currentIndex(), - isOn ? DU::getIcon("fonts.svg") : QIcon()); + isOn ? util::getIcon("fonts.svg") : QIcon()); } void BtFontSettingsPage::retranslateUi() { diff --git a/src/frontend/settingsdialogs/btfontsettings.h b/src/frontend/settingsdialogs/btfontsettings.h index 659cd75..70d0d20 100644 --- a/src/frontend/settingsdialogs/btfontsettings.h +++ b/src/frontend/settingsdialogs/btfontsettings.h @@ -1,8 +1,10 @@ /********* * +* In the name of the Father, and of the Son, and of the Holy Spirit. +* * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ @@ -14,7 +16,7 @@ #include <QMap> #include <QWidget> -#include "backend/config/cbtconfig.h" +#include "backend/config/btconfig.h" class BtFontChooserWidget; @@ -30,7 +32,7 @@ class BtFontSettingsPage: public BtConfigDialog::Page { private: /* Types: */ - typedef QMap<QString, CBTConfig::FontSettingsPair> FontMap; + typedef QMap<QString, BtConfig::FontSettingsPair> FontMap; public: /* Methods: */ diff --git a/src/frontend/settingsdialogs/btlanguagesettings.cpp b/src/frontend/settingsdialogs/btlanguagesettings.cpp index be2dd17..37e53c8 100644 --- a/src/frontend/settingsdialogs/btlanguagesettings.cpp +++ b/src/frontend/settingsdialogs/btlanguagesettings.cpp @@ -2,7 +2,7 @@ * * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ @@ -14,11 +14,12 @@ #include <QLabel> #include <QVBoxLayout> #include <QWidget> -#include "backend/config/cbtconfig.h" +#include "backend/config/btconfig.h" +#include "bibletimeapp.h" #include "frontend/settingsdialogs/cconfigurationdialog.h" #include "util/cresmgr.h" +#include "util/geticon.h" #include "util/tool.h" -#include "util/directory.h" // Sword includes: #include <localemgr.h> @@ -29,7 +30,7 @@ typedef std::list<sword::SWBuf>::const_iterator SBLCI; BtLanguageSettingsPage::BtLanguageSettingsPage(CConfigurationDialog *parent) - : BtConfigDialog::Page(util::directory::getIcon(CResMgr::settings::languages::icon), parent) + : BtConfigDialog::Page(util::getIcon(CResMgr::settings::languages::icon), parent) { m_swordLocaleCombo = new QComboBox(this); m_languageNamesLabel = new QLabel(this); @@ -44,7 +45,7 @@ BtLanguageSettingsPage::BtLanguageSettingsPage(CConfigurationDialog *parent) } void BtLanguageSettingsPage::save() { - CBTConfig::set(CBTConfig::language, m_swordLocaleCombo->itemData(m_swordLocaleCombo->currentIndex()).toString()); + btConfig().setValue("language", m_swordLocaleCombo->itemData(m_swordLocaleCombo->currentIndex())); } void BtLanguageSettingsPage::resetLanguage() { @@ -67,14 +68,14 @@ void BtLanguageSettingsPage::resetLanguage() { } } } - CBTConfig::set(CBTConfig::language, best); + btConfig().setValue("language", best); } QVector<QString> BtLanguageSettingsPage::bookNameAbbreviationsTryVector() { QVector<QString> atv; atv.reserve(4); { - QString settingsLanguage = CBTConfig::get(CBTConfig::language); + QString settingsLanguage = btConfig().value<QString>("language"); if (!settingsLanguage.isEmpty()) atv.append(settingsLanguage); } @@ -132,5 +133,7 @@ void BtLanguageSettingsPage::retranslateUi() { setHeaderText(tr("Languages")); m_languageNamesLabel->setText(tr("Language for names of Bible books:")); - m_swordLocaleCombo->setToolTip(tr("The languages which can be used for the biblical booknames")); + const QString toolTip(tr("The languages which can be used for the biblical book names. Translations are provided by the Sword library.")); + m_languageNamesLabel->setToolTip(toolTip); + m_swordLocaleCombo->setToolTip(toolTip); } diff --git a/src/frontend/settingsdialogs/btlanguagesettings.h b/src/frontend/settingsdialogs/btlanguagesettings.h index 7c3b0c9..89caaf2 100644 --- a/src/frontend/settingsdialogs/btlanguagesettings.h +++ b/src/frontend/settingsdialogs/btlanguagesettings.h @@ -1,8 +1,10 @@ /********* * +* In the name of the Father, and of the Son, and of the Holy Spirit. +* * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ diff --git a/src/frontend/settingsdialogs/btshortcutsdialog.cpp b/src/frontend/settingsdialogs/btshortcutsdialog.cpp index a5d856d..10601f6 100644 --- a/src/frontend/settingsdialogs/btshortcutsdialog.cpp +++ b/src/frontend/settingsdialogs/btshortcutsdialog.cpp @@ -2,13 +2,13 @@ * * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* 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/btshortcutsdialog.h" -#include "util/dialogutil.h" +#include "frontend/messagedialog.h" #include <QDialogButtonBox> #include <QGridLayout> @@ -56,7 +56,7 @@ BtShortcutsDialog::BtShortcutsDialog(QWidget* parent) gridLayout->addWidget(m_alternateLabel, 1, 1); QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - util::prepareDialogBox(buttons); + message::prepareDialogBox(buttons); vLayout->addWidget(buttons); connect(buttons, SIGNAL(accepted()), this, SLOT(accept())); diff --git a/src/frontend/settingsdialogs/btshortcutsdialog.h b/src/frontend/settingsdialogs/btshortcutsdialog.h index f475ebd..722cef9 100644 --- a/src/frontend/settingsdialogs/btshortcutsdialog.h +++ b/src/frontend/settingsdialogs/btshortcutsdialog.h @@ -1,8 +1,10 @@ /********* * +* In the name of the Father, and of the Son, and of the Holy Spirit. +* * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ diff --git a/src/frontend/settingsdialogs/btshortcutseditor.cpp b/src/frontend/settingsdialogs/btshortcutseditor.cpp index 618e5ed..2e943eb 100644 --- a/src/frontend/settingsdialogs/btshortcutseditor.cpp +++ b/src/frontend/settingsdialogs/btshortcutseditor.cpp @@ -2,7 +2,7 @@ * * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ diff --git a/src/frontend/settingsdialogs/btshortcutseditor.h b/src/frontend/settingsdialogs/btshortcutseditor.h index f9a812a..d58ac08 100644 --- a/src/frontend/settingsdialogs/btshortcutseditor.h +++ b/src/frontend/settingsdialogs/btshortcutseditor.h @@ -1,8 +1,10 @@ /********* * +* In the name of the Father, and of the Son, and of the Holy Spirit. +* * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ diff --git a/src/frontend/settingsdialogs/btstandardworkstab.cpp b/src/frontend/settingsdialogs/btstandardworkstab.cpp new file mode 100644 index 0000000..9cef549 --- /dev/null +++ b/src/frontend/settingsdialogs/btstandardworkstab.cpp @@ -0,0 +1,203 @@ +/********* +* +* 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/btstandardworkstab.h" + +#include <QCheckBox> +#include <QComboBox> +#include <QFormLayout> +#include <QLabel> +#include <QVBoxLayout> +#include "backend/config/btconfig.h" +#include "backend/managers/cswordbackend.h" +#include "frontend/settingsdialogs/cswordsettings.h" +#include "util/tool.h" + + +BtStandardWorksTab::BtStandardWorksTab(CSwordSettingsPage *parent) + : QWidget(parent) +{ + typedef QList<CSwordModuleInfo*>::const_iterator MLCI; + + QVBoxLayout *mainLayout = new QVBoxLayout(this); + mainLayout->setMargin(5); + mainLayout->setSpacing(2); + + m_explanationLabel = new QLabel(this); + m_explanationLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); + m_explanationLabel->setMaximumHeight(50); + m_explanationLabel->setMinimumWidth(300); + mainLayout->addWidget(m_explanationLabel); + + QFormLayout *formLayout = new QFormLayout; + formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); + +#define STANDARD_WORKS_TAB_ADD_ROW(name) \ + if (true) { \ + m_ ## name ## Label = new QLabel(this); \ + m_ ## name ## Combo = new QComboBox(this); \ + formLayout->addRow(m_ ## name ## Label, m_ ## name ## Combo); \ + } else (void) 0 + + STANDARD_WORKS_TAB_ADD_ROW(standardBible); + STANDARD_WORKS_TAB_ADD_ROW(standardCommentary); + STANDARD_WORKS_TAB_ADD_ROW(standardLexicon); + STANDARD_WORKS_TAB_ADD_ROW(standardDailyDevotional); + STANDARD_WORKS_TAB_ADD_ROW(standardHebrewStrongsLexicon); + STANDARD_WORKS_TAB_ADD_ROW(standardGreekStrongsLexicon); + STANDARD_WORKS_TAB_ADD_ROW(standardHebrewMorphLexicon); + STANDARD_WORKS_TAB_ADD_ROW(standardGreekMorphLexicon); + + mainLayout->addLayout(formLayout); + mainLayout->addStretch(); + + //fill the comboboxes with the right modules + + const QList<CSwordModuleInfo*> &modules(CSwordBackend::instance()->moduleList()); + QString modDescript; + for (MLCI it(modules.begin()); it != modules.end(); it++) { + modDescript = (*it)->config(CSwordModuleInfo::Description); + + switch ((*it)->type()) { + case CSwordModuleInfo::Bible: + m_standardBibleCombo->addItem(modDescript); + break; + case CSwordModuleInfo::Commentary: + m_standardCommentaryCombo->addItem(modDescript); + break; + case CSwordModuleInfo::Lexicon: { + bool inserted = false; + if ((*it)->has(CSwordModuleInfo::HebrewDef)) { + m_standardHebrewStrongsLexiconCombo->addItem(modDescript); + inserted = true; + } + if ((*it)->has(CSwordModuleInfo::GreekDef)) { + m_standardGreekStrongsLexiconCombo->addItem(modDescript); + inserted = true; + } + if ((*it)->has(CSwordModuleInfo::HebrewParse)) { + m_standardHebrewMorphLexiconCombo->addItem(modDescript); + inserted = true; + } + if ((*it)->has(CSwordModuleInfo::GreekParse)) { + m_standardGreekMorphLexiconCombo->addItem(modDescript); + inserted = true; + } + if ((*it)->category() == CSwordModuleInfo::DailyDevotional) { + m_standardDailyDevotionalCombo->addItem(modDescript); + inserted = true; + } + + if (!inserted) { //daily dvotionals, striong lexicons etc. are not very useful for word lookups + m_standardLexiconCombo->addItem(modDescript); + } + break; + } + default://unknown type + break; + } //switch + } //for + + //using two lists and one loop is better than six loops with almost the same code :) + QList<QComboBox*> comboList; + QStringList moduleList; + + // fill combobox and modulelist + const CSwordModuleInfo* m; + +#define STANDARD_WORKS_COMBO_ADD(name) \ + comboList.append(m_ ## name ## Combo); \ + m = btConfig().getDefaultSwordModuleByType(#name); \ + moduleList << (m != 0 ? m->config(CSwordModuleInfo::Description) : QString::null); + + STANDARD_WORKS_COMBO_ADD(standardBible); + STANDARD_WORKS_COMBO_ADD(standardCommentary); + STANDARD_WORKS_COMBO_ADD(standardLexicon); + STANDARD_WORKS_COMBO_ADD(standardDailyDevotional); + STANDARD_WORKS_COMBO_ADD(standardHebrewStrongsLexicon); + STANDARD_WORKS_COMBO_ADD(standardGreekStrongsLexicon); + STANDARD_WORKS_COMBO_ADD(standardHebrewMorphLexicon); + STANDARD_WORKS_COMBO_ADD(standardGreekMorphLexicon); + + QString module = QString::null; + int item = 0; + int count = 0; + QListIterator<QComboBox*> it(comboList); + while (it.hasNext()) { + //for (QComboBox* combo = comboList.first(); combo; combo = comboList.next() ) + QComboBox* combo = it.next(); + module = moduleList[comboList.indexOf(combo)]; + count = combo->count(); + + for (item = 0; item < count; item++) { + if (combo->itemText(item) == module ) { + combo->setCurrentIndex(item); + break; + } + } + } + + retranslateUi(); +} + +#define STANDARD_WORKS_SET_DEFAULT(name) \ + btConfig().setDefaultSwordModuleByType(\ + #name, \ + CSwordBackend::instance()->findModuleByDescription(m_ ## name ## Combo->currentText()) \ + ); + +void BtStandardWorksTab::save() { + STANDARD_WORKS_SET_DEFAULT(standardBible); + STANDARD_WORKS_SET_DEFAULT(standardCommentary); + STANDARD_WORKS_SET_DEFAULT(standardLexicon); + STANDARD_WORKS_SET_DEFAULT(standardDailyDevotional); + STANDARD_WORKS_SET_DEFAULT(standardHebrewStrongsLexicon); + STANDARD_WORKS_SET_DEFAULT(standardGreekStrongsLexicon); + STANDARD_WORKS_SET_DEFAULT(standardHebrewMorphLexicon); + STANDARD_WORKS_SET_DEFAULT(standardGreekMorphLexicon); +} + +void BtStandardWorksTab::retranslateUi() { + util::tool::initExplanationLabel( + m_explanationLabel, "", + tr("Standard works are used when no particular work is specified, for example " + "when a hyperlink into a Bible or lexicon was clicked.")); + + m_standardBibleLabel->setText(tr("Bible:")); + m_standardBibleCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); + m_standardBibleCombo->setToolTip(tr("The standard Bible is used when a hyperlink into a Bible is clicked")); + + m_standardCommentaryLabel->setText(tr("Commentary:")); + m_standardCommentaryCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); + m_standardCommentaryCombo->setToolTip(tr("The standard commentary is used when a hyperlink into a commentary is clicked")); + + m_standardLexiconLabel->setText(tr("Lexicon:")); + m_standardLexiconCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); + m_standardLexiconCombo->setToolTip(tr("The standard lexicon is used when a hyperlink into a lexicon is clicked")); + + m_standardDailyDevotionalLabel->setText(tr("Daily devotional:")); + m_standardDailyDevotionalCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); + m_standardDailyDevotionalCombo->setToolTip(tr("The standard devotional will be used to display a short start up devotional")); + + m_standardHebrewStrongsLexiconLabel->setText(tr("Hebrew Strong's lexicon:")); + m_standardHebrewStrongsLexiconCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); + m_standardHebrewStrongsLexiconCombo->setToolTip(tr("The standard Hebrew lexicon is used when a hyperlink into a Hebrew lexicon is clicked")); + + m_standardGreekStrongsLexiconLabel->setText(tr("Greek Strong's lexicon:")); + m_standardGreekStrongsLexiconCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); + m_standardGreekStrongsLexiconCombo->setToolTip(tr("The standard Greek lexicon is used when a hyperlink into a Greek lexicon is clicked")); + + m_standardHebrewMorphLexiconLabel->setText(tr("Hebrew morphological lexicon:")); + m_standardHebrewMorphLexiconCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); + m_standardHebrewMorphLexiconCombo->setToolTip(tr("The standard morphological lexicon for Hebrew texts is used when a hyperlink of a morphological tag in a Hebrew text is clicked")); + + m_standardGreekMorphLexiconLabel->setText(tr("Greek morphological lexicon:")); + m_standardGreekMorphLexiconCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); + m_standardGreekMorphLexiconCombo->setToolTip(tr("The standard morphological lexicon for Greek texts is used when a hyperlink of a morphological tag in a Greek text is clicked")); +} diff --git a/src/frontend/settingsdialogs/btstandardworkstab.h b/src/frontend/settingsdialogs/btstandardworkstab.h new file mode 100644 index 0000000..0b91b4c --- /dev/null +++ b/src/frontend/settingsdialogs/btstandardworkstab.h @@ -0,0 +1,55 @@ +/********* +* +* In the name of the Father, and of the Son, and of the Holy Spirit. +* +* 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. +* +**********/ + +#ifndef BTSTANDARDWORKSTAB_H +#define BTSTANDARDWORKSTAB_H + +#include <QWidget> + + +class CSwordSettingsPage; +class QCheckBox; +class QComboBox; +class QLabel; + +class BtStandardWorksTab: public QWidget { + + Q_OBJECT + + public: /* Methods: */ + + BtStandardWorksTab(CSwordSettingsPage * parent); + + void save(); + + protected: /* Methods: */ + + void retranslateUi(); + + private: /* Fields: */ + + QLabel * m_explanationLabel; + +#define STANDARD_WORKS_TAB_FIELD(name) \ + QLabel * m_ ## name ## Label; \ + QComboBox * m_ ## name ## Combo + + STANDARD_WORKS_TAB_FIELD(standardBible); + STANDARD_WORKS_TAB_FIELD(standardCommentary); + STANDARD_WORKS_TAB_FIELD(standardLexicon); + STANDARD_WORKS_TAB_FIELD(standardDailyDevotional); + STANDARD_WORKS_TAB_FIELD(standardHebrewStrongsLexicon); + STANDARD_WORKS_TAB_FIELD(standardGreekStrongsLexicon); + STANDARD_WORKS_TAB_FIELD(standardHebrewMorphLexicon); + STANDARD_WORKS_TAB_FIELD(standardGreekMorphLexicon); +}; + +#endif /* BTSTANDARDWORKSTAB_H */ 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")); +} diff --git a/src/frontend/settingsdialogs/bttextfilterstab.h b/src/frontend/settingsdialogs/bttextfilterstab.h new file mode 100644 index 0000000..3f6e904 --- /dev/null +++ b/src/frontend/settingsdialogs/bttextfilterstab.h @@ -0,0 +1,54 @@ +/********* +* +* In the name of the Father, and of the Son, and of the Holy Spirit. +* +* 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. +* +**********/ + +#ifndef BTTEXTFILTERSTAB_H +#define BTTEXTFILTERSTAB_H + +#include <QWidget> + +class CSwordSettingsPage; +class QCheckBox; +class QLabel; + + +class BtTextFiltersTab: public QWidget { + + Q_OBJECT + + public: /* Methods: */ + + BtTextFiltersTab(CSwordSettingsPage * parent); + + void save(); + + protected: /* Methods: */ + + void retranslateUi(); + + private: /* Fields: */ + + QLabel * m_explanationLabel; + +#define TEXT_FILTERS_TAB_FIELD(name) QCheckBox * m_ ## name ## Check + + TEXT_FILTERS_TAB_FIELD(lineBreaks); + TEXT_FILTERS_TAB_FIELD(verseNumbers); + TEXT_FILTERS_TAB_FIELD(headings); + TEXT_FILTERS_TAB_FIELD(hebrewPoints); + TEXT_FILTERS_TAB_FIELD(hebrewCantillation); + TEXT_FILTERS_TAB_FIELD(morphSegmentation); + TEXT_FILTERS_TAB_FIELD(greekAccents); + TEXT_FILTERS_TAB_FIELD(textualVariants); + TEXT_FILTERS_TAB_FIELD(scriptureReferences); + +}; + +#endif /* BTTEXTFILTERSTAB_H */ diff --git a/src/frontend/settingsdialogs/cacceleratorsettings.cpp b/src/frontend/settingsdialogs/cacceleratorsettings.cpp index 177ea2f..d85bf51 100644 --- a/src/frontend/settingsdialogs/cacceleratorsettings.cpp +++ b/src/frontend/settingsdialogs/cacceleratorsettings.cpp @@ -2,7 +2,7 @@ * * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ @@ -13,25 +13,25 @@ #include <QHBoxLayout> #include <QLabel> #include <QList> -#include <QMessageBox> #include <QStackedWidget> #include <QVBoxLayout> #include <QWidget> #include "bibletime.h" -#include "backend/config/cbtconfig.h" +#include "bibletimeapp.h" #include "frontend/displaywindow/btactioncollection.h" #include "frontend/displaywindow/cbiblereadwindow.h" #include "frontend/displaywindow/cbookreadwindow.h" #include "frontend/displaywindow/ccommentaryreadwindow.h" #include "frontend/displaywindow/clexiconreadwindow.h" #include "frontend/displaywindow/creadwindow.h" +#include "frontend/messagedialog.h" #include "frontend/settingsdialogs/cconfigurationdialog.h" #include "util/cresmgr.h" -#include "util/directory.h" +#include "util/geticon.h" CAcceleratorSettingsPage::CAcceleratorSettingsPage(CConfigurationDialog *parent) - : BtConfigDialog::Page(util::directory::getIcon(CResMgr::settings::keys::icon), parent) + : BtConfigDialog::Page(util::getIcon(CResMgr::settings::keys::icon), parent) { QVBoxLayout *mainLayout = new QVBoxLayout(this); @@ -48,21 +48,16 @@ CAcceleratorSettingsPage::CAcceleratorSettingsPage(CConfigurationDialog *parent) SLOT(slotKeyChooserTypeChanged(const QString&)) ); Q_ASSERT(ok); + // m_*.title strings are empty here, they are filled and added to the stacked widget in the retranslateUi() function m_keyChooserStack = new QStackedWidget(this); - - m_typeChooser->addItem(m_application.title); - m_typeChooser->addItem(m_general.title); - m_typeChooser->addItem(m_bible.title); - m_typeChooser->addItem(m_commentary.title); - m_typeChooser->addItem(m_lexicon.title); - m_typeChooser->addItem(m_book.title); + retranslateUi(); // create shortcuteditors // ------ Application -------------- // m_application.actionCollection = new BtActionCollection(this); BibleTime::insertKeyboardActions( m_application.actionCollection); - CBTConfig::setupAccelSettings(CBTConfig::application, m_application.actionCollection); + m_application.actionCollection->readShortcuts("Application shortcuts"); m_application.keyChooser = new BtShortcutsEditor(m_application.actionCollection, m_keyChooserStack); m_keyChooserStack->addWidget(m_application.keyChooser); ok = connect(m_application.keyChooser, SIGNAL(keyChangeRequest(BtShortcutsEditor*, const QString&)), @@ -72,7 +67,7 @@ CAcceleratorSettingsPage::CAcceleratorSettingsPage(CConfigurationDialog *parent) // ----- All display windows ------ // m_general.actionCollection = new BtActionCollection(this); CDisplayWindow::insertKeyboardActions( m_general.actionCollection); - CBTConfig::setupAccelSettings(CBTConfig::allWindows, m_general.actionCollection); + m_general.actionCollection->readShortcuts("Displaywindow shortcuts"); m_general.keyChooser = new BtShortcutsEditor(m_general.actionCollection, m_keyChooserStack); m_keyChooserStack->addWidget(m_general.keyChooser); ok = connect(m_general.keyChooser, SIGNAL(keyChangeRequest(BtShortcutsEditor*, const QString&)), @@ -82,7 +77,7 @@ CAcceleratorSettingsPage::CAcceleratorSettingsPage(CConfigurationDialog *parent) // ----- Bible windows ------ // m_bible.actionCollection = new BtActionCollection(this); CBibleReadWindow::insertKeyboardActions( m_bible.actionCollection); - CBTConfig::setupAccelSettings(CBTConfig::bibleWindow, m_bible.actionCollection); + m_bible.actionCollection->readShortcuts("Bible shortcuts"); m_bible.keyChooser = new BtShortcutsEditor(m_bible.actionCollection, m_keyChooserStack); m_keyChooserStack->addWidget(m_bible.keyChooser); ok = connect(m_bible.keyChooser, SIGNAL(keyChangeRequest(BtShortcutsEditor*, const QString&)), @@ -92,7 +87,7 @@ CAcceleratorSettingsPage::CAcceleratorSettingsPage(CConfigurationDialog *parent) // ----- Commentary windows ------ // m_commentary.actionCollection = new BtActionCollection(this); CCommentaryReadWindow::insertKeyboardActions( m_commentary.actionCollection); - CBTConfig::setupAccelSettings(CBTConfig::commentaryWindow, m_commentary.actionCollection); + m_commentary.actionCollection->readShortcuts("Commentary shortcuts"); m_commentary.keyChooser = new BtShortcutsEditor(m_commentary.actionCollection, m_keyChooserStack); m_keyChooserStack->addWidget(m_commentary.keyChooser); ok = connect(m_commentary.keyChooser, SIGNAL(keyChangeRequest(BtShortcutsEditor*, const QString&)), @@ -102,8 +97,8 @@ CAcceleratorSettingsPage::CAcceleratorSettingsPage(CConfigurationDialog *parent) // ----- Lexicon windows ------ // m_lexicon.actionCollection = new BtActionCollection(this); CLexiconReadWindow::insertKeyboardActions( m_lexicon.actionCollection ); - CBTConfig::setupAccelSettings(CBTConfig::lexiconWindow, m_lexicon.actionCollection); - m_lexicon.keyChooser = new BtShortcutsEditor(m_lexicon.actionCollection, m_keyChooserStack ); + m_lexicon.actionCollection->readShortcuts("Lexicon shortcuts"); + m_lexicon.keyChooser = new BtShortcutsEditor(m_lexicon.actionCollection, m_keyChooserStack); m_keyChooserStack->addWidget(m_lexicon.keyChooser); ok = connect(m_lexicon.keyChooser, SIGNAL(keyChangeRequest(BtShortcutsEditor*, const QString&)), this, SLOT(completeKeyChangeRequest(BtShortcutsEditor*, const QString&))); @@ -112,7 +107,7 @@ CAcceleratorSettingsPage::CAcceleratorSettingsPage(CConfigurationDialog *parent) // ----- Book windows ------ // m_book.actionCollection = new BtActionCollection(this); CBookReadWindow::insertKeyboardActions( m_book.actionCollection); - CBTConfig::setupAccelSettings(CBTConfig::bookWindow, m_book.actionCollection); + m_book.actionCollection->readShortcuts("Book shortcuts"); m_book.keyChooser = new BtShortcutsEditor(m_book.actionCollection, m_keyChooserStack); m_keyChooserStack->addWidget(m_book.keyChooser); ok = connect(m_book.keyChooser, SIGNAL(keyChangeRequest(BtShortcutsEditor*, const QString&)), @@ -157,17 +152,12 @@ void CAcceleratorSettingsPage::completeKeyChangeRequest(BtShortcutsEditor* short QString conflicts = findConflictsWithKeys(keys, list); if (!conflicts.isEmpty()) { QString message = QObject::tr("This shortcut conflicts with the shortcut for the following actions:"); - message.append("\n"); + message.append("<br/><br/>"); message.append(conflicts); - QMessageBox msgBox(this); - msgBox.setIcon(QMessageBox::Question); - msgBox.setText(message); - msgBox.setInformativeText(QObject::tr("Do you want to clear the conflicting shortcuts and continue?")); - msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); - msgBox.setDefaultButton(QMessageBox::Yes); - int ret = msgBox.exec(); - if ( ret == QMessageBox::Yes) { + if (message::showQuestion(this, + QObject::tr("Do you want to clear the conflicting shortcuts and continue?"), + message, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) { clearConflictsWithKeys(keys, list); shortcutsEditor->changeShortcutInDialog(keys); } @@ -244,12 +234,12 @@ void CAcceleratorSettingsPage::save() { if (m_book.keyChooser) m_book.keyChooser->commitChanges(); - CBTConfig::saveAccelSettings(CBTConfig::application, m_application.actionCollection); //application - CBTConfig::saveAccelSettings(CBTConfig::allWindows, m_general.actionCollection); //read display windows - CBTConfig::saveAccelSettings(CBTConfig::bibleWindow, m_bible.actionCollection); //bible - CBTConfig::saveAccelSettings(CBTConfig::commentaryWindow, m_commentary.actionCollection); //commentary - CBTConfig::saveAccelSettings(CBTConfig::lexiconWindow, m_lexicon.actionCollection); //lexicon - CBTConfig::saveAccelSettings(CBTConfig::bookWindow, m_book.actionCollection); //book + m_application.actionCollection->writeShortcuts("Application shortcuts"); //application + m_general.actionCollection->writeShortcuts("Displaywindow shortcuts"); //read display windows + m_bible.actionCollection->writeShortcuts("Bible shortcuts"); //bible + m_commentary.actionCollection->writeShortcuts("Commentary shortcuts"); //commentary + m_lexicon.actionCollection->writeShortcuts("Lexicon shortcuts"); //lexicon + m_book.actionCollection->writeShortcuts("Book shortcuts"); //book } void CAcceleratorSettingsPage::slotKeyChooserTypeChanged(const QString& title) { diff --git a/src/frontend/settingsdialogs/cacceleratorsettings.h b/src/frontend/settingsdialogs/cacceleratorsettings.h index 1bd4173..49408d5 100644 --- a/src/frontend/settingsdialogs/cacceleratorsettings.h +++ b/src/frontend/settingsdialogs/cacceleratorsettings.h @@ -1,8 +1,10 @@ /********* * +* In the name of the Father, and of the Son, and of the Holy Spirit. +* * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ diff --git a/src/frontend/settingsdialogs/cconfigurationdialog.cpp b/src/frontend/settingsdialogs/cconfigurationdialog.cpp index 4c5bf1b..951880b 100644 --- a/src/frontend/settingsdialogs/cconfigurationdialog.cpp +++ b/src/frontend/settingsdialogs/cconfigurationdialog.cpp @@ -2,7 +2,7 @@ * * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ @@ -14,16 +14,21 @@ #include <QLayout> #include <QPushButton> #include <QWidget> +#include "backend/config/btconfig.h" #include "frontend/settingsdialogs/cacceleratorsettings.h" #include "frontend/settingsdialogs/cdisplaysettings.h" #include "frontend/settingsdialogs/btfontsettings.h" #include "frontend/settingsdialogs/btlanguagesettings.h" #include "frontend/settingsdialogs/cswordsettings.h" +#include "frontend/messagedialog.h" #include "util/cresmgr.h" #include "util/directory.h" -#include "util/dialogutil.h" +namespace { +const QString GeometryKey = "GUI/SettingsDialog/geometry"; +} // anonymous namespace + CConfigurationDialog::CConfigurationDialog(QWidget * parent, BtActionCollection* actionCollection ) : BtConfigDialog(parent), m_actionCollection(actionCollection), @@ -61,7 +66,7 @@ CConfigurationDialog::CConfigurationDialog(QWidget * parent, BtActionCollection* m_bbox->addButton(QDialogButtonBox::Ok); m_bbox->addButton(QDialogButtonBox::Apply); m_bbox->addButton(QDialogButtonBox::Cancel); - util::prepareDialogBox(m_bbox); + message::prepareDialogBox(m_bbox); setButtonBox(m_bbox); bool ok = connect(m_bbox, SIGNAL(clicked(QAbstractButton *)), SLOT(slotButtonClicked(QAbstractButton *))); Q_ASSERT(ok); @@ -99,13 +104,9 @@ void CConfigurationDialog::slotButtonClicked(QAbstractButton* button) { } void CConfigurationDialog::loadDialogSettings() { - resize(CBTConfig::get(CBTConfig::configDialogWidth), CBTConfig::get(CBTConfig::configDialogHeight)); - move(CBTConfig::get(CBTConfig::configDialogPosX), CBTConfig::get(CBTConfig::configDialogPosY)); + restoreGeometry(btConfig().value<QByteArray>(GeometryKey, QByteArray())); } void CConfigurationDialog::saveDialogSettings() const { - CBTConfig::set(CBTConfig::configDialogWidth, size().width()); - CBTConfig::set(CBTConfig::configDialogHeight, size().height()); - CBTConfig::set(CBTConfig::configDialogPosX, x()); - CBTConfig::set(CBTConfig::configDialogPosY, y()); + btConfig().setValue(GeometryKey, saveGeometry()); } diff --git a/src/frontend/settingsdialogs/cconfigurationdialog.h b/src/frontend/settingsdialogs/cconfigurationdialog.h index d38b4e4..fbd4944 100644 --- a/src/frontend/settingsdialogs/cconfigurationdialog.h +++ b/src/frontend/settingsdialogs/cconfigurationdialog.h @@ -1,8 +1,10 @@ /********* * +* In the name of the Father, and of the Son, and of the Holy Spirit. +* * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ diff --git a/src/frontend/settingsdialogs/cdisplaysettings.cpp b/src/frontend/settingsdialogs/cdisplaysettings.cpp index 6af4547..5b690f6 100644 --- a/src/frontend/settingsdialogs/cdisplaysettings.cpp +++ b/src/frontend/settingsdialogs/cdisplaysettings.cpp @@ -2,7 +2,7 @@ * * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ @@ -14,12 +14,13 @@ #include <QLabel> #include <QVBoxLayout> #include <QWebView> -#include "backend/config/cbtconfig.h" +#include "backend/config/btconfig.h" #include "backend/managers/cdisplaytemplatemgr.h" #include "backend/rendering/cdisplayrendering.h" +#include "bibletimeapp.h" #include "frontend/settingsdialogs/cconfigurationdialog.h" #include "util/cresmgr.h" -#include "util/directory.h" +#include "util/geticon.h" #include "util/tool.h" @@ -46,13 +47,13 @@ QSize CWebViewerWidget::sizeHint () const { /** Initializes the startup section of the OD. */ CDisplaySettingsPage::CDisplaySettingsPage(CConfigurationDialog *parent) - : BtConfigDialog::Page(util::directory::getIcon(CResMgr::settings::startup::icon), parent) + : BtConfigDialog::Page(util::getIcon(CResMgr::settings::startup::icon), parent) { QVBoxLayout *mainLayout = new QVBoxLayout(this); { //startup logo m_showLogoCheck = new QCheckBox(this); - m_showLogoCheck->setChecked(CBTConfig::get(CBTConfig::logo)); + m_showLogoCheck->setChecked(btConfig().value<bool>("GUI/showSplashScreen", true)); mainLayout->addWidget(m_showLogoCheck); } mainLayout->addSpacing(20); @@ -161,14 +162,14 @@ void CDisplaySettingsPage::updateStylePreview() { /// \todo Remove the following hack: const QString oldStyleName = CDisplayTemplateMgr::activeTemplateName(); - CBTConfig::set(CBTConfig::displayStyle, styleName); + btConfig().setValue("GUI/activeTemplateName", styleName); CDisplayRendering render; m_stylePreviewViewer->setHtml( render.renderKeyTree(tree)); - CBTConfig::set(CBTConfig::displayStyle, oldStyleName); + btConfig().setValue("GUI/activeTemplateName", oldStyleName); } void CDisplaySettingsPage::save() { - CBTConfig::set(CBTConfig::logo, m_showLogoCheck->isChecked()); - CBTConfig::set(CBTConfig::displayStyle, m_styleChooserCombo->currentText()); + btConfig().setValue("GUI/showSplashScreen", m_showLogoCheck->isChecked() ); + btConfig().setValue("GUI/activeTemplateName", m_styleChooserCombo->currentText()); } diff --git a/src/frontend/settingsdialogs/cdisplaysettings.h b/src/frontend/settingsdialogs/cdisplaysettings.h index b18a26f..834c846 100644 --- a/src/frontend/settingsdialogs/cdisplaysettings.h +++ b/src/frontend/settingsdialogs/cdisplaysettings.h @@ -1,8 +1,10 @@ /********* * +* In the name of the Father, and of the Son, and of the Holy Spirit. +* * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ diff --git a/src/frontend/settingsdialogs/clistwidget.cpp b/src/frontend/settingsdialogs/clistwidget.cpp index 3a2a4c7..9504009 100644 --- a/src/frontend/settingsdialogs/clistwidget.cpp +++ b/src/frontend/settingsdialogs/clistwidget.cpp @@ -2,7 +2,7 @@ * * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ @@ -17,10 +17,6 @@ CListWidget::CListWidget(QWidget* parent) // Intentionally empty } -CListWidget::~CListWidget() { - // Intentionally empty -} - QSize CListWidget::sizeHint () const { return QSize(100, 120); } diff --git a/src/frontend/settingsdialogs/clistwidget.h b/src/frontend/settingsdialogs/clistwidget.h index ecd5f98..393754c 100644 --- a/src/frontend/settingsdialogs/clistwidget.h +++ b/src/frontend/settingsdialogs/clistwidget.h @@ -1,8 +1,10 @@ /********* * +* In the name of the Father, and of the Son, and of the Holy Spirit. +* * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ @@ -17,7 +19,7 @@ class CListWidget : public QListWidget { Q_OBJECT public: CListWidget(QWidget* parent = 0); - ~CListWidget(); + virtual QSize sizeHint () const; void setCharWidth(int width); }; diff --git a/src/frontend/settingsdialogs/cswordsettings.cpp b/src/frontend/settingsdialogs/cswordsettings.cpp index 60c0e7c..f8f0ebf 100644 --- a/src/frontend/settingsdialogs/cswordsettings.cpp +++ b/src/frontend/settingsdialogs/cswordsettings.cpp @@ -2,322 +2,36 @@ * * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* 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/cswordsettings.h" -#include <QCheckBox> -#include <QComboBox> -#include <QFormLayout> -#include <QLabel> -#include <QList> -#include <QString> -#include <QStringList> -#include <QTabWidget> #include <QVBoxLayout> -#include <QWidget> -#include "backend/config/cbtconfig.h" +#include "bibletimeapp.h" +#include "frontend/settingsdialogs/btstandardworkstab.h" +#include "frontend/settingsdialogs/bttextfilterstab.h" #include "frontend/settingsdialogs/cconfigurationdialog.h" #include "util/cresmgr.h" -#include "util/directory.h" -#include "util/tool.h" +#include "util/geticon.h" -/******************************************************************************* - StandardWorksTab -*******************************************************************************/ - -StandardWorksTab::StandardWorksTab(CSwordSettingsPage *parent) - : QWidget(parent) -{ - typedef QList<CSwordModuleInfo*>::const_iterator MLCI; - - QVBoxLayout *mainLayout = new QVBoxLayout(this); - mainLayout->setMargin(5); - mainLayout->setSpacing(2); - - m_explanationLabel = new QLabel(this); - m_explanationLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); - m_explanationLabel->setMaximumHeight(50); - m_explanationLabel->setMinimumWidth(300); - mainLayout->addWidget(m_explanationLabel); - - QFormLayout *formLayout = new QFormLayout; - -#define STANDARD_WORKS_TAB_ADD_ROW(name) \ - if (true) { \ - m_ ## name ## Label = new QLabel(this); \ - m_ ## name ## Combo = new QComboBox(this); \ - formLayout->addRow(m_ ## name ## Label, m_ ## name ## Combo); \ - } else (void) 0 - - STANDARD_WORKS_TAB_ADD_ROW(standardBible); - STANDARD_WORKS_TAB_ADD_ROW(standardCommentary); - STANDARD_WORKS_TAB_ADD_ROW(standardLexicon); - STANDARD_WORKS_TAB_ADD_ROW(standardDailyDevotional); - STANDARD_WORKS_TAB_ADD_ROW(standardHebrewStrongsLexicon); - STANDARD_WORKS_TAB_ADD_ROW(standardGreekStrongsLexicon); - STANDARD_WORKS_TAB_ADD_ROW(standardHebrewMorphLexicon); - STANDARD_WORKS_TAB_ADD_ROW(standardGreekMorphLexicon); - - mainLayout->addLayout(formLayout); - mainLayout->addStretch(); - - //fill the comboboxes with the right modules - - const QList<CSwordModuleInfo*> &modules(CSwordBackend::instance()->moduleList()); - QString modDescript; - for (MLCI it(modules.begin()); it != modules.end(); it++) { - modDescript = (*it)->config(CSwordModuleInfo::Description); - - switch ((*it)->type()) { - case CSwordModuleInfo::Bible: - m_standardBibleCombo->addItem(modDescript); - break; - case CSwordModuleInfo::Commentary: - m_standardCommentaryCombo->addItem(modDescript); - break; - case CSwordModuleInfo::Lexicon: { - bool inserted = false; - if ((*it)->has(CSwordModuleInfo::HebrewDef)) { - m_standardHebrewStrongsLexiconCombo->addItem(modDescript); - inserted = true; - } - if ((*it)->has(CSwordModuleInfo::GreekDef)) { - m_standardGreekStrongsLexiconCombo->addItem(modDescript); - inserted = true; - } - if ((*it)->has(CSwordModuleInfo::HebrewParse)) { - m_standardHebrewMorphLexiconCombo->addItem(modDescript); - inserted = true; - } - if ((*it)->has(CSwordModuleInfo::GreekParse)) { - m_standardGreekMorphLexiconCombo->addItem(modDescript); - inserted = true; - } - if ((*it)->category() == CSwordModuleInfo::DailyDevotional) { - m_standardDailyDevotionalCombo->addItem(modDescript); - inserted = true; - } - - if (!inserted) { //daily dvotionals, striong lexicons etc. are not very useful for word lookups - m_standardLexiconCombo->addItem(modDescript); - } - break; - } - default://unknown type - break; - } //switch - } //for - - //using two lists and one loop is better than six loops with almost the same code :) - QList<QComboBox*> comboList; - QStringList moduleList; - -#define STANDARD_WORKS_TAB_CASE(name) \ - case CBTConfig::name: \ - comboList.append(m_ ## name ## Combo); \ - break - - for (int i = 0; i <= (int)CBTConfig::lastModuleType; ++i) { - //fill the combobox list in the right order (i.e. same order as the CBTConfig::module enum list) - CBTConfig::modules moduleType = (CBTConfig::modules)(i); - switch (moduleType) { - STANDARD_WORKS_TAB_CASE(standardBible); - STANDARD_WORKS_TAB_CASE(standardCommentary); - STANDARD_WORKS_TAB_CASE(standardLexicon); - STANDARD_WORKS_TAB_CASE(standardDailyDevotional); - STANDARD_WORKS_TAB_CASE(standardHebrewStrongsLexicon); - STANDARD_WORKS_TAB_CASE(standardGreekStrongsLexicon); - STANDARD_WORKS_TAB_CASE(standardHebrewMorphLexicon); - STANDARD_WORKS_TAB_CASE(standardGreekMorphLexicon); - } - ; //switch - - //fill the module list - CSwordModuleInfo* const m = CBTConfig::get( (CBTConfig::modules)(i) ); - if (m) { - moduleList << m->config(CSwordModuleInfo::Description); - } - else { - moduleList << QString::null; - } - } //for - - QString module = QString::null; - int item = 0; - int count = 0; - QListIterator<QComboBox*> it(comboList); - while (it.hasNext()) { - //for (QComboBox* combo = comboList.first(); combo; combo = comboList.next() ) - QComboBox* combo = it.next(); - module = moduleList[comboList.indexOf(combo)]; - count = combo->count(); - combo->setMaximumWidth(300); - - for (item = 0; item < count; item++) { - if (combo->itemText(item) == module ) { - combo->setCurrentIndex(item); - break; - } - } - } - - retranslateUi(); -} - -void StandardWorksTab::save() { - for (int i = 0; i <= (int)CBTConfig::lastModuleType; ++i) { - QString moduleDescription; - - -#define STANDARD_WORKS_TAB_SCASE(name) \ - case CBTConfig::name: \ - moduleDescription = m_ ## name ## Combo->currentText(); \ - break; - - CBTConfig::modules moduleType = (CBTConfig::modules)(i); - switch (moduleType) { - STANDARD_WORKS_TAB_SCASE(standardBible); - STANDARD_WORKS_TAB_SCASE(standardCommentary); - STANDARD_WORKS_TAB_SCASE(standardLexicon); - STANDARD_WORKS_TAB_SCASE(standardDailyDevotional); - STANDARD_WORKS_TAB_SCASE(standardHebrewStrongsLexicon); - STANDARD_WORKS_TAB_SCASE(standardGreekStrongsLexicon); - STANDARD_WORKS_TAB_SCASE(standardHebrewMorphLexicon); - STANDARD_WORKS_TAB_SCASE(standardGreekMorphLexicon); - default: - qWarning("Unhandled module type."); - }; - - CSwordModuleInfo * const module = CSwordBackend::instance()->findModuleByDescription(moduleDescription); - CBTConfig::set(moduleType, module); - } -} - -void StandardWorksTab::retranslateUi() { - util::tool::initExplanationLabel( - m_explanationLabel, "", - tr("Standard works are used when no particular work is specified, for example " - "when a hyperlink into a Bible or lexicon was clicked.")); - - m_standardBibleLabel->setText(tr("Bible:")); - m_standardBibleCombo->setToolTip(tr("The standard Bible is used when a hyperlink into a Bible is clicked")); - - m_standardCommentaryLabel->setText(tr("Commentary:")); - m_standardCommentaryCombo->setToolTip(tr("The standard commentary is used when a hyperlink into a commentary is clicked")); - - m_standardLexiconLabel->setText(tr("Lexicon:")); - m_standardLexiconCombo->setToolTip(tr("The standard lexicon is used when a hyperlink into a lexicon is clicked")); - - m_standardDailyDevotionalLabel->setText(tr("Daily devotional:")); - m_standardDailyDevotionalCombo->setToolTip(tr("The standard devotional will be used to display a short start up devotional")); - - m_standardHebrewStrongsLexiconLabel->setText(tr("Hebrew Strong's lexicon:")); - m_standardHebrewStrongsLexiconCombo->setToolTip(tr("The standard Hebrew lexicon is used when a hyperlink into a Hebrew lexicon is clicked")); - - m_standardGreekStrongsLexiconLabel->setText(tr("Greek Strong's lexicon:")); - m_standardGreekStrongsLexiconCombo->setToolTip(tr("The standard Greek lexicon is used when a hyperlink into a Greek lexicon is clicked")); - - m_standardHebrewMorphLexiconLabel->setText(tr("Hebrew morphological lexicon:")); - m_standardHebrewMorphLexiconCombo->setToolTip(tr("The standard morphological lexicon for Hebrew texts is used when a hyperlink of a morphological tag in a Hebrew text is clicked")); - - m_standardGreekMorphLexiconLabel->setText(tr("Greek morphological lexicon:")); - m_standardGreekMorphLexiconCombo->setToolTip(tr("The standard morphological lexicon for Greek texts is used when a hyperlink of a morphological tag in a Greek text is clicked")); -} - - -/******************************************************************************* - TextFiltersTab -*******************************************************************************/ - -TextFiltersTab::TextFiltersTab(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); - m_explanationLabel->setMinimumWidth(300); - layout->addWidget(m_explanationLabel); - -#define TEXT_FILTERS_TAB_ADD_ROW(name) \ - m_ ## name ## Check = new QCheckBox(this); \ - m_ ## name ## Check->setChecked(CBTConfig::get(CBTConfig::name)); \ - layout->addWidget(m_ ## name ## Check); - - TEXT_FILTERS_TAB_ADD_ROW(lineBreaks); - TEXT_FILTERS_TAB_ADD_ROW(verseNumbers); - TEXT_FILTERS_TAB_ADD_ROW(headings); - TEXT_FILTERS_TAB_ADD_ROW(hebrewPoints); - TEXT_FILTERS_TAB_ADD_ROW(hebrewCantillation); - TEXT_FILTERS_TAB_ADD_ROW(morphSegmentation); - TEXT_FILTERS_TAB_ADD_ROW(greekAccents); - TEXT_FILTERS_TAB_ADD_ROW(textualVariants); - TEXT_FILTERS_TAB_ADD_ROW(scriptureReferences); - - layout->addStretch(4); - - retranslateUi(); -} - -void TextFiltersTab::save() { -#define TEXT_FILTERS_TAB_SAVE(name) CBTConfig::set(CBTConfig::name, m_ ## name ## Check->isChecked()) - - 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); -} - - -void TextFiltersTab::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")); -} - - -/******************************************************************************* - CSwordSettingsPage -*******************************************************************************/ - -CSwordSettingsPage::CSwordSettingsPage(CConfigurationDialog *parent) - : BtConfigDialog::Page(util::directory::getIcon(CResMgr::settings::sword::icon), parent) +CSwordSettingsPage::CSwordSettingsPage(CConfigurationDialog * parent) + : BtConfigDialog::Page(util::getIcon(CResMgr::settings::sword::icon), parent) { static const QString nullString; m_tabWidget = new QTabWidget(this); - m_worksTab = new StandardWorksTab(this); + m_worksTab = new BtStandardWorksTab(this); m_tabWidget->addTab(m_worksTab, nullString); - m_filtersTab = new TextFiltersTab(this); + m_filtersTab = new BtTextFiltersTab(this); m_tabWidget->addTab(m_filtersTab, nullString); - QVBoxLayout *mainLayout = new QVBoxLayout(this); + QVBoxLayout * mainLayout = new QVBoxLayout(this); mainLayout->addWidget(m_tabWidget); retranslateUi(); diff --git a/src/frontend/settingsdialogs/cswordsettings.h b/src/frontend/settingsdialogs/cswordsettings.h index c54630d..18a4268 100644 --- a/src/frontend/settingsdialogs/cswordsettings.h +++ b/src/frontend/settingsdialogs/cswordsettings.h @@ -1,8 +1,10 @@ /********* * +* In the name of the Father, and of the Son, and of the Holy Spirit. +* * This file is part of BibleTime's source code, http://www.bibletime.info/. * -* Copyright 1999-2011 by the BibleTime developers. +* Copyright 1999-2014 by the BibleTime developers. * The BibleTime source code is licensed under the GNU General Public License version 2.0. * **********/ @@ -14,90 +16,9 @@ #include <QWidget> +class BtTextFiltersTab; class CConfigurationDialog; -class CSwordSettingsPage; -class QCheckBox; -class QComboBox; -class QLabel; - - -/******************************************************************************* - StandardWorksTab -*******************************************************************************/ - -class StandardWorksTab: public QWidget { - - Q_OBJECT - - public: /* Methods: */ - - StandardWorksTab(CSwordSettingsPage *parent); - - void save(); - - protected: /* Methods: */ - - void retranslateUi(); - - private: /* Fields: */ - - QLabel *m_explanationLabel; - -#define STANDARD_WORKS_TAB_FIELD(name) \ - QLabel *m_ ## name ## Label; \ - QComboBox *m_ ## name ## Combo - - STANDARD_WORKS_TAB_FIELD(standardBible); - STANDARD_WORKS_TAB_FIELD(standardCommentary); - STANDARD_WORKS_TAB_FIELD(standardLexicon); - STANDARD_WORKS_TAB_FIELD(standardDailyDevotional); - STANDARD_WORKS_TAB_FIELD(standardHebrewStrongsLexicon); - STANDARD_WORKS_TAB_FIELD(standardGreekStrongsLexicon); - STANDARD_WORKS_TAB_FIELD(standardHebrewMorphLexicon); - STANDARD_WORKS_TAB_FIELD(standardGreekMorphLexicon); -}; - - -/******************************************************************************* - TextFiltersTab -*******************************************************************************/ - -class TextFiltersTab: public QWidget { - - Q_OBJECT - - public: /* Methods: */ - - TextFiltersTab(CSwordSettingsPage *parent); - - void save(); - - protected: /* Methods: */ - - void retranslateUi(); - - private: /* Fields: */ - - QLabel *m_explanationLabel; - -#define TEXT_FILTERS_TAB_FIELD(name) QCheckBox *m_ ## name ## Check - - TEXT_FILTERS_TAB_FIELD(lineBreaks); - TEXT_FILTERS_TAB_FIELD(verseNumbers); - TEXT_FILTERS_TAB_FIELD(headings); - TEXT_FILTERS_TAB_FIELD(hebrewPoints); - TEXT_FILTERS_TAB_FIELD(hebrewCantillation); - TEXT_FILTERS_TAB_FIELD(morphSegmentation); - TEXT_FILTERS_TAB_FIELD(greekAccents); - TEXT_FILTERS_TAB_FIELD(textualVariants); - TEXT_FILTERS_TAB_FIELD(scriptureReferences); - -}; - - -/******************************************************************************* - CSwordSettingsPage -*******************************************************************************/ +class BtStandardWorksTab; class CSwordSettingsPage: public BtConfigDialog::Page { @@ -105,7 +26,7 @@ class CSwordSettingsPage: public BtConfigDialog::Page { public: /* Methods: */ - CSwordSettingsPage(CConfigurationDialog *parent = 0); + CSwordSettingsPage(CConfigurationDialog * parent = 0); void save(); @@ -115,9 +36,9 @@ class CSwordSettingsPage: public BtConfigDialog::Page { private: /* Fields: */ - QTabWidget *m_tabWidget; - StandardWorksTab *m_worksTab; - TextFiltersTab *m_filtersTab; + QTabWidget * m_tabWidget; + BtStandardWorksTab * m_worksTab; + BtTextFiltersTab * m_filtersTab; }; |