From 29aaea2d80a9eb1715b6cddfac2d2aacf76358bd Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Thu, 11 Feb 2016 23:55:16 +0100 Subject: launchpad ~mzanetti/rockwork/trunk r87 --- rockwork/appstoreclient.h | 62 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 rockwork/appstoreclient.h (limited to 'rockwork/appstoreclient.h') diff --git a/rockwork/appstoreclient.h b/rockwork/appstoreclient.h new file mode 100644 index 0000000..5a31d60 --- /dev/null +++ b/rockwork/appstoreclient.h @@ -0,0 +1,62 @@ +#ifndef APPSTORECLIENT_H +#define APPSTORECLIENT_H + +#include + +class QNetworkAccessManager; +class ApplicationsModel; +class AppItem; + +class AppStoreClient : public QObject +{ + Q_OBJECT + Q_ENUMS(Type) + Q_PROPERTY(ApplicationsModel* model READ model CONSTANT) + Q_PROPERTY(int limit READ limit WRITE setLimit NOTIFY limitChanged) + Q_PROPERTY(QString hardwarePlatform READ hardwarePlatform WRITE setHardwarePlatform NOTIFY hardwarePlatformChanged) + Q_PROPERTY(bool busy READ busy NOTIFY busyChanged) + +public: + enum Type { + TypeWatchapp, + TypeWatchface + }; + + explicit AppStoreClient(QObject *parent = 0); + + ApplicationsModel *model() const; + + int limit() const; + void setLimit(int limit); + + QString hardwarePlatform() const; + void setHardwarePlatform(const QString &hardwarePlatform); + + bool busy() const; + +signals: + void limitChanged(); + void hardwarePlatformChanged(); + void busyChanged(); + +public slots: + void fetchHome(Type type); + void fetchLink(const QString &link); + + void fetchAppDetails(const QString &appId); + + void search(const QString &searchString, Type type); + +private: + AppItem *parseAppItem(const QVariantMap &map); + void setBusy(bool busy); + +private: + QNetworkAccessManager *m_nam; + ApplicationsModel *m_model; + int m_limit = 20; + QString m_hardwarePlatform; + bool m_busy = false; +}; + +#endif // APPSTORECLIENT_H -- cgit v1.2.3