X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fnetworkssettingspage.h;h=e88f281df09f15ec6509e16a70e0702b26a7cb08;hp=e0d9684a77963557ca3ef2343e8f5b4afe877088;hb=d5b5dab4ffbdbf30612f49cb77e000ad07b800c2;hpb=4dc83e1ad7f059aeb41d6e401ebd677b56af676a diff --git a/src/qtui/settingspages/networkssettingspage.h b/src/qtui/settingspages/networkssettingspage.h index e0d9684a..e88f281d 100644 --- a/src/qtui/settingspages/networkssettingspage.h +++ b/src/qtui/settingspages/networkssettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-09 by the Quassel Project * + * Copyright (C) 2005-2016 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -15,16 +15,17 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef NETWORKSSETTINGSPAGE_H #define NETWORKSSETTINGSPAGE_H -#include +#include #include "network.h" #include "settingspage.h" +#include "clientidentity.h" #include "ui_networkssettingspage.h" #include "ui_networkadddlg.h" @@ -32,19 +33,22 @@ #include "ui_servereditdlg.h" #include "ui_saveidentitiesdlg.h" -class NetworksSettingsPage : public SettingsPage { - Q_OBJECT +class NetworksSettingsPage : public SettingsPage +{ + Q_OBJECT - public: +public: NetworksSettingsPage(QWidget *parent = 0); + virtual inline bool needsCoreConnection() const { return true; } + bool aboutToSave(); - public slots: +public slots: void save(); void load(); - private slots: +private slots: void widgetHasChanged(); void setWidgetStates(); void coreConnectionStateChanged(bool); @@ -54,6 +58,16 @@ class NetworksSettingsPage : public SettingsPage { void displayNetwork(NetworkId); void setItemState(NetworkId, QListWidgetItem *item = 0); + /** + * Update the capability-dependent settings according to what the server supports + * + * For example, this updates the SASL text for when the server advertises support. This should + * only be called on the currently displayed network. + * + * @param[in] id NetworkId referencing network used to update settings user interface. + */ + void setNetworkCapStates(NetworkId id); + void clientNetworkAdded(NetworkId); void clientNetworkRemoved(NetworkId); void clientNetworkUpdated(); @@ -62,10 +76,20 @@ class NetworksSettingsPage : public SettingsPage { void clientIdentityRemoved(IdentityId); void clientIdentityUpdated(); + /** + * Update the settings user interface according to capabilities advertised by the IRC server + */ + void clientNetworkCapsUpdated(); + +#ifdef HAVE_SSL + void sslUpdated(); +#endif + void on_networkList_itemSelectionChanged(); void on_addNetwork_clicked(); void on_deleteNetwork_clicked(); void on_renameNetwork_clicked(); + void on_editIdentities_clicked(); // void on_connectNow_clicked(); @@ -76,14 +100,17 @@ class NetworksSettingsPage : public SettingsPage { void on_upServer_clicked(); void on_downServer_clicked(); - private: +private: Ui::NetworksSettingsPage ui; NetworkId currentId; QHash networkInfos; bool _ignoreWidgetChanges; +#ifdef HAVE_SSL + CertIdentity *_cid; +#endif - QPixmap connectedIcon, connectingIcon, disconnectedIcon; + QIcon connectedIcon, connectingIcon, disconnectedIcon; void reset(); bool testHasChanged(); @@ -91,75 +118,100 @@ class NetworksSettingsPage : public SettingsPage { QListWidgetItem *insertNetwork(const NetworkInfo &info); QListWidgetItem *networkItem(NetworkId) const; void saveToNetworkInfo(NetworkInfo &); + IdentityId defaultIdentity() const; }; -class NetworkAddDlg : public QDialog { - Q_OBJECT +class NetworkAddDlg : public QDialog +{ + Q_OBJECT - public: +public: NetworkAddDlg(const QStringList &existing = QStringList(), QWidget *parent = 0); NetworkInfo networkInfo() const; - private slots: +private slots: void setButtonStates(); - private: + /** + * Update the default server port according to isChecked + * + * Connect with useSSL->toggled() in order to keep the port number in sync. This only modifies + * the port if it's not been changed from defaults. + * + * @param isChecked If true and port unchanged, set port to 6697, else set port to 6667. + */ + void updateSslPort(bool isChecked); + +private: Ui::NetworkAddDlg ui; - QString networksFilePath; QStringList existing; }; -class NetworkEditDlg : public QDialog { - Q_OBJECT +class NetworkEditDlg : public QDialog +{ + Q_OBJECT - public: +public: NetworkEditDlg(const QString &old, const QStringList &existing = QStringList(), QWidget *parent = 0); QString networkName() const; - private slots: +private slots: void on_networkEdit_textChanged(const QString &); - private: +private: Ui::NetworkEditDlg ui; QStringList existing; }; -class ServerEditDlg : public QDialog { - Q_OBJECT +class ServerEditDlg : public QDialog +{ + Q_OBJECT public: - ServerEditDlg(const Network::Server &server = Network::Server(), QWidget *parent = 0); + ServerEditDlg(const Network::Server &server = Network::Server(), QWidget *parent = 0); - Network::Server serverData() const; + Network::Server serverData() const; private slots: - void on_host_textChanged(); + void on_host_textChanged(); + + /** + * Update the default server port according to isChecked + * + * Connect with useSSL->toggled() in order to keep the port number in sync. This only modifies + * the port if it's not been changed from defaults. + * + * @param isChecked If true and port unchanged, set port to 6697, else set port to 6667. + */ + void updateSslPort(bool isChecked); private: - Ui::ServerEditDlg ui; + Ui::ServerEditDlg ui; }; -class SaveNetworksDlg : public QDialog { - Q_OBJECT +class SaveNetworksDlg : public QDialog +{ + Q_OBJECT - public: +public: SaveNetworksDlg(const QList &toCreate, const QList &toUpdate, const QList &toRemove, QWidget *parent = 0); - private slots: +private slots: void clientEvent(); - private: +private: Ui::SaveIdentitiesDlg ui; int numevents, rcvevents; }; + #endif