-
Notifications
You must be signed in to change notification settings - Fork 0
/
gpudevicelist.h
71 lines (56 loc) · 2.74 KB
/
gpudevicelist.h
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/****************************************************************************}
{ gpudevicelist.h - GPU device list }
{ }
{ Copyright (c) 2018 Alexey Parfenov <zxed@alkatrazstudio.net> }
{ }
{ This file is part of GPU Fan Meister. }
{ }
{ GPU Fan Meister is free software: you can redistribute it and/or modify it }
{ under the terms of the GNU General Public License as published by }
{ the Free Software Foundation, either version 3 of the License, }
{ or (at your option) any later version. }
{ }
{ GPU Fan Meister is distributed in the hope that it will be useful, }
{ but WITHOUT ANY WARRANTY; without even the implied warranty of }
{ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU }
{ General Public License for more details: https://gnu.org/licenses/gpl.html }
{****************************************************************************/
#pragma once
#include "gpudevice.h"
#include <QtQml/qqml.h>
class GpuDeviceList : public QObject {
Q_OBJECT
public:
enum class Err {
timer = 1
};
Q_ENUM(Err)
explicit GpuDeviceList(QObject* parent = nullptr);
explicit GpuDeviceList(const QStringList& plugins, QObject* parent = nullptr);
~GpuDeviceList();
Q_PROPERTY(QList<QObject*> devices READ qmlList NOTIFY onListChanged)
signals: void onListChanged();
SIMPLE_QML_PROP(unsigned int, trayUpdateSecs)
signals: void on_trayUpdateSecs_changed();
public:
const QList<GpuDevice*>* devices() const {return &devices_;}
Q_INVOKABLE void saveDeviceModeSettings() const;
Q_INVOKABLE void loadDeviceModeSettings();
Q_INVOKABLE void loadSettings();
Q_INVOKABLE void saveSettings();
static void registerInQml() {
qmlRegisterUncreatableType<GpuDeviceList>("net.alkatrazstudio.gpufanmeister", 1, 0, "GpuDeviceList", "");
}
protected:
const QList<QObject*>& qmlList() { // QML only supports QList<QObject*>
return *reinterpret_cast<const QList<QObject*>*>(&devices_);}
QList<GpuDevice*> devices_;
int timerId_ {};
void timerEvent(QTimerEvent* event) override;
static QString errorCodeToString(Err errorCode);
signals:
void onQuitClick();
void onShowAppClick(GpuDevice* dev);
void onShowDevOptionsClick(GpuDevice* dev);
void onShowManualClick(const QString& uri, GpuDevice* dev);
};