blob: 5a31d60b49fcff3141440f3bef379e5957d95ff4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#ifndef APPSTORECLIENT_H
#define APPSTORECLIENT_H
#include <QObject>
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
|