summaryrefslogtreecommitdiffstats
path: root/examples/network/http/httpwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/network/http/httpwindow.cpp')
-rw-r--r--examples/network/http/httpwindow.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/examples/network/http/httpwindow.cpp b/examples/network/http/httpwindow.cpp
index 39ffb3cc87..c7bf0c0dff 100644
--- a/examples/network/http/httpwindow.cpp
+++ b/examples/network/http/httpwindow.cpp
@@ -48,13 +48,14 @@
**
****************************************************************************/
+#include "httpwindow.h"
+
+#include "ui_authenticationdialog.h"
+
#include <QtWidgets>
#include <QtNetwork>
#include <QUrl>
-#include "httpwindow.h"
-#include "ui_authenticationdialog.h"
-
#if QT_CONFIG(ssl)
const char defaultUrl[] = "https://www.qt.io/";
#else
@@ -74,6 +75,10 @@ ProgressDialog::ProgressDialog(const QUrl &url, QWidget *parent)
setMinimumSize(QSize(400, 75));
}
+ProgressDialog::~ProgressDialog()
+{
+}
+
void ProgressDialog::networkReplyProgress(qint64 bytesRead, qint64 totalBytes)
{
setMaximum(totalBytes);
@@ -137,6 +142,10 @@ HttpWindow::HttpWindow(QWidget *parent)
urlLineEdit->setFocus();
}
+HttpWindow::~HttpWindow()
+{
+}
+
void HttpWindow::startRequest(const QUrl &requestedUrl)
{
url = requestedUrl;
@@ -204,9 +213,9 @@ void HttpWindow::downloadFile()
startRequest(newUrl);
}
-QFile *HttpWindow::openFileForWrite(const QString &fileName)
+std::unique_ptr<QFile> HttpWindow::openFileForWrite(const QString &fileName)
{
- QScopedPointer<QFile> file(new QFile(fileName));
+ std::unique_ptr<QFile> file(new QFile(fileName));
if (!file->open(QIODevice::WriteOnly)) {
QMessageBox::information(this, tr("Error"),
tr("Unable to save the file %1: %2.")
@@ -214,7 +223,7 @@ QFile *HttpWindow::openFileForWrite(const QString &fileName)
file->errorString()));
return nullptr;
}
- return file.take();
+ return file;
}
void HttpWindow::cancelDownload()
@@ -231,8 +240,7 @@ void HttpWindow::httpFinished()
if (file) {
fi.setFile(file->fileName());
file->close();
- delete file;
- file = nullptr;
+ file.reset();
}
if (httpRequestAborted) {