MCPcopy Create free account
hub / github.com/altairwei/WizNotePlus / DownloadWidget

Method DownloadWidget

src/widgets/DownloadManagerWidget.cpp:65–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63#include "share/WizMisc.h"
64
65DownloadWidget::DownloadWidget(QWebEngineDownloadItem *download, QWidget *parent)
66 : QFrame(parent)
67 , m_download(download)
68 , m_timeAdded()
69{
70 m_timeAdded.start();
71 setupUi(this);
72#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
73 m_dstName->setText(m_download->downloadFileName());
74#else
75 m_dstName->setText(QFileInfo(m_download->path()).fileName());
76#endif
77 m_srcUrl->setText(m_download->url().toDisplayString());
78 QIcon removeIcon(WizLoadSkinIcon(Utils::WizStyleHelper::themeName(), "trash"));
79 m_cancelButton->setIcon(removeIcon);
80
81 connect(m_cancelButton, &QPushButton::clicked,
82 [this](bool) {
83 if (m_download->state() == QWebEngineDownloadItem::DownloadInProgress)
84 m_download->cancel();
85 else
86 emit removeClicked(this);
87 });
88
89 connect(m_download, &QWebEngineDownloadItem::downloadProgress,
90 this, &DownloadWidget::updateWidget);
91
92 connect(m_download, &QWebEngineDownloadItem::stateChanged,
93 this, &DownloadWidget::updateWidget);
94
95 updateWidget();
96}
97
98inline QString DownloadWidget::withUnit(qreal bytes)
99{

Callers

nothing calls this directly

Calls 9

QFileInfoClass · 0.85
WizLoadSkinIconFunction · 0.85
connectFunction · 0.85
urlMethod · 0.80
setTextMethod · 0.45
fileNameMethod · 0.45
pathMethod · 0.45
setIconMethod · 0.45
stateMethod · 0.45

Tested by

no test coverage detected