X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fnetworkssettingspage.h;h=461c3e0d0f2aa33533776c6291202f904b02a116;hp=46f0756dd1e0ff216cdb48e29b80d8a4a9ac3032;hb=3a3e844f9fcfd12235a0086af75ecd503b621ef4;hpb=0a43227b8cd44625f4881cc1545d42c8c8a4876c diff --git a/src/qtui/settingspages/networkssettingspage.h b/src/qtui/settingspages/networkssettingspage.h index 46f0756d..461c3e0d 100644 --- a/src/qtui/settingspages/networkssettingspage.h +++ b/src/qtui/settingspages/networkssettingspage.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2016 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -38,15 +38,16 @@ class NetworksSettingsPage : public SettingsPage Q_OBJECT public: - NetworksSettingsPage(QWidget *parent = 0); + NetworksSettingsPage(QWidget *parent = nullptr); - virtual inline bool needsCoreConnection() const { return true; } + inline bool needsCoreConnection() const override { return true; } - bool aboutToSave(); + bool aboutToSave() override; public slots: - void save(); - void load(); + void save() override; + void load() override; + void bufferList_Open(NetworkId); private slots: void widgetHasChanged(); @@ -56,7 +57,27 @@ private slots: void networkConnectionError(const QString &msg); void displayNetwork(NetworkId); - void setItemState(NetworkId, QListWidgetItem *item = 0); + void setItemState(NetworkId, QListWidgetItem *item = nullptr); + + /** + * Reset the capability-dependent settings to the default unknown states + * + * For example, this updates the SASL text to indicate the status is unknown. Any actual + * information should be set by setNetworkCapStates() + * + * @see NetworksSettingsPage::setNetworkCapStates() + */ + void resetNetworkCapStates(); + + /** + * 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); @@ -66,6 +87,11 @@ private slots: 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 @@ -85,7 +111,23 @@ private slots: void on_upServer_clicked(); void on_downServer_clicked(); + /** + * Event handler for SASL status Details button + */ + void on_saslStatusDetails_clicked(); + private: + /** + * Status of capability support + */ + enum CapSupportStatus { + Unknown, ///< Old core, or otherwise unknown, can't make assumptions + Disconnected, ///< Disconnected from network, can't determine + MaybeUnsupported, ///< Server does not advertise support at this moment + MaybeSupported ///< Server advertises support at this moment + }; + // Keep in mind networks can add, change, and remove capabilities at any time. + Ui::NetworksSettingsPage ui; NetworkId currentId; @@ -97,6 +139,11 @@ private: QIcon connectedIcon, connectingIcon, disconnectedIcon; + // Status icons + QIcon infoIcon, warningIcon; + + CapSupportStatus _saslStatusSelected; /// Status of SASL support for currently-selected network + void reset(); bool testHasChanged(); QListWidgetItem *insertNetwork(NetworkId); @@ -104,6 +151,13 @@ private: QListWidgetItem *networkItem(NetworkId) const; void saveToNetworkInfo(NetworkInfo &); IdentityId defaultIdentity() const; + + /** + * Update the SASL settings interface according to the given SASL state + * + * @param[in] saslStatus Current status of SASL support. + */ + void setSASLStatus(const CapSupportStatus saslStatus); }; @@ -112,13 +166,23 @@ class NetworkAddDlg : public QDialog Q_OBJECT public: - NetworkAddDlg(const QStringList &existing = QStringList(), QWidget *parent = 0); + NetworkAddDlg(QStringList existing = QStringList(), QWidget *parent = nullptr); NetworkInfo networkInfo() const; private slots: void setButtonStates(); + /** + * 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; @@ -131,7 +195,7 @@ class NetworkEditDlg : public QDialog Q_OBJECT public: - NetworkEditDlg(const QString &old, const QStringList &existing = QStringList(), QWidget *parent = 0); + NetworkEditDlg(const QString &old, QStringList existing = QStringList(), QWidget *parent = nullptr); QString networkName() const; @@ -150,13 +214,23 @@ 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 = nullptr); Network::Server serverData() const; private slots: 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; }; @@ -167,7 +241,7 @@ class SaveNetworksDlg : public QDialog Q_OBJECT public: - SaveNetworksDlg(const QList &toCreate, const QList &toUpdate, const QList &toRemove, QWidget *parent = 0); + SaveNetworksDlg(const QList &toCreate, const QList &toUpdate, const QList &toRemove, QWidget *parent = nullptr); private slots: void clientEvent();