File indexing completed on 2024-04-28 16:31:54
0001 /**************************************************************************** 0002 Copyright (C) 2001-2009 Robby Stephenson <robby@periapsis.org> 0003 ***************************************************************************/ 0004 0005 /*************************************************************************** 0006 * * 0007 * This program is free software; you can redistribute it and/or * 0008 * modify it under the terms of the GNU General Public License as * 0009 * published by the Free Software Foundation; either version 2 of * 0010 * the License or (at your option) version 3 or any later version * 0011 * accepted by the membership of KDE e.V. (or its successor approved * 0012 * by the membership of KDE e.V.), which shall act as a proxy * 0013 * defined in Section 14 of version 3 of the license. * 0014 * * 0015 * This program is distributed in the hope that it will be useful, * 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0018 * GNU General Public License for more details. * 0019 * * 0020 * You should have received a copy of the GNU General Public License * 0021 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 0022 * * 0023 ***************************************************************************/ 0024 0025 #ifndef TELLICO_CONFIGDIALOG_H 0026 #define TELLICO_CONFIGDIALOG_H 0027 0028 #include "fetch/fetcherinfolistitem.h" 0029 0030 #include <KPageDialog> 0031 0032 #include <QListWidget> 0033 0034 class KConfig; 0035 class KIntNumInput; 0036 class KColorCombo; 0037 0038 class QSpinBox; 0039 class QPushButton; 0040 class QLineEdit; 0041 class QFontComboBox; 0042 class QCheckBox; 0043 class QRadioButton; 0044 class QFrame; 0045 0046 namespace Tellico { 0047 namespace Fetch { 0048 class ConfigWidget; 0049 } 0050 namespace GUI { 0051 class ComboBox; 0052 class CollectionTypeCombo; 0053 } 0054 0055 /** 0056 * The configuration dialog class allows the user to change the global application 0057 * preferences. 0058 * 0059 * @author Robby Stephenson 0060 */ 0061 class ConfigDialog : public KPageDialog { 0062 Q_OBJECT 0063 0064 public: 0065 /** 0066 * The constructor sets up the Tabbed dialog pages. 0067 * 0068 * @param parent A pointer to the parent widget 0069 */ 0070 ConfigDialog(QWidget* parent); 0071 virtual ~ConfigDialog(); 0072 0073 /** 0074 * Saves the configuration 0075 */ 0076 void saveConfiguration(); 0077 0078 Q_SIGNALS: 0079 /** 0080 * Emitted whenever the Ok or Apply button is clicked. 0081 */ 0082 void signalConfigChanged(); 0083 0084 private Q_SLOTS: 0085 /** 0086 * Called when anything gets changed 0087 */ 0088 void slotModified(); 0089 /** 0090 * Called when the Ok button is clicked. 0091 */ 0092 virtual void accept() Q_DECL_OVERRIDE; 0093 /** 0094 * Called when the Apply button is clicked. 0095 */ 0096 void slotApply(); 0097 /** 0098 * Called when the Default button is clicked. 0099 */ 0100 void slotDefault(); 0101 void slotHelp(); 0102 void slotInitPage(KPageWidgetItem* item); 0103 /** 0104 * Create a new Internet source 0105 */ 0106 void slotNewSourceClicked(); 0107 /** 0108 * Modify a Internet source 0109 */ 0110 void slotModifySourceClicked(); 0111 /** 0112 * Remove a Internet source 0113 */ 0114 void slotRemoveSourceClicked(); 0115 void slotSelectedSourceChanged(QListWidgetItem* item); 0116 void slotMoveUpSourceClicked(); 0117 void slotMoveDownSourceClicked(); 0118 void slotSourceFilterChanged(); 0119 void slotNewStuffClicked(); 0120 void slotShowTemplatePreview(); 0121 void slotInstallTemplate(); 0122 void slotDownloadTemplate(); 0123 void slotDeleteTemplate(); 0124 void slotCreateConfigWidgets(); 0125 0126 private: 0127 enum Page { 0128 General = 1 << 0, 0129 Printing = 1 << 1, 0130 Template = 1 << 2, 0131 Fetch = 1 << 3 0132 }; 0133 int m_initializedPages; 0134 bool isPageInitialized(Page page) const; 0135 0136 /** 0137 * Sets-up the page for the general options. 0138 */ 0139 void setupGeneralPage(); 0140 void initGeneralPage(QFrame* frame); 0141 void readGeneralConfig(); 0142 void saveGeneralConfig(); 0143 /** 0144 * Sets-up the page for printing options. 0145 */ 0146 void setupPrintingPage(); 0147 void initPrintingPage(QFrame* frame); 0148 void readPrintingConfig(); 0149 void savePrintingConfig(); 0150 /** 0151 * Sets-up the page for template options. 0152 */ 0153 void setupTemplatePage(); 0154 void initTemplatePage(QFrame* frame); 0155 void readTemplateConfig(); 0156 void saveTemplateConfig(); 0157 /** 0158 */ 0159 void setupFetchPage(); 0160 void initFetchPage(QFrame* frame); 0161 void readFetchConfig(); 0162 void saveFetchConfig(); 0163 0164 FetcherInfoListItem* findItem(const QString& path) const; 0165 void loadTemplateList(); 0166 0167 bool m_modifying; 0168 bool m_okClicked; 0169 0170 QRadioButton* m_rbImageInFile; 0171 QRadioButton* m_rbImageInAppDir; 0172 QRadioButton* m_rbImageInLocalDir; 0173 QCheckBox* m_cbOpenLastFile; 0174 QCheckBox* m_cbShowTipDay; 0175 QCheckBox* m_cbEnableWebcam; 0176 QCheckBox* m_cbCapitalize; 0177 QCheckBox* m_cbFormat; 0178 QLineEdit* m_leCapitals; 0179 QLineEdit* m_leArticles; 0180 QLineEdit* m_leSuffixes; 0181 QLineEdit* m_lePrefixes; 0182 0183 QCheckBox* m_cbPrintHeaders; 0184 QCheckBox* m_cbPrintFormatted; 0185 QCheckBox* m_cbPrintGrouped; 0186 QSpinBox* m_imageWidthBox; 0187 QSpinBox* m_imageHeightBox; 0188 0189 GUI::ComboBox* m_templateCombo; 0190 QPushButton* m_previewButton; 0191 QFontComboBox* m_fontCombo; 0192 QSpinBox* m_fontSizeInput; 0193 KColorCombo* m_baseColorCombo; 0194 KColorCombo* m_textColorCombo; 0195 KColorCombo* m_highBaseColorCombo; 0196 KColorCombo* m_highTextColorCombo; 0197 0198 QListWidget* m_sourceListWidget; 0199 QMap<FetcherInfoListItem*, Fetch::ConfigWidget*> m_configWidgets; 0200 QList<Fetch::ConfigWidget*> m_newStuffConfigWidgets; 0201 QList<Fetch::ConfigWidget*> m_removedConfigWidgets; 0202 QPushButton* m_modifySourceBtn; 0203 QPushButton* m_moveUpSourceBtn; 0204 QPushButton* m_moveDownSourceBtn; 0205 QPushButton* m_removeSourceBtn; 0206 QPushButton* m_newStuffBtn; 0207 QCheckBox* m_cbFilterSource; 0208 GUI::CollectionTypeCombo* m_sourceTypeCombo; 0209 }; 0210 0211 } // end namespace 0212 #endif