1 /***************************************************************************
2 * Copyright (C) 2005-09 by the Quassel Project *
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
27 #include "settingspage.h"
29 #include "ui_networkssettingspage.h"
30 #include "ui_networkadddlg.h"
31 #include "ui_networkeditdlg.h"
32 #include "ui_servereditdlg.h"
33 #include "ui_saveidentitiesdlg.h"
35 class NetworksSettingsPage : public SettingsPage {
39 NetworksSettingsPage(QWidget *parent = 0);
41 virtual inline bool needsCoreConnection() const { return true; }
50 void widgetHasChanged();
51 void setWidgetStates();
52 void coreConnectionStateChanged(bool);
53 void networkConnectionStateChanged(Network::ConnectionState state);
54 void networkConnectionError(const QString &msg);
56 void displayNetwork(NetworkId);
57 void setItemState(NetworkId, QListWidgetItem *item = 0);
59 void clientNetworkAdded(NetworkId);
60 void clientNetworkRemoved(NetworkId);
61 void clientNetworkUpdated();
63 void clientIdentityAdded(IdentityId);
64 void clientIdentityRemoved(IdentityId);
65 void clientIdentityUpdated();
67 void on_networkList_itemSelectionChanged();
68 void on_addNetwork_clicked();
69 void on_deleteNetwork_clicked();
70 void on_renameNetwork_clicked();
71 void on_editIdentities_clicked();
73 // void on_connectNow_clicked();
75 void on_serverList_itemSelectionChanged();
76 void on_addServer_clicked();
77 void on_deleteServer_clicked();
78 void on_editServer_clicked();
79 void on_upServer_clicked();
80 void on_downServer_clicked();
83 Ui::NetworksSettingsPage ui;
86 QHash<NetworkId, NetworkInfo> networkInfos;
87 bool _ignoreWidgetChanges;
89 QPixmap connectedIcon, connectingIcon, disconnectedIcon;
92 bool testHasChanged();
93 QListWidgetItem *insertNetwork(NetworkId);
94 QListWidgetItem *insertNetwork(const NetworkInfo &info);
95 QListWidgetItem *networkItem(NetworkId) const;
96 void saveToNetworkInfo(NetworkInfo &);
97 IdentityId defaultIdentity() const;
101 class NetworkAddDlg : public QDialog {
105 NetworkAddDlg(const QStringList &existing = QStringList(), QWidget *parent = 0);
107 NetworkInfo networkInfo() const;
110 void setButtonStates();
113 Ui::NetworkAddDlg ui;
115 QStringList existing;
119 class NetworkEditDlg : public QDialog {
123 NetworkEditDlg(const QString &old, const QStringList &existing = QStringList(), QWidget *parent = 0);
125 QString networkName() const;
128 void on_networkEdit_textChanged(const QString &);
131 Ui::NetworkEditDlg ui;
133 QStringList existing;
137 class ServerEditDlg : public QDialog {
141 ServerEditDlg(const Network::Server &server = Network::Server(), QWidget *parent = 0);
143 Network::Server serverData() const;
146 void on_host_textChanged();
149 Ui::ServerEditDlg ui;
153 class SaveNetworksDlg : public QDialog {
157 SaveNetworksDlg(const QList<NetworkInfo> &toCreate, const QList<NetworkInfo> &toUpdate, const QList<NetworkId> &toRemove, QWidget *parent = 0);
163 Ui::SaveIdentitiesDlg ui;
165 int numevents, rcvevents;