1 /* 2 * This file is part of Licq, an instant messaging client for UNIX. 3 * Copyright (C) 2007-2012 Licq developers <licq-dev@googlegroups.com> 4 * 5 * Licq is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * Licq is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with Licq; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 */ 19 20 #ifndef SETTINGSDLG_H 21 #define SETTINGSDLG_H 22 23 #include <config.h> 24 25 #include <QDialog> 26 #include <QMap> 27 28 namespace LicqQtGui 29 { 30 class TreePager; 31 32 namespace Settings 33 { 34 class Chat; 35 class ContactList; 36 class Events; 37 class General; 38 class Network; 39 class Plugins; 40 class Shortcuts; 41 class Skin; 42 class Status; 43 } 44 45 /** 46 * Dialog for holding configuration settings that can be changed by the user. 47 */ 48 class SettingsDlg : public QDialog 49 { 50 Q_OBJECT 51 52 public: 53 enum SettingsPage 54 { 55 UnknownPage = -1, 56 ContactListPage, 57 SkinPage, 58 DockingPage, 59 FontsPage, 60 MainwinShortcutsPage, 61 ContactInfoPage, 62 ChatPage, 63 ChatDispPage, 64 HistDispPage, 65 ChatShortcutsPage, 66 OnEventPage, 67 SoundsPage, 68 FilterPage, 69 NetworkPage, 70 StatusPage, 71 PluginsPage, 72 }; 73 74 /** 75 * Create and show the settings dialog. 76 * If dialog is already showing it just sets the current page to startPage. 77 * 78 * @param page Initial page to show 79 */ 80 static void show(SettingsPage page = ContactListPage); 81 82 /** 83 * Select page to show 84 * 85 * @param page Page to show 86 */ 87 void showPage(SettingsPage page); 88 89 /** 90 * Add page to settings dialog 91 * 92 * @param page Page id 93 * @param widget Widget containg the actual page 94 * @param title Page title 95 * @param parent Parent page if not a top level page 96 */ 97 void addPage(SettingsPage page, QWidget* widget, const QString& title, SettingsPage parent = UnknownPage); 98 99 private slots: 100 /** 101 * Apply settings to running gui. 102 * Does not save settings to disk or close dialog 103 */ 104 void apply(); 105 106 /** 107 * Apply and save settings and close dialog. 108 */ 109 void ok(); 110 111 private: 112 // Only allow one instance at a time so keep track if we have one open 113 static SettingsDlg* myInstance; 114 115 /** 116 * Constructor 117 * 118 * @param parent Parent widget 119 */ 120 SettingsDlg(QWidget* parent = 0); 121 122 /** 123 * Destructor 124 */ 125 virtual ~SettingsDlg(); 126 127 128 TreePager* myPager; 129 QMap<SettingsPage, QWidget*> myPages; 130 131 Settings::Chat* myChatSettings; 132 Settings::ContactList* myContactListSettings; 133 Settings::Events* myEventsSettings; 134 Settings::General* myGeneralSettings; 135 Settings::Network* myNetworkSettings; 136 Settings::Plugins* myPluginsSettings; 137 Settings::Shortcuts* myShortcutsSettings; 138 Settings::Skin* mySkinSettings; 139 Settings::Status* myStatusSettings; 140 }; 141 142 } // namespace LicqQtGui 143 144 #endif 145