Skip to content

Commit 3ef91c9

Browse files
committed
docs(code): add concise TR/EN inline comments
1 parent 0bdae16 commit 3ef91c9

5 files changed

Lines changed: 38 additions & 7 deletions

File tree

src/backend/monitor/rammonitor.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ int RamMonitor::usagePercent() const { return m_usagePercent; }
2828
int RamMonitor::updateInterval() const { return m_timer.interval(); }
2929

3030
void RamMonitor::refresh() {
31+
// TR: Linux RAM metrikleri /proc/meminfo uzerinden okunur.
32+
// EN: Linux memory metrics are read from /proc/meminfo.
3133
QFile meminfo("/proc/meminfo");
3234
if (!meminfo.open(QIODevice::ReadOnly | QIODevice::Text)) {
3335
setAvailable(false);
@@ -43,6 +45,8 @@ void RamMonitor::refresh() {
4345
qint64 sReclaimableKiB = -1;
4446
qint64 shmemKiB = -1;
4547

48+
// TR: "Anahtar: deger" satirlarini guvenli sekilde ayriştir.
49+
// EN: Safely parse "Key: value" lines.
4650
static const QRegularExpression lineRe(
4751
QStringLiteral(R"(^([A-Za-z_]+):\s+(\d+))"));
4852

@@ -79,14 +83,17 @@ void RamMonitor::refresh() {
7983
}
8084
}
8185

82-
// Some kernels/environments may not expose MemAvailable.
86+
// TR: Bazi kernel/ortamlarda MemAvailable olmayabilir; yaklasik deger hesapla.
87+
// EN: Some kernels/environments do not expose MemAvailable; compute a fallback.
8388
if (memAvailableKiB < 0 && memFreeKiB >= 0 && buffersKiB >= 0 &&
8489
cachedKiB >= 0) {
8590
const qint64 reclaimable = sReclaimableKiB > 0 ? sReclaimableKiB : 0;
8691
const qint64 shmem = shmemKiB > 0 ? shmemKiB : 0;
8792
memAvailableKiB = memFreeKiB + buffersKiB + cachedKiB + reclaimable - shmem;
8893
}
8994

95+
// TR: Tutarsiz veri geldiyse metrikleri sifirla ve "unavailable" olarak isle.
96+
// EN: If metrics are inconsistent, clear values and mark monitor unavailable.
9097
if (memTotalKiB <= 0 || memAvailableKiB < 0 ||
9198
memAvailableKiB > memTotalKiB) {
9299
setAvailable(false);

src/backend/nvidia/detector.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ NvidiaDetector::NvidiaDetector(QObject *parent) : QObject(parent) {}
1212
NvidiaDetector::GpuInfo NvidiaDetector::detect() const {
1313
GpuInfo info;
1414

15+
// TR: Tespit adimlari olabildigince bagimsiz tutulur; biri fail etse digeri devam eder.
16+
// EN: Detection steps are independent so one failure does not block others.
1517
info.name = detectGpuName();
1618
info.found = !info.name.isEmpty();
1719
info.driverVersion = detectDriverVersion();
@@ -42,6 +44,8 @@ QString NvidiaDetector::activeDriver() const {
4244
}
4345

4446
QString NvidiaDetector::verificationReport() const {
47+
// TR: UI icin tek yerde ozet tanilama metni uret.
48+
// EN: Produce a single consolidated diagnostic text for the UI.
4549
const QString gpuText = m_info.found ? m_info.name : QStringLiteral("Yok");
4650
const QString versionText = m_info.driverVersion.isEmpty()
4751
? QStringLiteral("Yok")
@@ -105,6 +109,8 @@ QString NvidiaDetector::detectDriverVersion() const {
105109
if (result.success())
106110
return result.stdout.trimmed();
107111

112+
// TR: nvidia-smi yoksa modinfo ile surum fallback'i dene.
113+
// EN: If nvidia-smi is unavailable, fall back to modinfo.
108114
const auto modinfo =
109115
runner.run(QStringLiteral("modinfo"), {QStringLiteral("nvidia")});
110116

@@ -135,6 +141,8 @@ bool NvidiaDetector::isModuleLoaded(const QString &moduleName) const {
135141
}
136142

137143
bool NvidiaDetector::detectSecureBoot(bool *known) const {
144+
// TR: mokutil yoksa "kapali" degil "bilinmiyor" olarak siniflandir.
145+
// EN: If mokutil is unavailable, classify as "unknown" rather than "disabled".
138146
CommandRunner runner;
139147
const auto result =
140148
runner.run(QStringLiteral("mokutil"), {QStringLiteral("--sb-state")});

src/backend/nvidia/updater.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
NvidiaUpdater::NvidiaUpdater(QObject *parent) : QObject(parent) {}
99

1010
void NvidiaUpdater::checkForUpdate() {
11+
// TR: Her kontrol denemesinde UI'ye gorunur bir baslangic mesaji gonder.
12+
// EN: Always emit a visible start message for each check request.
1113
emit progressMessage(
1214
QStringLiteral("Guncelleme kontrolu baslatildi..."));
1315

@@ -31,7 +33,8 @@ void NvidiaUpdater::checkForUpdate() {
3133
return;
3234
}
3335

34-
// DNF'den güncelleme bilgisi al
36+
// TR: DNF cikis kodlari: 100=guncelleme var, 0=yok, digeri=hata.
37+
// EN: DNF exit codes: 100=updates available, 0=none, others=error.
3538
CommandRunner runner;
3639

3740
const auto result =
@@ -93,6 +96,8 @@ void NvidiaUpdater::applyUpdate() {
9396
connect(&runner, &CommandRunner::outputLine, this,
9497
&NvidiaUpdater::progressMessage);
9598

99+
// TR: Uzun surebilecek adimlar oncesinde kullaniciya ilerleme bilgisi ver.
100+
// EN: Emit progress updates before long-running operations.
96101
emit progressMessage(QStringLiteral("NVIDIA sürücüsü güncelleniyor..."));
97102

98103
const auto result = runner.runAsRoot(

src/main.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
#include "backend/nvidia/updater.h"
1212

1313
int main(int argc, char *argv[]) {
14-
// QApplication: Widgets backend (pencere, sistem tray vb.) için gerekli
14+
// TR: QApplication, Qt Widgets tabanli uygulama omurgasini baslatir.
15+
// EN: QApplication bootstraps the Qt Widgets application runtime.
1516
QApplication app(argc, argv);
1617

17-
// Uygulama meta bilgileri — Q_PROPERTY ve sistem entegrasyonunda kullanılır
18+
// TR: Bu meta bilgiler masaustu entegrasyonu ve UI kimligi icin kullanilir.
19+
// EN: These metadata values are used for desktop integration and app identity.
1820
app.setApplicationName("ro-control");
1921
app.setApplicationDisplayName("ro-Control");
2022
app.setApplicationVersion("0.1.0");
@@ -29,7 +31,8 @@ int main(int argc, char *argv[]) {
2931
GpuMonitor gpuMonitor;
3032
RamMonitor ramMonitor;
3133

32-
// QML motorunu başlat
34+
// TR: QML motoru, arayuz ve bagli context nesnelerini yukler.
35+
// EN: The QML engine loads the UI and injected context objects.
3336
QQmlApplicationEngine engine;
3437

3538
engine.rootContext()->setContextProperty("nvidiaDetector", &detector);
@@ -39,12 +42,14 @@ int main(int argc, char *argv[]) {
3942
engine.rootContext()->setContextProperty("gpuMonitor", &gpuMonitor);
4043
engine.rootContext()->setContextProperty("ramMonitor", &ramMonitor);
4144

42-
// QML yüklenemezse uygulamayı kapat
45+
// TR: Ana bileşen olusmazsa uygulamayi kontrollu sekilde sonlandir.
46+
// EN: Exit gracefully if the root QML component cannot be created.
4347
QObject::connect(
4448
&engine, &QQmlApplicationEngine::objectCreationFailed, &app,
4549
[]() { QCoreApplication::exit(-1); }, Qt::QueuedConnection);
4650

47-
// QML modülünden yüklemek, qrc prefix/policy farklarından etkilenmez.
51+
// TR: Modulden yukleme, qrc yol/prefix farklarina karsi daha dayaniklidir.
52+
// EN: Module-based loading is resilient to qrc path/prefix differences.
4853
engine.loadFromModule("rocontrol", "Main");
4954

5055
return app.exec();

src/qml/pages/DriverPage.qml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ Item {
107107
RowLayout {
108108
spacing: 8
109109

110+
// TR: Manuel kontrol butonu, sonucu log alanina yazar.
111+
// EN: Manual check button writes status into the on-screen log.
110112
Button {
111113
text: "Guncelleme Kontrol Et"
112114
onClicked: {
@@ -131,6 +133,8 @@ Item {
131133
RowLayout {
132134
spacing: 8
133135

136+
// TR: Yeniden Tara; detector + lisans durumu + update kontrolunu tazeler.
137+
// EN: Rescan refreshes detector state, agreement state, and update check.
134138
Button {
135139
text: "Yeniden Tara"
136140
onClicked: {
@@ -181,6 +185,8 @@ Item {
181185

182186
Connections {
183187
target: nvidiaUpdater
188+
// TR: Updater backend mesajlarini canli log olarak UI'ye aktar.
189+
// EN: Stream updater backend messages into the live UI log.
184190
function onProgressMessage(message) {
185191
logArea.append(message);
186192
}

0 commit comments

Comments
 (0)