Make SettingsPages a little bit clearer to use.
[quassel.git] / src / qtui / settingspages / networkssettingspage.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 _NETWORKSSETTINGSPAGE_H_
22 #define _NETWORKSSETTINGSPAGE_H_
23
24 #include <QIcon>
25
26 #include "settingspage.h"
27 #include "ui_networkssettingspage.h"
28 #include "ui_networkeditdlgnew.h"
29
30 #include "network.h"
31 #include "types.h"
32
33 class NetworksSettingsPage : public SettingsPage {
34   Q_OBJECT
35
36   public:
37     NetworksSettingsPage(QWidget *parent = 0);
38
39     //bool aboutToSave();
40
41   public slots:
42     void save();
43     void load();
44
45   private slots:
46     void widgetHasChanged();
47     void setWidgetStates();
48     void coreConnectionStateChanged(bool);
49
50     void displayNetwork(NetworkId, bool dontsave = false);
51
52     void clientNetworkAdded(NetworkId);
53     void clientNetworkUpdated();
54
55     void clientIdentityAdded(IdentityId);
56     void clientIdentityRemoved(IdentityId);
57     void clientIdentityUpdated();
58
59     void on_networkList_itemSelectionChanged();
60     void on_addNetwork_clicked();
61
62   private:
63     Ui::NetworksSettingsPage ui;
64
65     NetworkId currentId;
66     QHash<NetworkId, NetworkInfo> networkInfos;
67
68     QIcon connectedIcon, disconnectedIcon;
69
70     void reset();
71     bool testHasChanged();
72     void insertNetwork(NetworkId);
73     QListWidgetItem *networkItem(NetworkId) const;
74 };
75
76 class NetworkEditDlgNew : public QDialog {
77   Q_OBJECT
78
79   public:
80     NetworkEditDlgNew(const QString &old, const QStringList &existing = QStringList(), QWidget *parent = 0);
81
82     QString networkName() const;
83
84   private slots:
85     void on_networkEdit_textChanged(const QString &);
86
87   private:
88     Ui::NetworkEditDlgNew ui;
89
90     QStringList existing;
91 };
92
93
94
95 class ServerEditDlgNew : public QDialog {
96   Q_OBJECT
97
98   public:
99     ServerEditDlgNew(const QVariantMap &serverData = QVariantMap(), QWidget *parent = 0);
100
101     QVariantMap serverData() const;
102
103   private:
104     QVariantMap _serverData;
105 };
106
107
108
109 #endif