summaryrefslogtreecommitdiffstats
path: root/src/shared-lib/gpustatus.h
blob: 5e0d94e111d52fb6313634f3ddd96d9063b9e367 (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
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2019 Luxoft Sweden AB
// Copyright (C) 2018 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#ifndef GPUSTATUS_H
#define GPUSTATUS_H

#include <memory>

#include <QtCore/QObject>

#include <QtAppManShared/qtappmansharedglobal.h>
#include <QtAppManShared/systemreader.h>

QT_BEGIN_NAMESPACE_AM

class Q_APPMANSHARED_EXPORT GpuStatus : public QObject
{
    Q_OBJECT
    Q_PROPERTY(qreal gpuLoad READ gpuLoad NOTIFY gpuLoadChanged FINAL)

    Q_PROPERTY(QStringList roleNames READ roleNames CONSTANT FINAL)

public:
    GpuStatus(QObject *parent = nullptr);
    ~GpuStatus() override;

    qreal gpuLoad() const;

    QStringList roleNames() const;

    Q_INVOKABLE void update();

Q_SIGNALS:
    void gpuLoadChanged();

private:
    std::unique_ptr<GpuReader> m_gpuReader;
    qreal m_gpuLoad;
};

QT_END_NAMESPACE_AM

#endif // GPUSTATUS_H