mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
Fix build with QtWebEngine 5.9
This commit is contained in:
parent
5e6f92f7bc
commit
ff9c70dccb
|
@ -36,6 +36,7 @@
|
||||||
#include <QFileIconProvider>
|
#include <QFileIconProvider>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QWebEngineDownloadItem>
|
#include <QWebEngineDownloadItem>
|
||||||
|
#include <QtWebEngineWidgetsVersion>
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#include "Shlwapi.h"
|
#include "Shlwapi.h"
|
||||||
|
@ -234,9 +235,11 @@ void DownloadItem::updateDownloadInfo(double currSpeed, qint64 received, qint64
|
||||||
// | m_remTime | |m_currSize| |m_fileSize| |m_speed|
|
// | m_remTime | |m_currSize| |m_fileSize| |m_speed|
|
||||||
// Remaining 26 minutes - 339MB of 693 MB (350kB/s)
|
// Remaining 26 minutes - 339MB of 693 MB (350kB/s)
|
||||||
|
|
||||||
|
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||||
if (m_download->isPaused()) {
|
if (m_download->isPaused()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int estimatedTime = ((total - received) / 1024) / (currSpeed / 1024);
|
int estimatedTime = ((total - received) / 1024) / (currSpeed / 1024);
|
||||||
QString speed = currentSpeedToString(currSpeed);
|
QString speed = currentSpeedToString(currSpeed);
|
||||||
|
@ -280,6 +283,7 @@ void DownloadItem::stop()
|
||||||
|
|
||||||
void DownloadItem::pauseResume()
|
void DownloadItem::pauseResume()
|
||||||
{
|
{
|
||||||
|
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||||
if (m_download->isPaused()) {
|
if (m_download->isPaused()) {
|
||||||
m_download->resume();
|
m_download->resume();
|
||||||
ui->pauseResumeButton->setPixmap(QIcon::fromTheme(QSL("media-playback-pause")).pixmap(20, 20));
|
ui->pauseResumeButton->setPixmap(QIcon::fromTheme(QSL("media-playback-pause")).pixmap(20, 20));
|
||||||
|
@ -288,6 +292,7 @@ void DownloadItem::pauseResume()
|
||||||
ui->pauseResumeButton->setPixmap(QIcon::fromTheme(QSL("media-playback-start")).pixmap(20, 20));
|
ui->pauseResumeButton->setPixmap(QIcon::fromTheme(QSL("media-playback-start")).pixmap(20, 20));
|
||||||
ui->downloadInfo->setText(tr("Paused - %1").arg(m_download->url().host()));
|
ui->downloadInfo->setText(tr("Paused - %1").arg(m_download->url().host()));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DownloadItem::mouseDoubleClickEvent(QMouseEvent* e)
|
void DownloadItem::mouseDoubleClickEvent(QMouseEvent* e)
|
||||||
|
@ -307,11 +312,13 @@ void DownloadItem::customContextMenuRequested(const QPoint &pos)
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
menu.addAction(QIcon::fromTheme("process-stop"), tr("Cancel downloading"), this, &DownloadItem::stop)->setEnabled(m_downloading);
|
menu.addAction(QIcon::fromTheme("process-stop"), tr("Cancel downloading"), this, &DownloadItem::stop)->setEnabled(m_downloading);
|
||||||
|
|
||||||
|
#if QTWEBENGINEWIDGETS_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||||
if (m_download->isPaused()) {
|
if (m_download->isPaused()) {
|
||||||
menu.addAction(QIcon::fromTheme("media-playback-start"), tr("Resume downloading"), this, &DownloadItem::pauseResume)->setEnabled(m_downloading);
|
menu.addAction(QIcon::fromTheme("media-playback-start"), tr("Resume downloading"), this, &DownloadItem::pauseResume)->setEnabled(m_downloading);
|
||||||
} else {
|
} else {
|
||||||
menu.addAction(QIcon::fromTheme("media-playback-pause"), tr("Pause downloading"), this, &DownloadItem::pauseResume)->setEnabled(m_downloading);
|
menu.addAction(QIcon::fromTheme("media-playback-pause"), tr("Pause downloading"), this, &DownloadItem::pauseResume)->setEnabled(m_downloading);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
menu.addAction(QIcon::fromTheme("list-remove"), tr("Remove From List"), this, &DownloadItem::clear)->setEnabled(!m_downloading);
|
menu.addAction(QIcon::fromTheme("list-remove"), tr("Remove From List"), this, &DownloadItem::clear)->setEnabled(!m_downloading);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user