2022-05-10 10:06:48 +00:00
|
|
|
// Copyright (C) 2020 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2011-04-27 10:05:43 +00:00
|
|
|
#ifndef IMAGESCALING_H
|
|
|
|
#define IMAGESCALING_H
|
|
|
|
|
2011-05-07 20:57:49 +00:00
|
|
|
#include <QtWidgets>
|
2012-02-03 13:17:26 +00:00
|
|
|
#include <QtConcurrent>
|
2020-11-09 15:44:26 +00:00
|
|
|
#include <QNetworkAccessManager>
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2020-11-09 15:44:26 +00:00
|
|
|
class DownloadDialog;
|
2011-04-27 10:05:43 +00:00
|
|
|
class Images : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-08-03 13:43:26 +00:00
|
|
|
Images(QWidget *parent = nullptr);
|
2011-04-27 10:05:43 +00:00
|
|
|
~Images();
|
2020-11-09 15:44:26 +00:00
|
|
|
|
|
|
|
void initLayout(qsizetype count);
|
|
|
|
|
|
|
|
QFuture<QByteArray> download(const QList<QUrl> &urls);
|
|
|
|
QList<QImage> scaled() const;
|
|
|
|
void updateStatus(const QString &msg);
|
|
|
|
void showImages(const QList<QImage> &images);
|
|
|
|
void abortDownload();
|
|
|
|
|
2017-08-03 13:43:26 +00:00
|
|
|
public slots:
|
2020-11-09 15:44:26 +00:00
|
|
|
void process();
|
|
|
|
void cancel();
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
private:
|
2020-11-09 15:44:26 +00:00
|
|
|
QPushButton *addUrlsButton;
|
2011-04-27 10:05:43 +00:00
|
|
|
QPushButton *cancelButton;
|
|
|
|
QVBoxLayout *mainLayout;
|
|
|
|
QList<QLabel *> labels;
|
|
|
|
QGridLayout *imagesLayout;
|
2020-11-09 15:44:26 +00:00
|
|
|
QStatusBar *statusBar;
|
|
|
|
DownloadDialog *downloadDialog;
|
|
|
|
|
|
|
|
QNetworkAccessManager qnam;
|
|
|
|
QList<QSharedPointer<QNetworkReply>> replies;
|
|
|
|
QFuture<QByteArray> downloadFuture;
|
2011-04-27 10:05:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // IMAGESCALING_H
|