DownloadWidget.h raw
 1#pragma once
 2
 3#include <QFrame>
 4
 5class QLabel;
 6class QProgressBar;
 7class QPushButton;
 8class QWebEngineDownloadRequest;
 9
10class DownloadWidget : public QFrame {
11	Q_OBJECT
12public:
13	explicit DownloadWidget(QWebEngineDownloadRequest *downloadReq);
14	bool isCompleted() const;
15
16signals:
17	void removeRequested(DownloadWidget *self);
18
19private slots:
20	void onDownloadProgress(qint64 received, qint64 total);
21	void onStateChanged();
22	void onButtonClicked();
23
24private:
25	static QString formatSize(qint64 bytes);
26
27	QWebEngineDownloadRequest *download;
28	QLabel *filenameLabel;
29	QProgressBar *progressBar;
30	QLabel *statusLabel;
31	QPushButton *button;
32};