Make Breeze the default icon theme
[quassel.git] / src / qtui / settingspages / bufferviewsettingspage.h
1 /***************************************************************************
2  *   Copyright (C) 2005-2016 by the Quassel Project                        *
3  *   devel@quassel-irc.org                                                 *
4  *                                                                         *
5  *   This program 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) version 3.                                           *
9  *                                                                         *
10  *   This program 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 this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
19  ***************************************************************************/
20
21 #ifndef BUFFERVIEWSETTINGSPAGE_H
22 #define BUFFERVIEWSETTINGSPAGE_H
23
24 #include "settingspage.h"
25 #include "ui_bufferviewsettingspage.h"
26 #include "ui_buffervieweditdlg.h"
27
28 #include <QItemSelection>
29
30 class BufferViewConfig;
31
32 class BufferViewSettingsPage : public SettingsPage
33 {
34     Q_OBJECT
35
36 public:
37     BufferViewSettingsPage(QWidget *parent = 0);
38     ~BufferViewSettingsPage();
39
40 public slots:
41     void save();
42     void load();
43     void reset();
44
45 private slots:
46     void coreConnectionStateChanged(bool state);
47
48     void addBufferView(BufferViewConfig *config);
49     void addBufferView(int bufferViewId);
50     void bufferViewDeleted();
51     void newBufferView(const QString &bufferViewName);
52     void updateBufferView();
53
54     void enableStatusBuffers(int networkIdx);
55
56     void on_addBufferView_clicked();
57     void on_renameBufferView_clicked();
58     void on_deleteBufferView_clicked();
59     void bufferViewSelectionChanged(const QItemSelection &current, const QItemSelection &previous);
60
61     void widgetHasChanged();
62
63 private:
64     Ui::BufferViewSettingsPage ui;
65     bool _ignoreWidgetChanges;
66     bool _useBufferViewHint;
67     int _bufferViewHint;
68
69     // list of bufferviews to create
70     QList<BufferViewConfig *> _newBufferViews;
71
72     // list of buferViews to delete
73     QList<int> _deleteBufferViews;
74
75     // Hash of pointers to cloned bufferViewConfigs holding the changes
76     QHash<BufferViewConfig *, BufferViewConfig *> _changedBufferViews;
77
78     int listPos(BufferViewConfig *config);
79     BufferViewConfig *bufferView(int listPos);
80     bool selectBufferViewById(int bufferViewId);
81     BufferViewConfig *cloneConfig(BufferViewConfig *config);
82     BufferViewConfig *configForDisplay(BufferViewConfig *config);
83
84     void loadConfig(BufferViewConfig *config);
85     void saveConfig(BufferViewConfig *config);
86     bool testHasChanged();
87 };
88
89
90 /**************************************************************************
91  * BufferViewEditDlg
92  *************************************************************************/
93 class BufferViewEditDlg : public QDialog
94 {
95     Q_OBJECT
96
97 public:
98     BufferViewEditDlg(const QString &old, const QStringList &existing = QStringList(), QWidget *parent = 0);
99
100     inline QString bufferViewName() const { return ui.bufferViewEdit->text(); }
101
102 private slots:
103     void on_bufferViewEdit_textChanged(const QString &);
104
105 private:
106     Ui::BufferViewEditDlg ui;
107
108     QStringList existing;
109 };
110
111
112 #endif // BUFFERVIEWSETTINGSPAGE_H