1 /***************************************************************************
2 * Copyright (C) 2005-2014 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #ifndef NETWORKSSETTINGSPAGE_H
22 #define NETWORKSSETTINGSPAGE_H
27 #include "settingspage.h"
28 #include "clientidentity.h"
30 #include "ui_networkssettingspage.h"
31 #include "ui_networkadddlg.h"
32 #include "ui_networkeditdlg.h"
33 #include "ui_servereditdlg.h"
34 #include "ui_saveidentitiesdlg.h"
36 class NetworksSettingsPage : public SettingsPage
41 NetworksSettingsPage(QWidget *parent = 0);
43 virtual inline bool needsCoreConnection() const { return true; }
52 void widgetHasChanged();
53 void setWidgetStates();
54 void coreConnectionStateChanged(bool);
55 void networkConnectionStateChanged(Network::ConnectionState state);
56 void networkConnectionError(const QString &msg);
58 void displayNetwork(NetworkId);
59 void setItemState(NetworkId, QListWidgetItem *item = 0);
61 void clientNetworkAdded(NetworkId);
62 void clientNetworkRemoved(NetworkId);
63 void clientNetworkUpdated();
65 void clientIdentityAdded(IdentityId);
66 void clientIdentityRemoved(IdentityId);
67 void clientIdentityUpdated();
73 void on_networkList_itemSelectionChanged();
74 void on_addNetwork_clicked();
75 void on_deleteNetwork_clicked();
76 void on_renameNetwork_clicked();
77 void on_editIdentities_clicked();
79 // void on_connectNow_clicked();
81 void on_serverList_itemSelectionChanged();
82 void on_addServer_clicked();
83 void on_deleteServer_clicked();
84 void on_editServer_clicked();
85 void on_upServer_clicked();
86 void on_downServer_clicked();
89 Ui::NetworksSettingsPage ui;
92 QHash<NetworkId, NetworkInfo> networkInfos;
93 bool _ignoreWidgetChanges;
98 QPixmap connectedIcon, connectingIcon, disconnectedIcon;
101 bool testHasChanged();
102 QListWidgetItem *insertNetwork(NetworkId);
103 QListWidgetItem *insertNetwork(const NetworkInfo &info);
104 QListWidgetItem *networkItem(NetworkId) const;
105 void saveToNetworkInfo(NetworkInfo &);
106 IdentityId defaultIdentity() const;
110 class NetworkAddDlg : public QDialog
115 NetworkAddDlg(const QStringList &existing = QStringList(), QWidget *parent = 0);
117 NetworkInfo networkInfo() const;
120 void setButtonStates();
123 Ui::NetworkAddDlg ui;
125 QStringList existing;
129 class NetworkEditDlg : public QDialog
134 NetworkEditDlg(const QString &old, const QStringList &existing = QStringList(), QWidget *parent = 0);
136 QString networkName() const;
139 void on_networkEdit_textChanged(const QString &);
142 Ui::NetworkEditDlg ui;
144 QStringList existing;
148 class ServerEditDlg : public QDialog
153 ServerEditDlg(const Network::Server &server = Network::Server(), QWidget *parent = 0);
155 Network::Server serverData() const;
158 void on_host_textChanged();
161 Ui::ServerEditDlg ui;
165 class SaveNetworksDlg : public QDialog
170 SaveNetworksDlg(const QList<NetworkInfo> &toCreate, const QList<NetworkInfo> &toUpdate, const QList<NetworkId> &toRemove, QWidget *parent = 0);
176 Ui::SaveIdentitiesDlg ui;
178 int numevents, rcvevents;