registerShortcut
[apps/launcher.git] / launcher / src / shortcutappmodel.h
1 #ifndef SHORTCUTAPPMODEL_H
2 #define SHORTCUTAPPMODEL_H
3
4 #include <QtCore/QAbstractListModel>
5 #include <QXmlStreamReader>
6 #include <QXmlStreamWriter>
7 #include <QFile>
8 #include <QProcess>
9 #include <QThread>
10
11 struct RegisterApp {
12     QString id;
13     QString name;
14     QString icon;
15     bool isBlank;
16 };
17
18 class ShortcutAppModel : public QAbstractListModel
19 {
20     Q_OBJECT
21 public:
22     explicit ShortcutAppModel(QObject *parent = nullptr);
23     ~ShortcutAppModel();
24
25     int rowCount(const QModelIndex &parent = QModelIndex()) const override;
26
27     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
28     QHash<int, QByteArray> roleNames() const override;
29
30     Q_INVOKABLE QString getId(int index) const;
31     Q_INVOKABLE QString getName(int index) const;
32     Q_INVOKABLE QString getIcon(int index) const;
33     Q_INVOKABLE bool isBlank(int index) const;
34
35 public slots:
36     void shortcutUpdate(QStringList shortcut_list);
37
38 signals:
39     void updateShortcut();
40
41 private:
42     void init();
43     void getAppQueue();
44     void setAppQueuePoint(QString id, QString name);
45     QString getIconPath(QString id);
46
47     class Private;
48     Private *d;
49     RegisterApp app;
50
51 };
52
53 #endif // SHORTCUTAPPMODEL_H