File indexing completed on 2024-05-12 04:55:01
0001 /** 0002 * \file configdialog.h 0003 * 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 #pragma once 0028 0029 #include <QDialog> 0030 0031 class QTreeView; 0032 class QLabel; 0033 class QCheckBox; 0034 class QString; 0035 class QWidget; 0036 class QComboBox; 0037 class ShortcutsModel; 0038 class MainWindowConfig; 0039 class ConfigDialogPages; 0040 class IPlatformTools; 0041 0042 /** 0043 * Configuration dialog. 0044 */ 0045 class ConfigDialog : public QDialog { 0046 Q_OBJECT 0047 public: 0048 /** 0049 * Constructor. 0050 * 0051 * @param platformTools platform specific tools 0052 * @param parent parent widget 0053 * @param caption dialog title 0054 * @param shortcutsModel shortcuts model 0055 */ 0056 ConfigDialog(IPlatformTools* platformTools, QWidget* parent, 0057 const QString& caption, ShortcutsModel* shortcutsModel); 0058 0059 /** 0060 * Destructor. 0061 */ 0062 ~ConfigDialog() override = default; 0063 0064 /** 0065 * Set values in dialog from current configuration. 0066 */ 0067 void setConfig(); 0068 0069 /** 0070 * Get values from dialog and store them in the current configuration. 0071 */ 0072 void getConfig() const; 0073 0074 protected slots: 0075 /** 0076 * Show help. 0077 */ 0078 void slotHelp(); 0079 0080 /** 0081 * Display warning that keyboard shortcut is already used. 0082 * 0083 * @param key string representation of key sequence 0084 * @param context context of action 0085 * @param action action using @a key 0086 */ 0087 void warnAboutAlreadyUsedShortcut(const QString& key, const QString& context, 0088 const QAction* action); 0089 0090 /** 0091 * Clear warning about already used keyboard shortcut. 0092 */ 0093 void clearAlreadyUsedShortcutWarning(); 0094 0095 /** 0096 * Set additional configurations to their defaults. 0097 */ 0098 void setDefaultConfig(); 0099 0100 /** 0101 * Select custom application font. 0102 */ 0103 void slotSelectFont(); 0104 0105 /** 0106 * Select custom application style. 0107 * 0108 * @param key style key 0109 */ 0110 void slotSelectStyle(const QString& key); 0111 0112 /** 0113 * Revert the font and style to the values in the settings. 0114 */ 0115 void slotRevertFontAndStyle(); 0116 0117 private: 0118 void setConfigs(const MainWindowConfig& mainWindowConfig); 0119 0120 ConfigDialogPages* m_pages; 0121 ShortcutsModel* m_shortcutsModel; 0122 QTreeView* m_shortcutsTreeView; 0123 QLabel* m_shortcutAlreadyUsedLabel; 0124 QCheckBox* m_useApplicationFontCheckBox; 0125 QPushButton* m_applicationFontButton; 0126 QCheckBox* m_useApplicationStyleCheckBox; 0127 QComboBox* m_applicationStyleComboBox; 0128 QComboBox* m_languageComboBox; 0129 QCheckBox* m_useNativeDialogsCheckBox; 0130 QFont m_font; 0131 QString m_style; 0132 bool m_fontChanged; 0133 bool m_styleChanged; 0134 };