Commit 536c46e1 authored by Marko Mattila's avatar Marko Mattila

Merge pull request #9 from nemomobile/cleanup-fix

Monitoring expired transfers.
parents feaccb05 f7740f0a
......@@ -103,7 +103,7 @@ CallbackInterface::~CallbackInterface()
class TransferEngineClientPrivate
{
public:
TransferEngineInterface *m_client;
TransferEngineInterface *m_client;
};
/*!
......@@ -339,3 +339,58 @@ void TransferEngineClient::finishTransfer(int transferId, Status status, const Q
d->m_client->finishTransfer(transferId, static_cast<int>(status), reason);
}
/*!
Private method for QML interface to cancel an ongoing transfer using \a transferId.
*/
void TransferEngineClient::cbCancelTransfer(int transferId)
{
Q_D(TransferEngineClient);
d->m_client->cancelTransfer(transferId);
}
/*!
Private method for QML interface to restart canceled or interrupted transfer using \a transferId.
*/
void TransferEngineClient::cbRestartTransfer(int transferId)
{
Q_D(TransferEngineClient);
d->m_client->restartTransfer(transferId);
}
/*!
Private method for QML interface to clear all canceled or interrupted events.
*/
void TransferEngineClient::clearTransfers()
{
Q_D(TransferEngineClient);
d->m_client->clearTransfers();
}
/*!
Private method for QML interface to enable notifications.
*/
void TransferEngineClient::enableNotifications(bool enable)
{
Q_D(TransferEngineClient);
d->m_client->enableNotifications(enable);
}
/*!
Private method for QML interface.
\returns true if notifications are enabled, otherwise false is returned.
*/
bool TransferEngineClient::notificationsEnabled() const
{
Q_D(const TransferEngineClient);
QDBusPendingReply<bool> reply = d->m_client->notificationsEnabled();
reply.waitForFinished();
if (reply.isError()) {
qWarning() << Q_FUNC_INFO << "failed to get notifications!";
return false;
}
return reply.value();
}
......@@ -81,9 +81,18 @@ public:
void updateTransferProgress(int transferId, qreal progress);
void finishTransfer(int transferId, Status status, const QString &reason = QString());
private:
void cbCancelTransfer(int transferId);
void cbRestartTransfer(int transferId);
void clearTransfers();
void enableNotifications(bool enable);
bool notificationsEnabled() const;
private:
TransferEngineClientPrivate *d_ptr;
Q_DECLARE_PRIVATE(TransferEngineClient)
friend class DeclarativeTransferInterface;
};
#endif // TRANSFERENGINECLIENT_H
Name: nemo-transferengine-qt5
Version: 0.0.17
Version: 0.0.23
Release: 0
Summary: Transfer Engine for uploading media content and tracking transfers.
Group: System Environment/Daemon
......
This diff is collapsed.
......@@ -57,6 +57,31 @@ private:
TransferEngineSignalHandler();
};
class ClientActivityMonitor: public QObject
{
Q_OBJECT
public:
ClientActivityMonitor(QObject *parent = 0);
~ClientActivityMonitor();
void newActivity(int transferId);
void activityFinished(int transferId);
bool activeTransfers() const;
public Q_SLOTS:
void checkActivity();
Q_SIGNALS:
void transfersExpired(QList<int> transferIds);
private:
// Map for transferId, timestamps
QMap<int, quint32> m_activityMap;
QTimer *m_timer;
};
class TransferEnginePrivate: QObject
{
......@@ -91,8 +116,8 @@ public:
public Q_SLOTS:
void exitSafely();
void inProgressTransfersCheck();
void enabledPluginsCheck();
void cleanupExpiredTransfers(const QList<int> &expiredIds);
void pluginDirChanged();
void uploadItemStatusChanged(MediaTransferInterface::TransferStatus status);
void updateProgress(qreal progress);
......@@ -114,7 +139,7 @@ public:
QFileSystemWatcher *m_fileWatcher;
QTimer *m_fileWatcherTimer;
QSettings m_settings;
quint32 m_transfersInProgressCount;
ClientActivityMonitor *m_activityMonitor;
TransferEngine *q_ptr;
Q_DECLARE_PUBLIC(TransferEngine)
};
......
......@@ -11,7 +11,7 @@ equals(QT_MAJOR_VERSION, 4): SUBDIRS -= src
equals(QT_MAJOR_VERSION, 5): include(doc/doc.pri)
OTHER_FILES += \
rpm/transfer-engine.spec \
rpm/*.spec \
nemo-transfer-engine.conf \
doc/src/* \
doc/config/*
......
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