diff options
author | 2016-11-30 13:34:30 +0900 | |
---|---|---|
committer | 2016-11-30 15:18:03 +0900 | |
commit | 4ccab203994f2472641c429bb4b86535c5128884 (patch) | |
tree | 131e27f500bbeb7e8181f2e3756c6116dfdb0288 /interfaces/include/appframework.hpp | |
parent | 75a4e94d7610db25c98f05cdda9491f4e7c0a4db (diff) |
improve AppInfo class
hide public member variables and introduce getters and setters for them.
Change-Id: I9108e94516238ef2ff8d4ea18db381d4e7e73bec
Signed-off-by: Tasuku Suzuki <tasuku.suzuki@qt.io>
Diffstat (limited to 'interfaces/include/appframework.hpp')
-rw-r--r-- | interfaces/include/appframework.hpp | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/interfaces/include/appframework.hpp b/interfaces/include/appframework.hpp index d4abefb..29c9b2b 100644 --- a/interfaces/include/appframework.hpp +++ b/interfaces/include/appframework.hpp @@ -17,31 +17,49 @@ #ifndef APPFRAMEWORK_HPP #define APPFRAMEWORK_HPP -#include <QtDBus> +#include <QtCore/QSharedDataPointer> +#include <QtDBus/QDBusArgument> class AppInfo { + Q_GADGET + Q_PROPERTY(QString id READ id) + Q_PROPERTY(QString version READ version) + Q_PROPERTY(int width READ width) + Q_PROPERTY(int height READ height) + Q_PROPERTY(QString name READ name) + Q_PROPERTY(QString description READ description) + Q_PROPERTY(QString shortname READ shortname) + Q_PROPERTY(QString author READ author) + Q_PROPERTY(QString iconPath READ iconPath) public: AppInfo(); + AppInfo(const AppInfo &other); virtual ~AppInfo(); + AppInfo &operator =(const AppInfo &other); + void swap(AppInfo &other) { qSwap(d, other.d); } - QString id; - QString version; - int width; - int height; - QString name; - QString description; - QString shortname; - QString author; - QString iconPath; + QString id() const; + QString version() const; + int width() const; + int height() const; + QString name() const; + QString description() const; + QString shortname() const; + QString author() const; + QString iconPath() const; void read(const QJsonObject &json); - friend QDBusArgument &operator <<(QDBusArgument &argument, const AppInfo &mAppInfo); - friend const QDBusArgument &operator >>(const QDBusArgument &argument, AppInfo &mAppInfo); -}; + friend QDBusArgument &operator <<(QDBusArgument &argument, const AppInfo &appInfo); + friend const QDBusArgument &operator >>(const QDBusArgument &argument, AppInfo &appInfo); +private: + class Private; + QSharedDataPointer<Private> d; +}; +Q_DECLARE_SHARED(AppInfo) Q_DECLARE_METATYPE(AppInfo) Q_DECLARE_METATYPE(QList<AppInfo>) |