aboutsummaryrefslogtreecommitdiff
path: root/src/downloadwidget.cpp
diff options
context:
space:
mode:
authorLibravatar Keshav Bhatt <keshavbhatt@users.noreply.github.com>2022-03-30 04:24:36 +0530
committerLibravatar GitHub <noreply@github.com>2022-03-30 04:24:36 +0530
commit474b9212a6630c8404d5f4cf7aa02428deddd3fd (patch)
treed3ae12704da254acb18c74fd5e741ae2b1c055ea /src/downloadwidget.cpp
parent8f071469453c6dbbe3c3dbc78ee893f239835b5a (diff)
downloadwhatsie-474b9212a6630c8404d5f4cf7aa02428deddd3fd.tar.gz
whatsie-474b9212a6630c8404d5f4cf7aa02428deddd3fd.zip
feat: v4.0 (#35)
* add new widgets * feat: version 4.0 - SystemTray: tray icon uses png rather than svg - SystemTray: added settings to lets user change the systemtray icon click behavior(minimize/maximize on right click) - Download: added settiing that lets user set default download directory, avoid asking while saving files - Lock: added setting to let user change current set password for lock screen - Lock: current set password now hidden by default and can be revealed for 5 seconds by pressing view button - Style/Theme: added ability to change widget style on the fly, added default light palatte (prevent breaking of light theme on KDE EVs) - Theme: dark theme update - WebApp: added setting to set zoom factor when window is maximized and fullscreen (gives user ability to set different zoom factor for Normal , Maximized/Fullscreen WindowStates) - Setting: settings UI is more oraganized - WebApp: enable JavaScript execCommand("paste") - WebApp: tested for new WhatsApp Web that lets users use whatsie without requiring the phone connected to internet
Diffstat (limited to 'src/downloadwidget.cpp')
-rw-r--r--src/downloadwidget.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/downloadwidget.cpp b/src/downloadwidget.cpp
index 4af29d3..d228074 100644
--- a/src/downloadwidget.cpp
+++ b/src/downloadwidget.cpp
@@ -11,7 +11,7 @@ DownloadWidget::DownloadWidget(QWebEngineDownloadItem *download,
m_dstName->setText(QFileInfo(m_download->downloadDirectory()).fileName());
m_srcUrl->setText(m_download->url().toDisplayString());
- connect(m_cancelButton, &QPushButton::clicked, [this](bool) {
+ connect(m_cancelButton, &QPushButton::clicked, m_download, [this](bool) {
if (m_download->state() == QWebEngineDownloadItem::DownloadInProgress)
m_download->cancel();
else
@@ -53,30 +53,30 @@ void DownloadWidget::updateWidget() {
m_progressBar->setValue(qRound(100 * receivedBytes / totalBytes));
m_progressBar->setDisabled(false);
m_progressBar->setFormat(tr("%p% - %1 of %2 downloaded - %3/s")
- .arg(withUnit(receivedBytes))
- .arg(withUnit(totalBytes))
- .arg(withUnit(bytesPerSecond)));
+ .arg(withUnit(receivedBytes),
+ withUnit(totalBytes),
+ withUnit(bytesPerSecond)));
} else {
m_progressBar->setValue(0);
m_progressBar->setDisabled(false);
- m_progressBar->setFormat(tr("unknown size - %1 downloaded - %2/s")
- .arg(withUnit(receivedBytes))
- .arg(withUnit(bytesPerSecond)));
+ m_progressBar->setFormat(
+ tr("unknown size - %1 downloaded - %2/s")
+ .arg(withUnit(receivedBytes), withUnit(bytesPerSecond)));
}
break;
case QWebEngineDownloadItem::DownloadCompleted:
m_progressBar->setValue(100);
m_progressBar->setDisabled(true);
- m_progressBar->setFormat(tr("completed - %1 downloaded - %2/s")
- .arg(withUnit(receivedBytes))
- .arg(withUnit(bytesPerSecond)));
+ m_progressBar->setFormat(
+ tr("completed - %1 downloaded - %2/s")
+ .arg(withUnit(receivedBytes), withUnit(bytesPerSecond)));
break;
case QWebEngineDownloadItem::DownloadCancelled:
m_progressBar->setValue(0);
m_progressBar->setDisabled(true);
- m_progressBar->setFormat(tr("cancelled - %1 downloaded - %2/s")
- .arg(withUnit(receivedBytes))
- .arg(withUnit(bytesPerSecond)));
+ m_progressBar->setFormat(
+ tr("cancelled - %1 downloaded - %2/s")
+ .arg(withUnit(receivedBytes), withUnit(bytesPerSecond)));
break;
case QWebEngineDownloadItem::DownloadInterrupted:
m_progressBar->setValue(0);
@@ -87,11 +87,11 @@ void DownloadWidget::updateWidget() {
}
if (state == QWebEngineDownloadItem::DownloadInProgress) {
- static QIcon cancelIcon(QStringLiteral(":/icons/stop-line.png"));
+ static QIcon cancelIcon(":/icons/stop-line.png");
m_cancelButton->setIcon(cancelIcon);
m_cancelButton->setToolTip(tr("Stop downloading"));
} else {
- static QIcon removeIcon(QStringLiteral(":/icons/close-fill.png"));
+ static QIcon removeIcon(":/icons/close-fill.png");
m_cancelButton->setIcon(removeIcon);
m_cancelButton->setToolTip(tr("Remove from list"));
}