summaryrefslogtreecommitdiff
path: root/daemon/appmanager.h
blob: dc2a979bc23e164e78860076b1e72cce2ccb2bb3 (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
#ifndef APPMANAGER_H
#define APPMANAGER_H

#include <QObject>
#include <QHash>
#include <QUuid>
#include <QFileSystemWatcher>
#include <Log4Qt/Logger>

class AppManager : public QObject
{
    Q_OBJECT
    LOG4QT_DECLARE_QCLASS_LOGGER

public:
    explicit AppManager(QObject *parent = 0);

    struct AppInfo {
        QUuid uuid;
        QString shortName;
        QString longName;
        QString company;
        int versionCode;
        QString versionLabel;
        bool isWatchface;
        bool isJSKit;
        QHash<QString, int> appKeys;
        QString path;
    };

    QStringList appPaths() const;

    const AppInfo & info(const QUuid &uuid) const;
    const AppInfo & info(const QString &shortName) const;

public slots:
    void rescan();

private:
    void scanApp(const QString &path);

private:
    QFileSystemWatcher *_watcher;
    QHash<QUuid, AppInfo> _apps;
    QHash<QString, QUuid> _names;
};

#endif // APPMANAGER_H