Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/assets/org.deepin.camera.encode.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@
"description": "Set preferred resolution",
"permissions": "readwrite",
"visibility": "private"
},
"isLowPerformanceDevice": {
"value": false,
"serial": 0,
"flags": ["global"],
"name": "is low performance device",
"name[zh_CN]": "是否是低性能设备",
"description": "Is low performance device",
"permissions": "readwrite",
"visibility": "private"
}
}
}
23 changes: 22 additions & 1 deletion src/src/globalutils.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co.,Ltd.
// Copyright (C) 2020 ~ 2026 Uniontech Software Technology Co.,Ltd.
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
Expand All @@ -8,14 +8,20 @@
#include <QDebug>
#include <QtDBus>
#include <QDBusInterface>
#include <QDBusArgument>

Check warning on line 11 in src/src/globalutils.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QDBusArgument> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 11 in src/src/globalutils.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusArgument> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDBusReply>

Check warning on line 12 in src/src/globalutils.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QDBusReply> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 12 in src/src/globalutils.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusReply> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#ifdef DTKCORE_CLASS_DConfigFile
#include <DConfig>

Check warning on line 15 in src/src/globalutils.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <DConfig> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 15 in src/src/globalutils.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DConfig> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <memory>

Check warning on line 16 in src/src/globalutils.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <memory> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 16 in src/src/globalutils.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <memory> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#endif

// 相机配置文件
const QString CAMERA_CONF_PATH = "/usr/share/deepin-camera/camera.conf";
#define LOW_PERFORMANCE_BOARD "LowPerformanceBoard"

QStringList GlobalUtils::m_LowPerformanceBoards = QStringList();
bool GlobalUtils::m_IsLowPerformanceDevice = false;

struct DMIInfo {
QString biosManufacturer;
Expand Down Expand Up @@ -54,8 +60,14 @@
return argument;
}

bool GlobalUtils::isLowPerformanceBoard()

Check warning on line 63 in src/src/globalutils.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

The function 'isLowPerformanceBoard' is never used.

Check warning on line 63 in src/src/globalutils.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'isLowPerformanceBoard' is never used.
{
#ifdef DTKCORE_CLASS_DConfigFile
if (m_IsLowPerformanceDevice) {
return true;
}
#endif

qDBusRegisterMetaType<DMIInfo>();
QDBusInterface *monitorInterface = new QDBusInterface("com.deepin.system.SystemInfo", "/com/deepin/system/SystemInfo", "org.freedesktop.DBus.Properties", QDBusConnection::systemBus());
if (!monitorInterface->isValid())
Expand Down Expand Up @@ -86,4 +98,13 @@
} else {
m_LowPerformanceBoards = QStringList();
}

#ifdef DTKCORE_CLASS_DConfigFile
m_IsLowPerformanceDevice = false;
std::unique_ptr<DTK_CORE_NAMESPACE::DConfig> dconfig(
DTK_CORE_NAMESPACE::DConfig::create("org.deepin.camera", "org.deepin.camera.encode"));
if (dconfig && dconfig->isValid() && dconfig->keyList().contains("isLowPerformanceDevice")) {
m_IsLowPerformanceDevice = dconfig->value("isLowPerformanceDevice").toBool();
}
#endif
}
1 change: 1 addition & 0 deletions src/src/globalutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class GlobalUtils

private:
static QStringList m_LowPerformanceBoards;
static bool m_IsLowPerformanceDevice;
};

#endif // GLOBALUTILS_H
Loading