blob: e11e121f0f7ccf216f33a42ceaf6d47c82298255 (
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
|
#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 shortcutUpdate(QStringList shortcut_list);
signals:
void updateShortcut();
private:
void init();
void getAppQueue();
void setAppQueuePoint(QString id, QString name);
QString getIconPath(QString id);
class Private;
Private *d;
RegisterApp app;
};
#endif // SHORTCUTAPPMODEL_H
|