X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=homescreen%2Fsrc%2Fshortcutappmodel.h;fp=homescreen%2Fsrc%2Fshortcutappmodel.h;h=f177a9558a710c2f5186fca82459c336059495c1;hb=7d29d877baafe52cc0e0bbdf7d86deff61073651;hp=0000000000000000000000000000000000000000;hpb=33c89065c315edd838873116bec8723326f43488;p=apps%2Fhomescreen.git diff --git a/homescreen/src/shortcutappmodel.h b/homescreen/src/shortcutappmodel.h new file mode 100644 index 0000000..f177a95 --- /dev/null +++ b/homescreen/src/shortcutappmodel.h @@ -0,0 +1,62 @@ +#ifndef SHORTCUTAPPMODEL_H +#define SHORTCUTAPPMODEL_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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 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; + + void screenUpdated(); + +public slots: + void changeShortcut(QString id, QString name, QString position); + +signals: + void updateShortcut(); + void shortcutUpdated(QString id, struct json_object* object); + +private: + void getAppQueue(); + void setAppQueue(); + bool checkAppFile(); + void setAppQueuePoint(QString id, QString name); + QString getIconPath(QString id); + struct json_object* makeAppListJson(); + + class Private; + Private *d; + RegisterApp app; + +}; + +#endif // SHORTCUTAPPMODEL_H