Content Hub  0.0.1
A session-wide content-exchange service
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Friends
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_ENUMS(Direction)
56  Q_PROPERTY(int id READ id)
57  Q_PROPERTY(State state READ state NOTIFY stateChanged)
58  Q_PROPERTY(QVector<Item> items READ collect WRITE charge)
59  Q_PROPERTY(Store store READ store NOTIFY storeChanged)
61  Q_PROPERTY(Direction direction READ direction)
62 
63  public:
64  enum State
65  {
73  };
74 
76  {
79  };
80 
81  enum Direction
82  {
86  };
87 
88  Transfer(const Transfer&) = delete;
89  virtual ~Transfer();
90 
91  Transfer& operator=(const Transfer&) = delete;
92 
93  Q_INVOKABLE virtual int id() const;
94  Q_INVOKABLE virtual State state() const;
95  Q_INVOKABLE virtual SelectionType selectionType() const;
96  Q_INVOKABLE virtual Direction direction() const;
97  Q_INVOKABLE virtual bool start();
98  Q_INVOKABLE virtual bool abort();
99  Q_INVOKABLE virtual bool finalize();
100  Q_INVOKABLE virtual bool charge(const QVector<Item>& items);
101  Q_INVOKABLE virtual QVector<Item> collect();
102  Q_INVOKABLE virtual Store store() const;
103  Q_INVOKABLE virtual bool setStore(const Store*);
104  Q_INVOKABLE virtual bool setSelectionType(const SelectionType&);
105 
106  Q_SIGNAL void stateChanged();
107  Q_SIGNAL void storeChanged();
108  Q_SIGNAL void selectionTypeChanged();
109 
110  private:
111  struct Private;
112  friend struct Private;
113  friend class Hub;
115  QSharedPointer<Private> d;
116 
117  Transfer(const QSharedPointer<Private>&, QObject* parent = nullptr);
118 };
119 }
120 }
121 }
122 
123 #endif // COM_UBUNTU_CONTENT_TRANSFER_H_
virtual Q_INVOKABLE bool setSelectionType(const SelectionType &)
Q_SIGNAL void selectionTypeChanged()
virtual Q_INVOKABLE State state() const
virtual Q_INVOKABLE bool charge(const QVector< Item > &items)
virtual Q_INVOKABLE bool start()
Transfer(const Transfer &)=delete
virtual Q_INVOKABLE bool abort()
friend class com::ubuntu::content::detail::Handler
Definition: transfer.h:114
virtual Q_INVOKABLE Direction direction() const
virtual Q_INVOKABLE QVector< Item > collect()
virtual Q_INVOKABLE Store store() const
virtual Q_INVOKABLE SelectionType selectionType() const
virtual Q_INVOKABLE bool setStore(const Store *)
virtual Q_INVOKABLE bool finalize()
virtual Q_INVOKABLE int id() const
Transfer & operator=(const Transfer &)=delete