1 /***************************************************************************
2 * Copyright (C) 2005-2013 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"
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
40 NetworksSettingsPage(QWidget *parent = 0);
42 virtual inline bool needsCoreConnection() const { return true; }
51 void widgetHasChanged();
52 void setWidgetStates();
53 void coreConnectionStateChanged(bool);
54 void networkConnectionStateChanged(Network::ConnectionState state);
55 void networkConnectionError(const QString &msg);
57 void displayNetwork(NetworkId);
58 void setItemState(NetworkId, QListWidgetItem *item = 0);
60 void clientNetworkAdded(NetworkId);
61 void clientNetworkRemoved(NetworkId);
62 void clientNetworkUpdated();
64 void clientIdentityAdded(IdentityId);
65 void clientIdentityRemoved(IdentityId);
66 void clientIdentityUpdated();
68 void on_networkList_itemSelectionChanged();
69 void on_addNetwork_clicked();
70 void on_deleteNetwork_clicked();
71 void on_renameNetwork_clicked();
72 void on_editIdentities_clicked();
74 // void on_connectNow_clicked();
76 void on_serverList_itemSelectionChanged();
77 void on_addServer_clicked();
78 void on_deleteServer_clicked();
79 void on_editServer_clicked();
80 void on_upServer_clicked();
81 void on_downServer_clicked();
84 Ui::NetworksSettingsPage ui;
87 QHash<NetworkId, NetworkInfo> networkInfos;
88 bool _ignoreWidgetChanges;
90 QPixmap connectedIcon, connectingIcon, disconnectedIcon;
93 bool testHasChanged();
94 QListWidgetItem *insertNetwork(NetworkId);
95 QListWidgetItem *insertNetwork(const NetworkInfo &info);
96 QListWidgetItem *networkItem(NetworkId) const;
97 void saveToNetworkInfo(NetworkInfo &);
98 IdentityId defaultIdentity() const;
102 class NetworkAddDlg : public QDialog
107 NetworkAddDlg(const QStringList &existing = QStringList(), QWidget *parent = 0);
109 NetworkInfo networkInfo() const;
112 void setButtonStates();
115 Ui::NetworkAddDlg ui;
117 QStringList existing;
121 class NetworkEditDlg : public QDialog
126 NetworkEditDlg(const QString &old, const QStringList &existing = QStringList(), QWidget *parent = 0);
128 QString networkName() const;
131 void on_networkEdit_textChanged(const QString &);
134 Ui::NetworkEditDlg ui;
136 QStringList existing;
140 class ServerEditDlg : public QDialog
145 ServerEditDlg(const Network::Server &server = Network::Server(), QWidget *parent = 0);
147 Network::Server serverData() const;
150 void on_host_textChanged();
153 Ui::ServerEditDlg ui;
157 class SaveNetworksDlg : public QDialog
162 SaveNetworksDlg(const QList<NetworkInfo> &toCreate, const QList<NetworkInfo> &toUpdate, const QList<NetworkId> &toRemove, QWidget *parent = 0);
168 Ui::SaveIdentitiesDlg ui;
170 int numevents, rcvevents;