Content Hub  0.2.0
A session-wide content-exchange service
peer.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_PEER_H_
19 #define COM_UBUNTU_CONTENT_PEER_H_
20 
21 #include <QtDBus>
22 #include <QObject>
23 #include <QSharedPointer>
24 
25 namespace com
26 {
27 namespace ubuntu
28 {
29 namespace content
30 {
31 class Peer : public QObject
32 {
33  Q_OBJECT
34  Q_PROPERTY(QString id READ id)
35  Q_PROPERTY(QString name READ name WRITE setName)
36  Q_PROPERTY(QString iconName READ iconName WRITE setIconName)
37  Q_PROPERTY(bool isDefaultPeer READ isDefaultPeer)
38  Q_PROPERTY(bool legacy READ legacy)
39 
40  public:
41  static const Peer& unknown();
42  Peer(const QString& id = QString(), bool isDefaultPeer = false, bool legacy = false, QObject* parent = nullptr);
43  Peer(const QString&, const QString&, QByteArray&, const QString&, bool, bool, QObject* parent = nullptr);
44  Peer(const Peer& rhs);
45  virtual ~Peer();
46 
47  Peer& operator=(const Peer& rhs);
48  bool operator==(const Peer& rhs) const;
49 
50  Q_INVOKABLE virtual const QString& id() const;
51  Q_INVOKABLE virtual QString name() const;
52  Q_INVOKABLE void setName(const QString&);
53  Q_INVOKABLE virtual QByteArray iconData() const;
54  Q_INVOKABLE void setIconData(const QByteArray&);
55  Q_INVOKABLE virtual QString iconName() const;
56  Q_INVOKABLE void setIconName(const QString&);
57  Q_INVOKABLE virtual bool isDefaultPeer() const;
58  Q_INVOKABLE virtual bool legacy() const;
59 
60  private:
61  struct Private;
62  QSharedPointer<Private> d;
63 };
64 }
65 }
66 }
67 
68 Q_DECL_EXPORT
69 QDBusArgument &operator<<(QDBusArgument &argument,
70  const com::ubuntu::content::Peer &peer);
71 
72 Q_DECL_EXPORT
73 const QDBusArgument &operator>>(const QDBusArgument &argument,
74  com::ubuntu::content::Peer &peer);
75 
76 Q_DECLARE_METATYPE(com::ubuntu::content::Peer)
77 
78 #endif // COM_UBUNTU_CONTENT_PEER_H_
Q_INVOKABLE void setName(const QString &)
virtual Q_INVOKABLE QString name() const
Definition: hub.h:31
virtual Q_INVOKABLE bool isDefaultPeer() const
Q_INVOKABLE void setIconName(const QString &)
virtual Q_INVOKABLE bool legacy() const
Q_INVOKABLE void setIconData(const QByteArray &)
virtual Q_INVOKABLE QString iconName() const
virtual Q_INVOKABLE QByteArray iconData() const
static const Peer & unknown()