Skip to content

Latest commit

 

History

History
148 lines (124 loc) · 4.29 KB

transferengine_p.h

File metadata and controls

148 lines (124 loc) · 4.29 KB
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/****************************************************************************************
**
** Copyright (C) 2013 Jolla Ltd.
** Contact: Marko Mattila <marko.mattila@jollamobile.com>
** All rights reserved.
**
** This file is part of Nemo Transfer Engine package.
**
** You may use this file under the terms of the GNU Lesser General
** Public License version 2.1 as published by the Free Software Foundation
** and appearing in the file license.lgpl included in the packaging
** of this file.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file license.lgpl included in the packaging
** of this file.
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
****************************************************************************************/
#ifndef TRANSFERENGINE_P_H
#define TRANSFERENGINE_P_H
#include <QObject>
#include <QMap>
#include <QSettings>
#include <MRemoteAction>
#include "mediatransferinterface.h"
#include "transfermethodinfo.h"
#include <Accounts/Manager>
class QFileSystemWatcher;
class QTimer;
class QUrl;
class TransferEngine;
class TransferPluginInfo;
class TransferEngineSignalHandler: public QObject
{
Q_OBJECT
public:
static TransferEngineSignalHandler * instance();
static void signalHandler(int signal);
Q_SIGNALS:
void exitSafely();
private:
TransferEngineSignalHandler();
};
Jul 1, 2013
Jul 1, 2013
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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;
};
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
class TransferEnginePrivate: QObject
{
Q_OBJECT
public:
// CallbackElement enum is used as an accessor to DBus callback
// information from a list. Enums are used as an indeces.
enum CallbackElements {
Service = 0,
Path,
Interface
};
// CallbackMethodType enum is used as an accessor to the list where
// method names starts from the index 3.
enum CallbackMethodType {
CancelCallback = 3,
RestartCallback = 4
};
TransferEnginePrivate(TransferEngine *parent);
void recoveryCheck();
void sendNotification(TransferEngineData::TransferType type,
TransferEngineData::TransferStatus status,
Oct 2, 2013
Oct 2, 2013
109
const QString &fileName);
110
111
112
113
114
115
116
117
118
119
int uploadMediaItem(MediaItem *mediaItem,
MediaTransferInterface *muif,
const QVariantMap &userData);
inline TransferEngineData::TransferType transferType(int transferId);
void callbackCall(int transferId, CallbackMethodType method);
MRemoteAction createRemoteActionForGroup();
public Q_SLOTS:
void exitSafely();
void enabledPluginsCheck();
Jul 1, 2013
Jul 1, 2013
120
void cleanupExpiredTransfers(const QList<int> &expiredIds);
121
122
123
124
125
126
127
128
129
130
void pluginDirChanged();
void uploadItemStatusChanged(MediaTransferInterface::TransferStatus status);
void updateProgress(qreal progress);
void pluginInfoReady();
void pluginInfoError(const QString &msg);
public:
QStringList pluginList() const;
QList <TransferMethodInfo> enabledPlugins() const;
MediaTransferInterface *loadPlugin(const QString &pluginId) const;
Oct 2, 2013
Oct 2, 2013
131
QString mediaFileOrResourceName(MediaItem *mediaItem) const;
132
133
134
135
136
137
138
139
140
141
QMap <MediaTransferInterface*, int> m_plugins;
QMap <int, TransferEngineData::TransferType> m_keyTypeCache;
bool m_notificationsEnabled;
QList <TransferPluginInfo*> m_infoObjects;
QList <TransferMethodInfo> m_enabledPlugins;
Accounts::Manager *m_accountManager;
QFileSystemWatcher *m_fileWatcher;
QTimer *m_fileWatcherTimer;
QSettings m_settings;
Jul 1, 2013
Jul 1, 2013
142
ClientActivityMonitor *m_activityMonitor;
143
144
145
146
147
TransferEngine *q_ptr;
Q_DECLARE_PUBLIC(TransferEngine)
};
#endif