22 #include "DownloadTracker.h"
24 DownloadTracker::DownloadTracker(QObject *parent)
30 bool DownloadTracker::isServiceReady()
const
33 if(m_adaptor !=
nullptr) {
34 ready = m_adaptor->isValid();
40 QString DownloadTracker::dbusPath()
const
45 void DownloadTracker::setDbusPath(
const QString& path)
47 if(m_dbusPath != path){
50 Q_EMIT dbusPathChanged(m_dbusPath);
54 QString DownloadTracker::service()
const
59 void DownloadTracker::setService(
const QString& service)
61 if(m_service != service){
64 Q_EMIT serviceChanged(m_service);
68 void DownloadTracker::startService()
71 if(!m_service.isEmpty() && !m_dbusPath.isEmpty()) {
72 m_adaptor =
new DownloadTrackerAdaptor(m_service, m_dbusPath, QDBusConnection::sessionBus(),
this);
74 connect(m_adaptor, SIGNAL(canceled(
bool)),
this, SIGNAL(canceled(
bool)));
75 connect(m_adaptor, SIGNAL(error(
const QString &)),
this, SIGNAL(error(
const QString &)));
76 connect(m_adaptor, SIGNAL(finished(
const QString &)),
this, SIGNAL(finished(
const QString &)));
77 connect(m_adaptor, SIGNAL(paused(
bool)),
this, SIGNAL(paused(
bool)));
78 connect(m_adaptor, SIGNAL(progress(qulonglong, qulonglong)),
this, SIGNAL(progress(qulonglong, qulonglong)));
79 connect(m_adaptor, SIGNAL(resumed(
bool)),
this, SIGNAL(resumed(
bool)));
80 connect(m_adaptor, SIGNAL(started(
bool)),
this, SIGNAL(started(
bool)));
83 Q_EMIT serviceReadyChanged(m_adaptor && m_adaptor->isValid());