diff options
author | 2023-03-22 20:24:51 +0530 | |
---|---|---|
committer | 2023-03-22 20:24:51 +0530 | |
commit | 7b64cf518d28597ff004418668b8680d2426e0ed (patch) | |
tree | 158b878d49c0aa80e7d7090f26adf38940abb7a0 /src/downloadwidget.h | |
parent | dd687dc983614e133b841b6b942a13ff2dfd0ebf (diff) | |
download | whatsie-7b64cf518d28597ff004418668b8680d2426e0ed.tar.gz whatsie-7b64cf518d28597ff004418668b8680d2426e0ed.zip |
feat: add open file option in download item
- option allows user to open downloaded file directly from download manager
Diffstat (limited to 'src/downloadwidget.h')
-rw-r--r-- | src/downloadwidget.h | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/downloadwidget.h b/src/downloadwidget.h index 074a979..4417cb4 100644 --- a/src/downloadwidget.h +++ b/src/downloadwidget.h @@ -54,36 +54,40 @@ #include "ui_downloadwidget.h"
#include "widgets/elidedlabel/elidedlabel.h"
-
+#include <QElapsedTimer>
#include <QFrame>
#include <QTime>
-#include <QElapsedTimer>
QT_BEGIN_NAMESPACE
class QWebEngineDownloadItem;
QT_END_NAMESPACE
// Displays one ongoing or finished download (QWebEngineDownloadItem).
-class DownloadWidget final : public QFrame, public Ui::DownloadWidget
-{
- Q_OBJECT
+class DownloadWidget final : public QFrame, public Ui::DownloadWidget {
+ Q_OBJECT
public:
- // Precondition: The QWebEngineDownloadItem has been accepted.
- explicit DownloadWidget(QWebEngineDownloadItem *download, QWidget *parent = nullptr);
+ // Precondition: The QWebEngineDownloadItem has been accepted.
+ explicit DownloadWidget(QWebEngineDownloadItem *download,
+ QWidget *parent = nullptr);
+public slots:
+ // Return true if downloadItem state is InProgress
+ bool isDownloading();
+ // Remove downloadItem, updating the download manager
+ void remove();
signals:
- // This signal is emitted when the user indicates that they want to remove
- // this download from the downloads list.
- void removeClicked(DownloadWidget *self);
+ // This signal is emitted when the user indicates that they want to remove
+ // this download from the downloads list.
+ void removeClicked(DownloadWidget *self);
private slots:
- void updateWidget();
+ void updateWidget();
private:
- QString withUnit(qreal bytes);
+ QString withUnit(qreal bytes);
- QWebEngineDownloadItem *m_download;
- QElapsedTimer m_timeAdded;
+ QWebEngineDownloadItem *m_download;
+ QElapsedTimer m_timeAdded;
};
#endif // DOWNLOADWIDGET_H
|