Warning, file /multimedia/kid3/src/app/kde/kdeconfigdialog.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /**
0002  * \file kdeconfigdialog.cpp
0003  * KDE configuration dialog.
0004  *
0005  * \b Project: Kid3
0006  * \author Urs Fleisch
0007  * \date 17 Sep 2003
0008  *
0009  * Copyright (C) 2003-2024  Urs Fleisch
0010  *
0011  * This file is part of Kid3.
0012  *
0013  * Kid3 is free software; you can redistribute it and/or modify
0014  * it under the terms of the GNU General Public License as published by
0015  * the Free Software Foundation; either version 2 of the License, or
0016  * (at your option) any later version.
0017  *
0018  * Kid3 is distributed in the hope that it will be useful,
0019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0021  * GNU General Public License for more details.
0022  *
0023  * You should have received a copy of the GNU General Public License
0024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0025  */
0026 
0027 #include "kdeconfigdialog.h"
0028 #include <QPushButton>
0029 #include <KConfigSkeleton>
0030 #include "contexthelp.h"
0031 #include "configdialogpages.h"
0032 
0033 /**
0034  * Constructor.
0035  *
0036  * @param platformTools platform specific tools
0037  * @param parent  parent widget
0038  * @param caption dialog title
0039  * @param configSkeleton configuration skeleton
0040  */
0041 KdeConfigDialog::KdeConfigDialog(IPlatformTools* platformTools,
0042                                  QWidget* parent, const QString& caption,
0043                                  KConfigSkeleton* configSkeleton)
0044   : KConfigDialog(parent, QLatin1String("configure"), configSkeleton),
0045     m_pages(new ConfigDialogPages(platformTools, this))
0046 {
0047   setObjectName(QLatin1String("ConfigDialog"));
0048   setWindowTitle(caption);
0049   setSizeGripEnabled(true);
0050 
0051   addPage(m_pages->createTagsPage(), tr("Tags"),
0052           QLatin1String("applications-multimedia"));
0053   addPage(m_pages->createFilesPage(), tr("Files"),
0054           QLatin1String("document-save"));
0055   addPage(m_pages->createActionsPage(), tr("User Actions"),
0056           QLatin1String("preferences-other"));
0057   addPage(m_pages->createNetworkPage(), tr("Network"),
0058           QLatin1String("preferences-system-network"));
0059   addPage(m_pages->createPluginsPage(), tr("Plugins"),
0060           QLatin1String("preferences-plugin"));
0061 
0062   setStandardButtons(QDialogButtonBox::RestoreDefaults |
0063                      QDialogButtonBox::Ok | QDialogButtonBox::Cancel |
0064                      QDialogButtonBox::Help);
0065   if (const QDialogButtonBox* buttons = buttonBox()) {
0066     if (QPushButton* helpButton = buttons->button(QDialogButtonBox::Help)) {
0067       connect(helpButton, &QAbstractButton::clicked,
0068               this, &KdeConfigDialog::slotHelp);
0069     }
0070     if (QPushButton* defaultsButton =
0071         buttons->button(QDialogButtonBox::RestoreDefaults)) {
0072       connect(defaultsButton, &QAbstractButton::clicked,
0073               m_pages, &ConfigDialogPages::setDefaultConfig);
0074     }
0075   }
0076 }
0077 
0078 /**
0079  * Set values in dialog from current configuration.
0080  */
0081 void KdeConfigDialog::setConfig()
0082 {
0083   m_pages->setConfig();
0084 }
0085 
0086 /**
0087  * Get values from dialog and store them in the current configuration.
0088  */
0089 void KdeConfigDialog::getConfig() const
0090 {
0091   m_pages->getConfig();
0092 }
0093 
0094 /**
0095  * Show help.
0096  */
0097 void KdeConfigDialog::slotHelp()
0098 {
0099   ContextHelp::displayHelp(QLatin1String("configure-kid3"));
0100 }
0101 
0102 /**
0103  * Returns whether the current state of the dialog is
0104  * the same as the default configuration.
0105  * @return false
0106  */
0107 bool KdeConfigDialog::isDefault()
0108 {
0109   // The "Defaults" button shall be always enabled.
0110   return false;
0111 }