1 /***************************************************************************
2 * Copyright (C) 2005-08 by the Quassel IRC Team *
3 * devel@quassel-irc.org *
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. *
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. *
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 ***************************************************************************/
21 #ifndef BUFFERVIEWSETTINGSPAGE_H
22 #define BUFFERVIEWSETTINGSPAGE_H
24 #include "settingspage.h"
25 #include "ui_bufferviewsettingspage.h"
26 #include "ui_buffervieweditdlg.h"
28 class BufferViewConfig;
30 class BufferViewSettingsPage : public SettingsPage {
34 BufferViewSettingsPage(QWidget *parent = 0);
35 ~BufferViewSettingsPage();
43 void coreConnectionStateChanged(bool state);
45 void addBufferView(BufferViewConfig *config);
46 void addBufferView(int bufferViewId);
47 void newBufferView(const QString &bufferViewName);
48 void updateBufferView();
50 void on_addBufferView_clicked();
51 void on_renameBufferView_clicked();
54 Ui::BufferViewSettingsPage ui;
56 // mappings for bufferViewId to position in the list and vice versa
57 QHash<int, int> _viewToListPos;
58 QHash<int, int> _listPosToView;
60 // list of bufferviews to create
61 QList<BufferViewConfig *> _newBufferViews;
63 // Hash of pointers to cloned bufferViewConfigs holding the changes
64 QHash<BufferViewConfig *, BufferViewConfig *> _changedBufferViews;
66 int listPos(BufferViewConfig *config);
67 int bufferViewId(int listPos);
68 BufferViewConfig *cloneConfig(BufferViewConfig *config);
69 BufferViewConfig *configForDisplay(BufferViewConfig *config);
73 /**************************************************************************
75 *************************************************************************/
76 class BufferViewEditDlg : public QDialog {
80 BufferViewEditDlg(const QString &old, const QStringList &existing = QStringList(), QWidget *parent = 0);
82 inline QString bufferViewName() const { return ui.bufferViewEdit->text(); }
85 void on_bufferViewEdit_textChanged(const QString &);
88 Ui::BufferViewEditDlg ui;
95 #endif // BUFFERVIEWSETTINGSPAGE_H