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 SETTINGS_EVENTS_H
21 #define SETTINGS_EVENTS_H
22 
23 #include <config.h>
24 
25 #include <QObject>
26 
27 #include <licq/filter.h>
28 
29 class QCheckBox;
30 class QComboBox;
31 class QGridLayout;
32 class QGroupBox;
33 class QLabel;
34 class QPushButton;
35 class QTreeWidget;
36 class QTreeWidgetItem;
37 class QVBoxLayout;
38 class QWidget;
39 
40 
41 namespace LicqQtGui
42 {
43 class FilterRuleDlg;
44 class SettingsDlg;
45 class ShortcutEdit;
46 class OnEventBox;
47 
48 namespace Settings
49 {
50 class Events : public QObject
51 {
52   Q_OBJECT
53 
54 public:
55   Events(SettingsDlg* parent);
~Events()56   virtual ~Events() {}
57 
58   void load();
59   void apply();
60 
61 private slots:
62   void updateRulesList();
63   void updateRuleButtons();
64   void showRuleHints();
65   void resetRules();
66   void editRule(QTreeWidgetItem* item, int index);
67   void insertRule();
68   void removeRule();
69   void editRule();
70   void moveRuleUp();
71   void moveRuleDown();
72   void editRuleDone(int dialogCode);
73 
74 private:
75   /**
76    * Setup the events page.
77    *
78    * @return a widget with the event settings
79    */
80   QWidget* createPageOnEvent(QWidget* parent);
81 
82   /**
83    * Setup the filter page.
84    *
85    * @return a widget with the filter settings
86    */
87   QWidget* createPageFilter(QWidget* parent);
88 
89   /**
90    * Setup the sound page.
91    *
92    * @return a widget with the sound settings
93    */
94   QWidget* createPageSounds(QWidget* parent);
95 
96   // Widgets for on event settings
97   QVBoxLayout* myPageOnEventLayout;
98   QGroupBox* myNewMsgActionsBox;
99   QGroupBox* myParanoiaBox;
100   QVBoxLayout* myParanoiaLayout;
101   QGridLayout* myMsgActionsLayout;
102   QCheckBox* myAlwaysOnlineNotifyCheck;
103   QCheckBox* myNoSoundInActiveChatCheck;
104   QCheckBox* myBoldOnMsgCheck;
105   QComboBox* myAutoPopupCombo;
106   QCheckBox* myAutoRaiseCheck;
107   QCheckBox* myAutoFocusCheck;
108   QCheckBox* myFlashTaskbarCheck;
109   QCheckBox* myFlashAllCheck;
110   QCheckBox* myFlashUrgentCheck;
111   QCheckBox* myIgnoreNewUsersCheck;
112   QCheckBox* myIgnoreWebPanelCheck;
113   QCheckBox* myIgnoreMassMsgCheck;
114   QCheckBox* myIgnoreEmailPagerCheck;
115 #ifdef Q_WS_X11
116   QLabel* myHotKeyLabel;
117   ShortcutEdit* myHotKeyEdit;
118 #endif
119   QCheckBox* myAutoUrgentCheck;
120 
121   // Widget for sounds settings
122   QVBoxLayout* myPageSoundsLayout;
123   OnEventBox* myOnEventBox;
124 
125   // Filter settings
126   QVBoxLayout* myPageFilterLayout;
127   QTreeWidget* myRulesList;
128   QPushButton* myRuleAddButton;
129   QPushButton* myRuleRemoveButton;
130   QPushButton* myRuleEditButton;
131   QPushButton* myRuleUpButton;
132   QPushButton* myRuleDownButton;
133   Licq::FilterRules myFilterRules;
134   FilterRuleDlg* myRuleEditor;
135   int myRuleEditIndex;
136 };
137 
138 } // namespace Settings
139 } // namespace LicqQtGui
140 
141 #endif
142