Content Hub  0.0.1
A session-wide content-exchange service
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Friends Pages
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_UBUNTU_CONTENT_TRANSFER_H_
19 #define COM_UBUNTU_CONTENT_TRANSFER_H_
20 
23 
24 #include <QObject>
25 #include <QSharedPointer>
26 #include <QVector>
27 
28 namespace com
29 {
30 namespace ubuntu
31 {
32 namespace content
33 {
34 namespace detail
35 {
36 class Handler;
37 }
38 }
39 }
40 }
41 
42 namespace com
43 {
44 namespace ubuntu
45 {
46 namespace content
47 {
48 class Item;
49 
50 class Transfer : public QObject
51 {
52  Q_OBJECT
53  Q_ENUMS(State)
54  Q_ENUMS(SelectionType)
55  Q_PROPERTY(int id READ id)
56  Q_PROPERTY(State state READ state NOTIFY stateChanged)
57  Q_PROPERTY(QVector<Item> items READ collect WRITE charge)
58  Q_PROPERTY(Store store READ store NOTIFY storeChanged)
60 
61  public:
62  enum State
63  {
71  };
72 
74  {
77  };
78 
79  Transfer(const Transfer&) = delete;
80  virtual ~Transfer();
81 
82  Transfer& operator=(const Transfer&) = delete;
83 
84  Q_INVOKABLE virtual int id() const;
85  Q_INVOKABLE virtual State state() const;
86  Q_INVOKABLE virtual SelectionType selectionType() const;
87  Q_INVOKABLE virtual bool start();
88  Q_INVOKABLE virtual bool abort();
89  Q_INVOKABLE virtual bool finalize();
90  Q_INVOKABLE virtual bool charge(const QVector<Item>& items);
91  Q_INVOKABLE virtual QVector<Item> collect();
92  Q_INVOKABLE virtual Store store() const;
93  Q_INVOKABLE virtual bool setStore(const Store*);
94  Q_INVOKABLE virtual bool setSelectionType(const SelectionType&);
95 
96  Q_SIGNAL void stateChanged();
97  Q_SIGNAL void storeChanged();
98  Q_SIGNAL void selectionTypeChanged();
99 
100  private:
101  struct Private;
102  friend struct Private;
103  friend class Hub;
105  QSharedPointer<Private> d;
106 
107  Transfer(const QSharedPointer<Private>&, QObject* parent = nullptr);
108 };
109 }
110 }
111 }
112 
113 #endif // COM_UBUNTU_CONTENT_TRANSFER_H_