~mzanetti/+junk/ubtd

« back to all changes in this revision

Viewing changes to shareplugin/bttransfer.h

  • Committer: Michael Zanetti
  • Date: 2016-04-14 23:34:10 UTC
  • Revision ID: michael.zanetti@canonical.com-20160414233410-17jg7ez3w1qc5e16
make it work, polish a bit, 0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
#include <QBluetoothAddress>
6
6
#include <QBluetoothTransferReply>
7
7
#include <QBluetoothTransferManager>
8
 
#include <QDBusInterface>
9
8
 
10
9
class BtTransfer : public QObject
11
10
{
12
11
    Q_OBJECT
13
12
    Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
 
13
    Q_PROPERTY(bool finished READ finished NOTIFY finishedChanged)
 
14
    Q_PROPERTY(bool error READ error NOTIFY errorChanged)
14
15
 
15
16
public:
16
17
    explicit BtTransfer(QObject *parent = 0);
17
18
 
18
19
    qreal progress() const;
 
20
    bool finished() const;
 
21
    bool error() const;
 
22
    QString errorMessage() const;
19
23
 
20
24
signals:
21
25
    void progressChanged();
 
26
    void finishedChanged();
 
27
    void errorChanged();
22
28
 
23
29
public slots:
24
30
    void sendFile(const QString &btAddress, const QString &fileName);
25
31
 
26
32
private slots:
27
33
    void updateProgress(qint64 transferred, qint64 total);
 
34
    void transferFinished(QBluetoothTransferReply *reply);
 
35
    void transferError(QBluetoothTransferReply::TransferError lastError);
28
36
 
29
37
private:
30
 
    QDBusConnection m_dbus;
31
 
    QDBusInterface m_manager;
32
 
 
33
38
    QBluetoothTransferManager manager;
34
39
    QBluetoothTransferReply *reply;
35
40
    float m_progress;
 
41
    bool m_finished;
 
42
    QBluetoothTransferReply::TransferError m_error;
36
43
};
37
44
 
38
45
#endif // BTTRANSFER_H