Skip to content

Commit d525108

Browse files
committed
style: apply clang-format to backend sources
1 parent 1814b2e commit d525108

6 files changed

Lines changed: 36 additions & 37 deletions

File tree

src/backend/monitor/gpumonitor.cpp

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ bool readIntegerFile(const QString &path, qint64 *value) {
7171
}
7272

7373
bool readFirstTemperatureFromHwmon(const QString &basePath, int *value) {
74-
const QFileInfoList hwmonEntries =
75-
QDir(basePath).entryInfoList({QStringLiteral("hwmon*")},
76-
QDir::Dirs | QDir::NoDotAndDotDot,
77-
QDir::Name);
74+
const QFileInfoList hwmonEntries = QDir(basePath).entryInfoList(
75+
{QStringLiteral("hwmon*")}, QDir::Dirs | QDir::NoDotAndDotDot,
76+
QDir::Name);
7877
for (const QFileInfo &entry : hwmonEntries) {
79-
const QFileInfoList inputs = QDir(entry.absoluteFilePath())
80-
.entryInfoList({QStringLiteral("temp*_input")},
81-
QDir::Files, QDir::Name);
78+
const QFileInfoList inputs =
79+
QDir(entry.absoluteFilePath())
80+
.entryInfoList({QStringLiteral("temp*_input")}, QDir::Files,
81+
QDir::Name);
8282
for (const QFileInfo &input : inputs) {
8383
qint64 milliC = 0;
8484
if (readIntegerFile(input.absoluteFilePath(), &milliC) && milliC > 0) {
@@ -94,9 +94,9 @@ bool readFirstTemperatureFromHwmon(const QString &basePath, int *value) {
9494
bool readGenericLinuxGpuMetrics(int *temperatureC, int *utilizationPercent,
9595
int *memoryUsedMiB, int *memoryTotalMiB) {
9696
const QFileInfoList cardEntries =
97-
QDir(drmRootPath()).entryInfoList({QStringLiteral("card*")},
98-
QDir::Dirs | QDir::NoDotAndDotDot,
99-
QDir::Name);
97+
QDir(drmRootPath())
98+
.entryInfoList({QStringLiteral("card*")},
99+
QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
100100

101101
bool anyMetric = false;
102102
for (const QFileInfo &cardEntry : cardEntries) {
@@ -117,19 +117,16 @@ bool readGenericLinuxGpuMetrics(int *temperatureC, int *utilizationPercent,
117117
if (utilizationPercent != nullptr &&
118118
readIntegerFile(devicePath + QStringLiteral("/gpu_busy_percent"),
119119
&busyPercent)) {
120-
*utilizationPercent =
121-
std::clamp(static_cast<int>(busyPercent), 0, 100);
120+
*utilizationPercent = std::clamp(static_cast<int>(busyPercent), 0, 100);
122121
anyMetric = true;
123122
}
124123

125124
qint64 usedBytes = 0;
126125
qint64 totalBytes = 0;
127-
const bool usedOk =
128-
readIntegerFile(devicePath + QStringLiteral("/mem_info_vram_used"),
129-
&usedBytes);
130-
const bool totalOk =
131-
readIntegerFile(devicePath + QStringLiteral("/mem_info_vram_total"),
132-
&totalBytes);
126+
const bool usedOk = readIntegerFile(
127+
devicePath + QStringLiteral("/mem_info_vram_used"), &usedBytes);
128+
const bool totalOk = readIntegerFile(
129+
devicePath + QStringLiteral("/mem_info_vram_total"), &totalBytes);
133130
if (usedOk && totalOk && totalBytes > 0) {
134131
if (memoryUsedMiB != nullptr) {
135132
*memoryUsedMiB =

src/backend/nvidia/detector.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,10 @@ QString NvidiaDetector::activeDriver() const {
5151
}
5252

5353
QString NvidiaDetector::verificationReport() const {
54-
const QString gpuText = m_info.found
55-
? m_info.name
56-
: (m_info.displayAdapterName.isEmpty()
57-
? tr("None")
58-
: m_info.displayAdapterName);
54+
const QString gpuText = m_info.found ? m_info.name
55+
: (m_info.displayAdapterName.isEmpty()
56+
? tr("None")
57+
: m_info.displayAdapterName);
5958
const QString versionText =
6059
m_info.driverVersion.isEmpty() ? tr("None") : m_info.driverVersion;
6160

src/backend/nvidia/detector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ class NvidiaDetector : public QObject {
99

1010
Q_PROPERTY(bool gpuFound READ gpuFound NOTIFY infoChanged)
1111
Q_PROPERTY(QString gpuName READ gpuName NOTIFY infoChanged)
12-
Q_PROPERTY(QString displayAdapterName READ displayAdapterName NOTIFY
13-
infoChanged)
12+
Q_PROPERTY(
13+
QString displayAdapterName READ displayAdapterName NOTIFY infoChanged)
1414
Q_PROPERTY(QString driverVersion READ driverVersion NOTIFY infoChanged)
1515
Q_PROPERTY(bool driverLoaded READ driverLoaded NOTIFY infoChanged)
1616
Q_PROPERTY(bool nouveauActive READ nouveauActive NOTIFY infoChanged)

src/backend/system/capabilityprobe.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ QString fedoraNvidiaDriverFlowSupportMessage() {
7777
}
7878

7979
return QStringLiteral(
80-
"Fedora NVIDIA driver management is currently supported only on x86_64 "
81-
"and aarch64 builds. The current build architecture is %1.")
80+
"Fedora NVIDIA driver management is currently supported only on "
81+
"x86_64 "
82+
"and aarch64 builds. The current build architecture is %1.")
8283
.arg(normalizedCpuArchitecture());
8384
}
8485

src/backend/system/systeminfoprovider.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
#include "commandrunner.h"
44

55
#include <QFile>
6-
#include <QStringList>
76
#include <QRegularExpression>
7+
#include <QStringList>
88
#include <QSysInfo>
99
#include <QTextStream>
1010

@@ -67,8 +67,8 @@ QString valueFromOsRelease(const QString &key) {
6767
}
6868

6969
QString value = line.mid(key.size() + 1).trimmed();
70-
if (value.startsWith(QLatin1Char('"')) && value.endsWith(QLatin1Char('"')) &&
71-
value.size() >= 2) {
70+
if (value.startsWith(QLatin1Char('"')) &&
71+
value.endsWith(QLatin1Char('"')) && value.size() >= 2) {
7272
value = value.mid(1, value.size() - 2);
7373
}
7474
return value;
@@ -77,7 +77,7 @@ QString valueFromOsRelease(const QString &key) {
7777
return {};
7878
}
7979

80-
} // namespace
80+
} // namespace
8181

8282
SystemInfoProvider::SystemInfoProvider(QObject *parent) : QObject(parent) {
8383
refresh();
@@ -118,7 +118,7 @@ QString SystemInfoProvider::detectOsName() const {
118118

119119
QString SystemInfoProvider::detectKernelVersion() const {
120120
#if defined(Q_OS_UNIX)
121-
utsname name {};
121+
utsname name{};
122122
if (uname(&name) == 0) {
123123
return QString::fromLocal8Bit(name.release);
124124
}
@@ -173,7 +173,8 @@ QString SystemInfoProvider::detectCpuModel() const {
173173
}
174174

175175
const auto virtResult =
176-
runner.run(QStringLiteral("systemd-detect-virt"), {QStringLiteral("--quiet"), QStringLiteral("--vm")});
176+
runner.run(QStringLiteral("systemd-detect-virt"),
177+
{QStringLiteral("--quiet"), QStringLiteral("--vm")});
177178
if (virtResult.success()) {
178179
const auto virtName = runner.run(QStringLiteral("systemd-detect-virt"));
179180
if (virtName.success()) {
@@ -188,9 +189,9 @@ QString SystemInfoProvider::detectCpuModel() const {
188189
}
189190
#elif defined(Q_OS_MACOS)
190191
CommandRunner runner;
191-
const auto result =
192-
runner.run(QStringLiteral("sysctl"),
193-
{QStringLiteral("-n"), QStringLiteral("machdep.cpu.brand_string")});
192+
const auto result = runner.run(
193+
QStringLiteral("sysctl"),
194+
{QStringLiteral("-n"), QStringLiteral("machdep.cpu.brand_string")});
194195
if (result.success()) {
195196
const QString value = result.stdout.trimmed();
196197
if (!value.isEmpty()) {

src/backend/system/systeminfoprovider.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ class SystemInfoProvider : public QObject {
77
Q_OBJECT
88

99
Q_PROPERTY(QString osName READ osName NOTIFY infoChanged)
10-
Q_PROPERTY(QString desktopEnvironment READ desktopEnvironment NOTIFY infoChanged)
10+
Q_PROPERTY(
11+
QString desktopEnvironment READ desktopEnvironment NOTIFY infoChanged)
1112
Q_PROPERTY(QString kernelVersion READ kernelVersion NOTIFY infoChanged)
1213
Q_PROPERTY(QString cpuModel READ cpuModel NOTIFY infoChanged)
1314

0 commit comments

Comments
 (0)