1 /*
2  * This file is part of Licq, an instant messaging client for UNIX.
3  * Copyright (C) 2008-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 USERDLG_MODES_H
21 #define USERDLG_MODES_H
22 
23 #include <config.h>
24 
25 #include <QObject>
26 
27 class QCheckBox;
28 class QGridLayout;
29 class QGroupBox;
30 class QHBoxLayout;
31 class QPushButton;
32 class QRadioButton;
33 class QTableWidget;
34 class QVBoxLayout;
35 class QWidget;
36 
37 namespace Licq
38 {
39 class User;
40 class UserId;
41 }
42 
43 namespace LicqQtGui
44 {
45 class MLEdit;
46 class OnEventBox;
47 class UserDlg;
48 
49 namespace UserPages
50 {
51 class Settings : public QObject
52 {
53   Q_OBJECT
54 
55 public:
56   Settings(UserDlg* parent);
~Settings()57   virtual ~Settings() {}
58 
59   void load(const Licq::User* user);
60   void apply(Licq::User* user);
61 
62   /**
63    * Save user data for pages
64    * Call this function without user locked
65    *
66    * @param userId User id
67    */
68   void apply2(const Licq::UserId& userId);
69 
70   /**
71    * User was updated
72    *
73    * @param user User locked for read access
74    * @param subSignal Sub signal telling what the change was
75    */
76   void userUpdated(const Licq::User* user, unsigned long subSignal);
77 
78 private slots:
79   /**
80    * Show hints for auto response editing
81    */
82   void showAutoRespHints();
83 
84 private:
85   /**
86    * Setup the modes page.
87    *
88    * @return a widget with the modes settings
89    */
90   QWidget* createPageSettings(QWidget* parent);
91 
92   /**
93    * Setup the status page.
94    *
95    * @return a widget with the status settings
96    */
97   QWidget* createPageStatus(QWidget* parent);
98 
99   /**
100    * Setup the sounds page
101    *
102    * @return a widget with the sounds settings
103    */
104   QWidget* createPageOnEvent(QWidget* parent);
105 
106   /**
107    * Setup the groups page
108    *
109    * @return a widget with the groups selection
110    */
111   QWidget* createPageGroups(QWidget* parent);
112 
113   // Widgets for on modes page
114   QGridLayout* myPageModesLayout;
115   QGroupBox* mySettingsBox;
116   QGridLayout* mySettingsLayout;
117   QCheckBox* myAcceptInAwayCheck;
118   QCheckBox* myAcceptInNaCheck;
119   QCheckBox* myAcceptInOccupiedCheck;
120   QCheckBox* myAcceptInDndCheck;
121   QCheckBox* myAutoAcceptFileCheck;
122   QCheckBox* myAutoAcceptChatCheck;
123   QCheckBox* myAutoSecureCheck;
124   QCheckBox* myUseGpgCheck;
125   QCheckBox* myUseRealIpCheck;
126 
127   // Status page
128   QGridLayout* myPageStatusLayout;
129   QGroupBox* myStatusBox;
130   QVBoxLayout* myStatusLayout;
131   QRadioButton* myStatusNoneRadio;
132   QRadioButton* myStatusOnlineRadio;
133   QRadioButton* myStatusAwayRadio;
134   QRadioButton* myStatusNaRadio;
135   QRadioButton* myStatusOccupiedRadio;
136   QRadioButton* myStatusDndRadio;
137   QGroupBox* mySysGroupBox;
138   QVBoxLayout* mySysGroupLayout;
139   QCheckBox* myOnlineNotifyCheck;
140   QCheckBox* myVisibleListCheck;
141   QCheckBox* myInvisibleListCheck;
142   QCheckBox* myIgnoreListCheck;
143   QCheckBox* myNewUserCheck;
144   QGroupBox* myAutoRespBox;
145   QHBoxLayout* myAutoRespLayout;
146   MLEdit* myAutoRespEdit;
147   QPushButton* myAutoRespClearButton;
148   QPushButton* myAutoRespHintsButton;
149 
150   // Sounds page
151   QVBoxLayout* myPageOnEventLayout;
152   OnEventBox* myOnEventBox;
153 
154   // Widgets for groups page
155   QVBoxLayout* myPageGroupsLayout;
156   QGroupBox* myGroupsBox;
157   QVBoxLayout* myGroupsLayout;
158   QTableWidget* myGroupsTable;
159 };
160 
161 } // namespace UserPages
162 } // namespace LicqQtGui
163 
164 #endif
165