aboutsummaryrefslogtreecommitdiffstats
path: root/launcher/src/applicationmodel.h
blob: c2693b2785875971afbb91d57576e21d80ec1401 (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
// SPDX-License-Identifier: Apache-2.0
/*
 * Copyright (C) 2016 The Qt Company Ltd.
 * Copyright (c) 2018,2019 TOYOTA MOTOR CORPORATION
 * Copyright (C) 2022 Konsulko Group
 */

#ifndef APPLICATIONMODEL_H
#define APPLICATIONMODEL_H

#include <QAbstractListModel>

class ApplicationModel : public QAbstractListModel
{
    Q_OBJECT

public:
    explicit ApplicationModel(QObject *parent = nullptr);
    ~ApplicationModel();

    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 appid(int index) const;
    Q_INVOKABLE QString id(int index) const;
    Q_INVOKABLE QString name(int index) const;
    Q_INVOKABLE void move(int from, int to);
    Q_INVOKABLE void initAppList(QList<QMap<QString, QString>> &apps);
    Q_INVOKABLE void updateApplist(QStringList info);

private:
    class Private;
    Private *d;
};

#endif // APPLICATIONMODEL_H