Content Hub 1.0.0
A session-wide content-exchange service
transfer.h
Go to the documentation of this file.
1/*
2 * Copyright © 2013 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Thomas Voß <thomas.voss@canonical.com>
17 */
18#ifndef COM_LOMIRI_CONTENT_TRANSFER_H_
19#define COM_LOMIRI_CONTENT_TRANSFER_H_
20
23
24#include <QObject>
25#include <QSharedPointer>
26#include <QVector>
27#include <QString>
28
29namespace com
30{
31namespace lomiri
32{
33namespace content
34{
35namespace detail
36{
37class Handler;
38}
39}
40}
41}
42
43namespace com
44{
45namespace lomiri
46{
47namespace content
48{
49class Item;
50
51class Transfer : public QObject
52{
53 Q_OBJECT
54 Q_ENUMS(State)
55 Q_ENUMS(SelectionType)
56 Q_ENUMS(Direction)
57 Q_PROPERTY(int id READ id)
58 Q_PROPERTY(State state READ state NOTIFY stateChanged)
59 Q_PROPERTY(QVector<Item> items READ collect WRITE charge)
60 Q_PROPERTY(Store store READ store NOTIFY storeChanged)
62 Q_PROPERTY(Direction direction READ direction)
63 Q_PROPERTY(QString downloadId READ downloadId WRITE setDownloadId NOTIFY downloadIdChanged)
64 Q_PROPERTY(QString contentType READ contentType)
65 Q_PROPERTY(QString source READ source)
66 Q_PROPERTY(QString destination READ destination)
67
68 public:
69 enum State
70 {
80 };
81
83 {
86 };
87
89 {
92 Share
93 };
94
95 Transfer(const Transfer&) = delete;
96 virtual ~Transfer();
97
98 Transfer& operator=(const Transfer&) = delete;
99
100 Q_INVOKABLE virtual int id() const;
101 Q_INVOKABLE virtual State state() const;
102 Q_INVOKABLE virtual SelectionType selectionType() const;
103 Q_INVOKABLE virtual Direction direction() const;
104 Q_INVOKABLE virtual bool start();
105 Q_INVOKABLE virtual bool abort();
106 Q_INVOKABLE virtual bool finalize();
107 Q_INVOKABLE virtual bool charge(const QVector<Item>& items);
108 Q_INVOKABLE virtual QVector<Item> collect();
109 Q_INVOKABLE virtual Store store() const;
110 Q_INVOKABLE virtual bool setStore(const Store*);
111 Q_INVOKABLE virtual bool setSelectionType(const SelectionType&);
112 Q_INVOKABLE virtual QString downloadId() const;
113 Q_INVOKABLE virtual bool setDownloadId(const QString);
114 Q_INVOKABLE virtual bool download();
115 Q_INVOKABLE virtual QString contentType() const;
116 Q_INVOKABLE virtual QString source() const;
117 Q_INVOKABLE virtual QString destination() const;
118
119 Q_SIGNAL void stateChanged();
120 Q_SIGNAL void storeChanged();
121 Q_SIGNAL void selectionTypeChanged();
122 Q_SIGNAL void downloadIdChanged();
123
124 private:
125 struct Private;
126 friend struct Private;
127 friend class Hub;
129 QSharedPointer<Private> d;
130
131 Transfer(const QSharedPointer<Private>&, QObject* parent = nullptr);
132};
133}
134}
135}
136
137#endif // COM_LOMIRI_CONTENT_TRANSFER_H_
virtual Q_INVOKABLE bool download()
SelectionType selectionType
Definition: transfer.h:61
virtual Q_INVOKABLE int id() const
virtual Q_INVOKABLE QVector< Item > collect()
virtual Q_INVOKABLE bool finalize()
virtual Q_INVOKABLE QString source() const
virtual Q_INVOKABLE QString downloadId() const
virtual Q_INVOKABLE State state() const
virtual Q_INVOKABLE Store store() const
virtual Q_INVOKABLE bool setStore(const Store *)
virtual Q_INVOKABLE bool charge(const QVector< Item > &items)
virtual Q_INVOKABLE QString contentType() const
Q_SIGNAL void selectionTypeChanged()
virtual Q_INVOKABLE SelectionType selectionType() const
Transfer & operator=(const Transfer &)=delete
Q_SIGNAL void downloadIdChanged()
friend class com::lomiri::content::detail::Handler
Definition: transfer.h:128
Transfer(const Transfer &)=delete
virtual Q_INVOKABLE QString destination() const
virtual Q_INVOKABLE bool abort()
virtual Q_INVOKABLE bool setDownloadId(const QString)
virtual Q_INVOKABLE bool start()
virtual Q_INVOKABLE Direction direction() const
virtual Q_INVOKABLE bool setSelectionType(const SelectionType &)
Definition: hub.h:32