Skip to content

Latest commit

 

History

History
151 lines (129 loc) · 4.39 KB

transferengine_p.h

File metadata and controls

151 lines (129 loc) · 4.39 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
/****************************************************************************************
**
** 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>
Jan 17, 2018
Jan 17, 2018
32
#include <QVariantList>
33
34
35
36
#include "mediatransferinterface.h"
#include "transfermethodinfo.h"
Nov 22, 2013
Nov 22, 2013
37
38
39
namespace Accounts {
class Manager;
}
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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
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
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,
Jan 17, 2018
Jan 17, 2018
108
109
110
qreal progress,
const QString &fileName,
int transferId);
111
112
113
114
115
116
117
118
int uploadMediaItem(MediaItem *mediaItem,
MediaTransferInterface *muif,
const QVariantMap &userData);
inline TransferEngineData::TransferType transferType(int transferId);
void callbackCall(int transferId, CallbackMethodType method);
public Q_SLOTS:
void exitSafely();
Feb 21, 2014
Feb 21, 2014
119
void delayedExitSafely();
120
void enabledPluginsCheck();
Jul 1, 2013
Jul 1, 2013
121
void cleanupExpiredTransfers(const QList<int> &expiredIds);
122
123
124
125
126
127
128
129
130
131
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
132
QString mediaFileOrResourceName(MediaItem *mediaItem) const;
Sep 30, 2014
Sep 30, 2014
134
private:
135
136
137
138
139
140
141
142
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;
Sep 30, 2014
Sep 30, 2014
143
QTimer *m_delayedExitTimer;
Jul 1, 2013
Jul 1, 2013
144
ClientActivityMonitor *m_activityMonitor;
145
TransferEngine *q_ptr;
Jan 17, 2018
Jan 17, 2018
146
QVariantList m_defaultActions;
147
148
149
150
Q_DECLARE_PUBLIC(TransferEngine)
};
#endif