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 _NETWORKSSETTINGSPAGE_H_
22 #define _NETWORKSSETTINGSPAGE_H_
26 #include "settingspage.h"
27 #include "ui_networkssettingspage.h"
28 #include "ui_networkeditdlg.h"
29 #include "ui_servereditdlg.h"
30 #include "ui_saveidentitiesdlg.h"
35 class NetworksSettingsPage : public SettingsPage {
39 NetworksSettingsPage(QWidget *parent = 0);
48 void widgetHasChanged();
49 void setWidgetStates();
50 void coreConnectionStateChanged(bool);
51 void networkConnectionStateChanged(Network::ConnectionState state);
52 void networkConnectionError(const QString &msg);
54 void displayNetwork(NetworkId);
55 void setItemState(NetworkId, QListWidgetItem *item = 0);
57 void clientNetworkAdded(NetworkId);
58 void clientNetworkRemoved(NetworkId);
59 void clientNetworkUpdated();
61 void clientIdentityAdded(IdentityId);
62 void clientIdentityRemoved(IdentityId);
63 void clientIdentityUpdated();
65 void on_networkList_itemSelectionChanged();
66 void on_addNetwork_clicked();
67 void on_deleteNetwork_clicked();
68 void on_renameNetwork_clicked();
70 void on_connectNow_clicked();
72 void on_serverList_itemSelectionChanged();
73 void on_addServer_clicked();
74 void on_deleteServer_clicked();
75 void on_editServer_clicked();
76 void on_upServer_clicked();
77 void on_downServer_clicked();
80 Ui::NetworksSettingsPage ui;
83 QHash<NetworkId, NetworkInfo> networkInfos;
84 bool _ignoreWidgetChanges;
86 QIcon connectedIcon, connectingIcon, disconnectedIcon;
89 bool testHasChanged();
90 QListWidgetItem *insertNetwork(NetworkId);
91 QListWidgetItem *insertNetwork(const NetworkInfo &info);
92 QListWidgetItem *networkItem(NetworkId) const;
93 void saveToNetworkInfo(NetworkInfo &);
96 class NetworkEditDlg : public QDialog {
100 NetworkEditDlg(const QString &old, const QStringList &existing = QStringList(), QWidget *parent = 0);
102 QString networkName() const;
105 void on_networkEdit_textChanged(const QString &);
108 Ui::NetworkEditDlg ui;
110 QStringList existing;
115 class ServerEditDlg : public QDialog {
119 ServerEditDlg(const QVariant &serverData = QVariant(), QWidget *parent = 0);
121 QVariant serverData() const;
124 void on_host_textChanged();
127 Ui::ServerEditDlg ui;
131 class SaveNetworksDlg : public QDialog {
135 SaveNetworksDlg(const QList<NetworkInfo> &toCreate, const QList<NetworkInfo> &toUpdate, const QList<NetworkId> &toRemove, QWidget *parent = 0);
141 Ui::SaveIdentitiesDlg ui;
143 int numevents, rcvevents;