1 /*
2  * %kadu copyright begin%
3  * Copyright 2015 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
4  * %kadu copyright end%
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #pragma once
21 
22 #include "buddies/group.h"
23 
24 #include <QtCore/QPointer>
25 #include <QtWidgets/QDialog>
26 #include <injeqt/injeqt.h>
27 
28 class DeprecatedConfigurationApi;
29 class GroupManager;
30 class GroupStorage;
31 class IconsManager;
32 
33 class QCheckBox;
34 class QLabel;
35 class QLineEdit;
36 class QToolButton;
37 
38 class GroupEditWindow : public QDialog
39 {
40 	Q_OBJECT
41 
42 public:
43 	explicit GroupEditWindow(Group group, QWidget *parent = nullptr);
44 	virtual ~GroupEditWindow();
45 
46 protected:
47 	virtual void accept() override;
48 
49 private:
50 	QPointer<Configuration> m_configuration;
51 	QPointer<GroupManager> m_groupManager;
52 	QPointer<GroupStorage> m_groupStorage;
53 	QPointer<IconsManager> m_iconsManager;
54 
55 	Group m_group;
56 	bool m_add;
57 	QString m_selectedIcon;
58 
59 	QLineEdit *m_nameLineEdit;
60 	QLabel *m_nameErrorLabel;
61 	QCheckBox *m_nameCheckBox;
62 	QCheckBox *m_iconCheckBox;
63 	QToolButton *m_selectIconButton;
64 	QCheckBox *m_notifyCheckBox;
65 	QCheckBox *m_offlineCheckBox;
66 	QCheckBox *m_allGroupCheckBox;
67 	QPushButton *m_saveButton;
68 	QPushButton *m_applyButton;
69 
70 	void createGui();
71 	void loadValues();
72 	void storeValues();
73 
74 private slots:
75 	INJEQT_SET void setConfiguration(Configuration *configuration);
76 	INJEQT_SET void setGroupManager(GroupManager *groupManager);
77 	INJEQT_SET void setGroupStorage(GroupStorage *groupStorage);
78 	INJEQT_SET void setIconsManager(IconsManager *iconsManager);
79 	INJEQT_INIT void init();
80 
81 	void selectIcon();
82 	void dataChanged();
83 
84 	void apply();
85 
86 };
87