Lomiri Content Hub 1.0.0
A session-wide content-exchange service
 
Loading...
Searching...
No Matches
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
25
26#include <QObject>
27#include <QSharedPointer>
28#include <QVector>
29#include <QString>
30
31namespace com
32{
33namespace lomiri
34{
35namespace content
36{
37namespace detail
38{
39class Handler;
40}
41}
42}
43}
44
45namespace com
46{
47namespace lomiri
48{
49namespace content
50{
51class Item;
52
53class Transfer : public QObject
54{
55 Q_OBJECT
56 Q_ENUMS(State)
57 Q_ENUMS(SelectionType)
58 Q_ENUMS(Direction)
59 Q_PROPERTY(int id READ id)
60 Q_PROPERTY(State state READ state NOTIFY stateChanged)
61 Q_PROPERTY(QVector<Item> items READ collect WRITE charge)
62 Q_PROPERTY(Store store READ store NOTIFY storeChanged)
64 Q_PROPERTY(Direction direction READ direction)
65 Q_PROPERTY(QString downloadId READ downloadId WRITE setDownloadId NOTIFY downloadIdChanged)
66 Q_PROPERTY(QString contentType READ contentType)
67 Q_PROPERTY(QString source READ source)
68 Q_PROPERTY(QString destination READ destination)
69
70 public:
83
89
96
97 Transfer(const Transfer&) = delete;
98 virtual ~Transfer();
99
100 Transfer& operator=(const Transfer&) = delete;
101
102 Q_INVOKABLE virtual int id() const;
103 Q_INVOKABLE virtual State state() const;
104 Q_INVOKABLE virtual SelectionType selectionType() const;
105 Q_INVOKABLE virtual Direction direction() const;
106 Q_INVOKABLE virtual bool start();
107 Q_INVOKABLE virtual bool abort();
108 Q_INVOKABLE virtual bool finalize();
109 Q_INVOKABLE virtual bool charge(const QVector<Item>& items);
110 Q_INVOKABLE virtual QVector<Item> collect();
111 Q_INVOKABLE virtual Store store() const;
112 Q_DECL_DEPRECATED_X("Set store by scope and content type instead")
113 Q_INVOKABLE virtual bool setStore(const Store*);
114 Q_INVOKABLE virtual QString setStore(Scope, const QString&);
115 Q_INVOKABLE virtual bool setSelectionType(const SelectionType&);
116 Q_INVOKABLE virtual QString downloadId() const;
117 Q_INVOKABLE virtual bool setDownloadId(const QString);
118 Q_INVOKABLE virtual bool download();
119 Q_INVOKABLE virtual QString contentType() const;
120 Q_INVOKABLE virtual QString source() const;
121 Q_INVOKABLE virtual QString destination() const;
122
123 Q_SIGNAL void stateChanged();
124 Q_SIGNAL void storeChanged();
125 Q_SIGNAL void selectionTypeChanged();
126 Q_SIGNAL void downloadIdChanged();
127
128 private:
129 struct Private;
130 friend struct Private;
131 friend class Hub;
132 friend class com::lomiri::content::detail::Handler;
133 QSharedPointer<Private> d;
134
135 Transfer(const QSharedPointer<Private>&, QObject* parent = nullptr);
136};
137}
138}
139}
140
141#endif // COM_LOMIRI_CONTENT_TRANSFER_H_
virtual Q_INVOKABLE bool download()
virtual Q_INVOKABLE int id() const
virtual Q_INVOKABLE QVector< Item > collect()
virtual Q_INVOKABLE bool finalize()
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)
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:132
Transfer(const Transfer &)=delete
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