diff options
author | Timur Pocheptsov <timur.pocheptsov@qt.io> | 2017-09-21 13:24:07 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2017-09-25 13:59:50 +0000 |
commit | ddb191e47a25a8a5c19cb01bec05c9538b22adf7 (patch) | |
tree | 87919d7ef8ddf4c7c81fe7a79b37a09116924eba /examples/network/securesocketclient/sslclient.h | |
parent | 7896efdd9f51b7defa02e73303f8aa03cc7f3044 (diff) |
QtNetwork (examples) - update secure socket client example
This patch contains:
- some cosmetic changes to make example look more like
modern C++;
- UI initialization code and SSL signals handling were split
into separate member-functions;
- useless checks 'if (socket)' were deleted;
- widget's minimum size is now fixed + font size
in 'CertInfo' dialog increased to make it readable.
Change-Id: I7aadb78896832a989494d280d6da0635045f948c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'examples/network/securesocketclient/sslclient.h')
-rw-r--r-- | examples/network/securesocketclient/sslclient.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/examples/network/securesocketclient/sslclient.h b/examples/network/securesocketclient/sslclient.h index d3baefbc56..63fdbef77d 100644 --- a/examples/network/securesocketclient/sslclient.h +++ b/examples/network/securesocketclient/sslclient.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the examples of the Qt Toolkit. @@ -51,13 +51,13 @@ #ifndef SSLCLIENT_H #define SSLCLIENT_H -#include <QtWidgets/QWidget> -#include <QtNetwork/QAbstractSocket> -#include <QtNetwork/QSslSocket> +#include <QtNetwork> + +QT_REQUIRE_CONFIG(ssl); + +#include <QtWidgets> QT_BEGIN_NAMESPACE -class QSslSocket; -class QToolButton; class Ui_Form; QT_END_NAMESPACE @@ -65,7 +65,7 @@ class SslClient : public QWidget { Q_OBJECT public: - SslClient(QWidget *parent = 0); + explicit SslClient(QWidget *parent = nullptr); ~SslClient(); private slots: @@ -80,12 +80,15 @@ private slots: void displayCertificateInfo(); private: + void setupUi(); + void setupSecureSocket(); void appendString(const QString &line); - QSslSocket *socket; - QToolButton *padLock; - Ui_Form *form; - bool executingDialog; + QSslSocket *socket = nullptr; + QToolButton *padLock = nullptr; + Ui_Form *form = nullptr; + bool handlingSocketError = false; + bool executingDialog = false; }; #endif |