blob: 849e09e385de08c0f589c3872b5628062e3e51a8 (
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
#ifndef APPINFO_H
#define APPINFO_H
#include <QSharedDataPointer>
#include <QUuid>
#include <QHash>
#include <QImage>
#include <QLoggingCategory>
#include "bankmanager.h"
class AppInfoData;
class AppInfo
{
Q_GADGET
static QLoggingCategory l;
public:
enum Capability {
Location = 1 << 0,
Configurable = 1 << 2
};
Q_DECLARE_FLAGS(Capabilities, Capability)
enum File {
INFO,
BINARY,
RESOURCES,
APPJS
};
Q_PROPERTY(bool local READ isLocal)
Q_PROPERTY(bool valid READ isValid)
Q_PROPERTY(QUuid uuid READ uuid)
Q_PROPERTY(QString shortName READ shortName)
Q_PROPERTY(QString longName READ longName)
Q_PROPERTY(QString companyName READ companyName)
Q_PROPERTY(int versionCode READ versionCode)
Q_PROPERTY(QString versionLabel READ versionLabel)
Q_PROPERTY(bool watchface READ isWatchface)
Q_PROPERTY(bool jskit READ isJSKit)
Q_PROPERTY(Capabilities capabilities READ capabilities)
Q_PROPERTY(bool menuIcon READ hasMenuIcon)
Q_PROPERTY(QImage menuIconImage READ getMenuIconImage)
static AppInfo fromPath(const QString &path);
static AppInfo fromSlot(const BankManager::SlotInfo &slot);
public:
AppInfo();
AppInfo(const AppInfo &);
AppInfo &operator=(const AppInfo &);
~AppInfo();
bool isLocal() const;
bool isValid() const;
QUuid uuid() const;
QString shortName() const;
QString longName() const;
QString companyName() const;
int versionCode() const;
QString versionLabel() const;
bool isWatchface() const;
bool isJSKit() const;
Capabilities capabilities() const;
bool hasMenuIcon() const;
void addAppKey(const QString &key, int value);
bool hasAppKeyValue(int value) const;
QString appKeyForValue(int value) const;
bool hasAppKey(const QString &key) const;
int valueForAppKey(const QString &key) const;
QImage getMenuIconImage() const;
QByteArray getMenuIconPng() const;
QString getJSApp() const;
QIODevice *openFile(enum File, QIODevice::OpenMode = 0) const;
bool fileExists(enum File) const;
void setInvalid();
protected:
QByteArray extractFromResourcePack(QIODevice *dev, int id) const;
QImage decodeResourceImage(const QByteArray &data) const;
private:
QSharedDataPointer<AppInfoData> d;
};
#endif // APPINFO_H
|