aboutsummaryrefslogtreecommitdiffstats
path: root/launcher/src/shortcutappmodel.h
blob: 3a2c3131c180b9fcad3bec99862ff8b129d2d22e (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
#ifndef SHORTCUTAPPMODEL_H
#define SHORTCUTAPPMODEL_H

#include <QtCore/QAbstractListModel>
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
#include <QFile>
#include <QProcess>
#include <QThread>

struct RegisterApp {
    QString id;
    QString name;
    QString icon;
    bool isBlank;
};

class ShortcutAppModel : public QAbstractListModel
{
    Q_OBJECT
public:
    explicit ShortcutAppModel(QObject *parent = nullptr);
    ~ShortcutAppModel();

    int rowCount(const QModelIndex &parent = QModelIndex()) const override;

    QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
    QHash<int, QByteArray> roleNames() const override;

    Q_INVOKABLE QString getId(int index) const;
    Q_INVOKABLE QString getName(int index) const;
    Q_INVOKABLE QString getIcon(int index) const;
    Q_INVOKABLE bool isBlank(int index) const;

public slots:
    void changeShortcut(QString id, QString name, QString position);

signals:
    void updateShortcut();

private:
    void getAppQueue();
//    bool confirmIconImage(QString id);
    QString getIconPath(QString id);

    class Private;
    Private *d;
    RegisterApp app;

};

#endif // SHORTCUTAPPMODEL_H