feat: 初始化项目骨架
- 创建插件元数据 package/metadata.json - 实现主插件类 GraphicsDriverApplet (D-Bus通信) - 实现GPU指示器类 GpuIndicator (设备信息解析) - 创建QML界面 driverview.qml (驱动管理UI) - 添加CMake构建配置 - 编写开发指南文档 docs/DEVELOPMENT.md
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
|
||||
class GpuIndicator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QString vendor READ vendor NOTIFY infoChanged)
|
||||
Q_PROPERTY(QString model READ model NOTIFY infoChanged)
|
||||
Q_PROPERTY(QString driverVersion READ driverVersion NOTIFY infoChanged)
|
||||
Q_PROPERTY(QString driverStatus READ driverStatus NOTIFY infoChanged)
|
||||
Q_PROPERTY(QString icon READ icon NOTIFY infoChanged)
|
||||
Q_PROPERTY(bool isNvidia READ isNvidia NOTIFY infoChanged)
|
||||
Q_PROPERTY(bool isAmd READ isAmd NOTIFY infoChanged)
|
||||
Q_PROPERTY(bool isIntel READ isIntel NOTIFY infoChanged)
|
||||
|
||||
public:
|
||||
explicit GpuIndicator(QObject *parent = nullptr);
|
||||
~GpuIndicator();
|
||||
|
||||
QString vendor() const;
|
||||
QString model() const;
|
||||
QString driverVersion() const;
|
||||
QString driverStatus() const;
|
||||
QString icon() const;
|
||||
bool isNvidia() const;
|
||||
bool isAmd() const;
|
||||
bool isIntel() const;
|
||||
|
||||
Q_INVOKABLE void updateFromJson(const QJsonObject &json);
|
||||
Q_INVOKABLE void updateFromDeviceInfo(const QString &jsonStr);
|
||||
|
||||
signals:
|
||||
void infoChanged();
|
||||
|
||||
private:
|
||||
void parseDeviceInfo(const QJsonObject &obj);
|
||||
QString determineIcon() const;
|
||||
|
||||
QString m_vendor;
|
||||
QString m_model;
|
||||
QString m_driverVersion;
|
||||
QString m_driverStatus;
|
||||
};
|
||||
Reference in New Issue
Block a user