Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
transfer-engine
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mer-core
transfer-engine
Commits
536c46e1
Commit
536c46e1
authored
Jul 01, 2013
by
Marko Mattila
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9 from nemomobile/cleanup-fix
Monitoring expired transfers.
parents
feaccb05
f7740f0a
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
202 additions
and
40 deletions
+202
-40
lib/transferengineclient.cpp
lib/transferengineclient.cpp
+56
-1
lib/transferengineclient.h
lib/transferengineclient.h
+9
-0
rpm/transfer-engine-qt5.spec
rpm/transfer-engine-qt5.spec
+1
-1
src/transferengine.cpp
src/transferengine.cpp
+108
-35
src/transferengine_p.h
src/transferengine_p.h
+27
-2
transfer-engine.pro
transfer-engine.pro
+1
-1
No files found.
lib/transferengineclient.cpp
View file @
536c46e1
...
...
@@ -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
();
}
lib/transferengineclient.h
View file @
536c46e1
...
...
@@ -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
rpm/transfer-engine-qt5.spec
View file @
536c46e1
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
...
...
src/transferengine.cpp
View file @
536c46e1
This diff is collapsed.
Click to expand it.
src/transferengine_p.h
View file @
536c46e1
...
...
@@ -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
)
};
...
...
transfer-engine.pro
View file @
536c46e1
...
...
@@ -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
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment