Commit 9f402680 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Merge branch 'Plasma/5.10'

parents cbe05ff6 12146bc5
......@@ -34,7 +34,6 @@ PackageKitUpdater::PackageKitUpdater(PackageKitBackend * parent)
m_isCancelable(false),
m_isProgressing(false),
m_status(PackageKit::Transaction::Status::StatusUnknown),
m_remainingTime(0),
m_percentage(0),
m_lastUpdate()
{
......@@ -69,7 +68,6 @@ void PackageKitUpdater::setupTransaction(PackageKit::Transaction::TransactionFla
connect(m_transaction.data(), &PackageKit::Transaction::eulaRequired, this, &PackageKitUpdater::eulaRequired);
connect(m_transaction.data(), &PackageKit::Transaction::statusChanged, this, &PackageKitUpdater::statusChanged);
connect(m_transaction.data(), &PackageKit::Transaction::allowCancelChanged, this, &PackageKitUpdater::cancellableChanged);
connect(m_transaction.data(), &PackageKit::Transaction::remainingTimeChanged, this, &PackageKitUpdater::remainingTimeChanged);
connect(m_transaction.data(), &PackageKit::Transaction::percentageChanged, this, &PackageKitUpdater::percentageChanged);
connect(m_transaction.data(), &PackageKit::Transaction::itemProgress, this, &PackageKitUpdater::itemProgress);
}
......@@ -165,14 +163,6 @@ void PackageKitUpdater::percentageChanged()
}
}
void PackageKitUpdater::remainingTimeChanged()
{
if (m_remainingTime != m_transaction->remainingTime()) {
m_remainingTime = m_transaction->remainingTime();
emit remainingTimeChanged();
}
}
void PackageKitUpdater::statusChanged()
{
if (m_status != m_transaction->status()) {
......@@ -190,12 +180,6 @@ qreal PackageKitUpdater::progress() const
return m_percentage;
}
/** proposed ETA in milliseconds */
long unsigned int PackageKitUpdater::remainingTime() const
{
return m_remainingTime;
}
void PackageKitUpdater::removeResources(const QList<AbstractResource*>& apps)
{
QSet<QString> pkgs = involvedPackages(apps.toSet());
......
......@@ -38,9 +38,6 @@ class PackageKitUpdater : public AbstractBackendUpdater
void setProgressing(bool progressing);
/** proposed ETA in milliseconds */
long unsigned int remainingTime() const override;
void removeResources(const QList<AbstractResource*>& apps) override;
void addResources(const QList<AbstractResource*>& apps) override;
QList<AbstractResource*> toUpdate() const override;
......@@ -65,7 +62,6 @@ class PackageKitUpdater : public AbstractBackendUpdater
void finished(PackageKit::Transaction::Exit exit, uint);
void statusChanged();
void cancellableChanged();
void remainingTimeChanged();
void percentageChanged();
void printMessage(PackageKit::Transaction::Message type, const QString &message);
void updateDetail(const QString& packageID, const QStringList& updates, const QStringList& obsoletes, const QStringList& vendorUrls,
......@@ -88,7 +84,6 @@ class PackageKitUpdater : public AbstractBackendUpdater
bool m_isCancelable;
bool m_isProgressing;
PackageKit::Transaction::Status m_status;
long unsigned int m_remainingTime;
uint m_percentage;
QDateTime m_lastUpdate;
QStringList m_packagesRemoved;
......
......@@ -77,11 +77,6 @@ class DISCOVERCOMMON_EXPORT AbstractBackendUpdater : public QObject
*/
virtual qreal progress() const = 0;
/**
* @returns the proposed ETA in milliseconds
*/
virtual long unsigned int remainingTime() const = 0;
/**
* This method is used to remove resources from the list of packages
* marked to be upgraded. It will potentially be called before \start.
......@@ -155,11 +150,6 @@ class DISCOVERCOMMON_EXPORT AbstractBackendUpdater : public QObject
* @see progress
*/
void progressChanged(qreal progress);
/**
* The AbstractBackendUpdater should emit this signal when the remaining time changed.
* @see remainingTime
*/
void remainingTimeChanged();//FIXME: API inconsistency here!!
/**
* The AbstractBackendUpdater should emit this signal when the cancelable property changed.
* @see isCancelable
......
......@@ -127,7 +127,6 @@ void ResourcesUpdatesModel::init()
if(updater && !m_updaters.contains(updater)) {
connect(updater, &AbstractBackendUpdater::statusMessageChanged, this, &ResourcesUpdatesModel::message);
connect(updater, &AbstractBackendUpdater::statusDetailChanged, this, &ResourcesUpdatesModel::message);
connect(updater, &AbstractBackendUpdater::remainingTimeChanged, this, &ResourcesUpdatesModel::etaChanged);
connect(updater, &AbstractBackendUpdater::downloadSpeedChanged, this, &ResourcesUpdatesModel::downloadSpeedChanged);
connect(updater, &AbstractBackendUpdater::resourceProgressed, this, &ResourcesUpdatesModel::resourceProgressed);
connect(updater, &AbstractBackendUpdater::destroyed, this, &ResourcesUpdatesModel::updaterDestroyed);
......@@ -184,23 +183,6 @@ void ResourcesUpdatesModel::updateAll()
}
}
QString ResourcesUpdatesModel::remainingTime() const
{
long unsigned int maxEta = 0;
foreach(AbstractBackendUpdater* upd, m_updaters) {
maxEta = qMax(maxEta, upd->remainingTime());
}
// Ignore ETA if it's larger than 2 days.
if(maxEta > 2 * 24 * 60 * 60)
return QString();
else if(maxEta==0)
return i18nc("@item:intext Unknown remaining time", "Updating...");
else
return i18nc("@item:intext Remaining time", "%1 remaining", KFormat().formatDuration(maxEta));
}
bool ResourcesUpdatesModel::isProgressing() const
{
return m_transaction && m_transaction->status() < Transaction::DoneStatus;
......
......@@ -37,14 +37,12 @@ class UpdateTransaction;
class DISCOVERCOMMON_EXPORT ResourcesUpdatesModel : public QStandardItemModel
{
Q_OBJECT
Q_PROPERTY(QString remainingTime READ remainingTime NOTIFY etaChanged)
Q_PROPERTY(bool isProgressing READ isProgressing NOTIFY progressingChanged)
Q_PROPERTY(QDateTime lastUpdate READ lastUpdate NOTIFY progressingChanged)
Q_PROPERTY(qint64 secsToLastUpdate READ secsToLastUpdate NOTIFY progressingChanged)
public:
explicit ResourcesUpdatesModel(QObject* parent = nullptr);
QString remainingTime() const;
quint64 downloadSpeed() const;
Q_SCRIPTABLE void prepare();
......@@ -59,7 +57,6 @@ class DISCOVERCOMMON_EXPORT ResourcesUpdatesModel : public QStandardItemModel
Q_SIGNALS:
void downloadSpeedChanged();
void etaChanged();
void progressingChanged();
void finished();
void resourceProgressed(AbstractResource* resource, qreal progress);
......
......@@ -148,11 +148,6 @@ void StandardBackendUpdater::setProgress(qreal p)
}
}
long unsigned int StandardBackendUpdater::remainingTime() const
{
return 0;
}
void StandardBackendUpdater::prepare()
{
m_lastUpdate = QDateTime::currentDateTime();
......
......@@ -38,7 +38,6 @@ class DISCOVERCOMMON_EXPORT StandardBackendUpdater : public AbstractBackendUpdat
bool hasUpdates() const override;
qreal progress() const override;
void start() override;
long unsigned int remainingTime() const override;
QList<AbstractResource*> toUpdate() const override;
void addResources(const QList<AbstractResource*>& apps) override;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment