File indexing completed on 2024-04-21 03:51:09

0001 /*
0002     parleyprefs.cpp  -  Parley configuration dialog
0003     SPDX-FileCopyrightText: 2005, 2007 Peter Hedlund <peter.hedlund@kdemail.net>
0004     SPDX-FileCopyrightText: 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #include "parleyprefs.h"
0009 #include "generaloptions.h"
0010 #include "kgametheme/kgamethemeselector.h"
0011 #include "translationshelloptions.h"
0012 #include "viewoptions.h"
0013 #include <KConfigSkeleton>
0014 #include <KLocalizedString>
0015 
0016 ParleyPrefs::ParleyPrefs(KEduVocDocument *doc, QWidget *parent, const QString &name, KConfigSkeleton *config)
0017     : KConfigDialog(parent, name, config)
0018     , m_config{config}
0019     , m_doc{doc}
0020 {
0021     button(QDialogButtonBox::Ok)->setDefault(true);
0022     setModal(true);
0023 
0024     addPage(new KGameThemeSelector(this, config), i18n("Theme"), QStringLiteral("games-config-theme"));
0025 
0026     m_generalOptions = new GeneralOptions(this);
0027     addPage(m_generalOptions, i18nc("title:window general settings", "General"), QStringLiteral("parley"), i18n("General Settings"));
0028 
0029     m_viewOptions = new ViewOptions(this);
0030     addPage(m_viewOptions, i18n("View"), QStringLiteral("view-choose"), i18n("View Settings"));
0031 
0032     m_translationShellOptions = new TranslationShellOptions(this);
0033     addPage(m_translationShellOptions, i18n("Online Translations"), QStringLiteral("internet-services"), i18n("Online Translation Services"));
0034 
0035     setHelp(QString(), QStringLiteral("parley"));
0036 }
0037 
0038 bool ParleyPrefs::hasChanged()
0039 {
0040     return m_generalOptions->hasChanged();
0041 }
0042 
0043 bool ParleyPrefs::isDefault()
0044 {
0045     return m_generalOptions->isDefault();
0046 }
0047 
0048 void ParleyPrefs::updateSettings()
0049 {
0050     m_generalOptions->updateSettings();
0051     Q_EMIT settingsChanged(QLatin1String(""));
0052 }
0053 
0054 void ParleyPrefs::updateWidgetsDefault()
0055 {
0056     m_config->useDefaults(true);
0057     m_generalOptions->updateWidgets();
0058     m_config->useDefaults(false);
0059 }
0060 
0061 void ParleyPrefs::updateWidgets()
0062 {
0063     m_generalOptions->updateWidgets();
0064 }
0065 
0066 #include "moc_parleyprefs.cpp"