Falkon Develop
Cross-platform Qt-based web browser
downloadkjob.cpp
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2019 Javier Llorente <javier@opensuse.org>
4*
5* This program is free software: you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation, either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <http://www.gnu.org/licenses/>.
17* ============================================================ */
18#include "downloadkjob.h"
19
20DownloadKJob::DownloadKJob(const QUrl &url, const QString &path, const QString &fileName, QObject *parent)
21 : KJob(parent),
22 m_url(url),
23 m_path(path),
24 m_fileName(fileName)
25{
26}
27
29{
30}
31
33{
34 Q_EMIT description(this, tr("Downloading"),
35 qMakePair<QString, QString>(tr("Source"), m_url.toDisplayString()),
36 qMakePair<QString, QString>(tr("Destination"), QSL("%1/%2").arg(m_path, m_fileName)));
37}
38
39void DownloadKJob::progress(double currSpeed, qint64 received, qint64 total)
40{
41 setProcessedAmount(Bytes, received);
42 setTotalAmount(Bytes, total);
43 Q_EMIT speed(this, currSpeed);
44}
void progress(double currSpeed, qint64 received, qint64 total)
void updateDescription()
DownloadKJob(const QUrl &url, const QString &path, const QString &fileName, QObject *parent=nullptr)
#define QSL(x)
Definition: qzcommon.h:40