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 #include <QItemSelection>
30 class BufferViewConfig;
32 class BufferViewSettingsPage : public SettingsPage {
36 BufferViewSettingsPage(QWidget *parent = 0);
37 ~BufferViewSettingsPage();
45 void coreConnectionStateChanged(bool state);
47 void addBufferView(BufferViewConfig *config);
48 void addBufferView(int bufferViewId);
49 void bufferViewDeleted();
50 void newBufferView(const QString &bufferViewName);
51 void updateBufferView();
53 void on_addBufferView_clicked();
54 void on_renameBufferView_clicked();
55 void on_deleteBufferView_clicked();
56 void bufferViewSelectionChanged(const QItemSelection ¤t, const QItemSelection &previous);
58 void widgetHasChanged();
61 Ui::BufferViewSettingsPage ui;
62 bool _ignoreWidgetChanges;
63 bool _useBufferViewHint;
66 // list of bufferviews to create
67 QList<BufferViewConfig *> _newBufferViews;
69 // list of buferViews to delete
70 QList<int> _deleteBufferViews;
72 // Hash of pointers to cloned bufferViewConfigs holding the changes
73 QHash<BufferViewConfig *, BufferViewConfig *> _changedBufferViews;
75 int listPos(BufferViewConfig *config);
76 BufferViewConfig *bufferView(int listPos);
77 bool selectBufferViewById(int bufferViewId);
78 BufferViewConfig *cloneConfig(BufferViewConfig *config);
79 BufferViewConfig *configForDisplay(BufferViewConfig *config);
81 void loadConfig(BufferViewConfig *config);
82 void saveConfig(BufferViewConfig *config);
83 bool testHasChanged();
87 /**************************************************************************
89 *************************************************************************/
90 class BufferViewEditDlg : public QDialog {
94 BufferViewEditDlg(const QString &old, const QStringList &existing = QStringList(), QWidget *parent = 0);
96 inline QString bufferViewName() const { return ui.bufferViewEdit->text(); }
99 void on_bufferViewEdit_textChanged(const QString &);
102 Ui::BufferViewEditDlg ui;
104 QStringList existing;
109 #endif // BUFFERVIEWSETTINGSPAGE_H