Make completion suffix configurable. Fixes BR130
[quassel.git] / src / qtui / settingspages / bufferviewsettingspage.h
1 /***************************************************************************
2  *   Copyright (C) 2005-08 by the Quassel IRC Team                         *
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  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, 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   Q_OBJECT
34
35 public:
36   BufferViewSettingsPage(QWidget *parent = 0);
37   ~BufferViewSettingsPage();
38
39 public slots:
40   void save();
41   void load();
42   void reset();
43
44 private slots:
45   void coreConnectionStateChanged(bool state);
46
47   void addBufferView(BufferViewConfig *config);
48   void addBufferView(int bufferViewId);
49   void bufferViewDeleted();
50   void newBufferView(const QString &bufferViewName);
51   void updateBufferView();
52
53   void on_addBufferView_clicked();
54   void on_renameBufferView_clicked();
55   void on_deleteBufferView_clicked();
56   void bufferViewSelectionChanged(const QItemSelection &current, const QItemSelection &previous);
57
58   void widgetHasChanged();
59   
60 private:
61   Ui::BufferViewSettingsPage ui;
62   bool _ignoreWidgetChanges;
63
64   // list of bufferviews to create
65   QList<BufferViewConfig *> _newBufferViews;
66
67   // list of buferViews to delete
68   QList<int> _deleteBufferViews;
69   
70   // Hash of pointers to cloned bufferViewConfigs holding the changes
71   QHash<BufferViewConfig *, BufferViewConfig *> _changedBufferViews;
72
73   int listPos(BufferViewConfig *config);
74   BufferViewConfig *bufferView(int listPos);
75   BufferViewConfig *cloneConfig(BufferViewConfig *config);
76   BufferViewConfig *configForDisplay(BufferViewConfig *config);
77
78   void loadConfig(BufferViewConfig *config);
79   void saveConfig(BufferViewConfig *config);
80   bool testHasChanged();
81 };
82
83
84 /**************************************************************************
85  * BufferViewEditDlg
86  *************************************************************************/
87 class BufferViewEditDlg : public QDialog {
88   Q_OBJECT
89
90 public:
91   BufferViewEditDlg(const QString &old, const QStringList &existing = QStringList(), QWidget *parent = 0);
92
93   inline QString bufferViewName() const { return ui.bufferViewEdit->text(); }
94
95 private slots:
96   void on_bufferViewEdit_textChanged(const QString &);
97   
98 private:
99   Ui::BufferViewEditDlg ui;
100
101   QStringList existing;
102 };
103
104
105
106 #endif // BUFFERVIEWSETTINGSPAGE_H