@@ -64,46 +64,44 @@ void emitProgressAsync(const QPointer<NvidiaInstaller> &guard,
6464
6565void attachRunnerLogging (CommandRunner &runner,
6666 const QPointer<NvidiaInstaller> &guard) {
67- QObject::connect (&runner, &CommandRunner::outputLine, guard,
68- [guard](const QString &message) {
69- emitProgressAsync (guard, message);
70- });
67+ QObject::connect (
68+ &runner, &CommandRunner::outputLine, guard,
69+ [guard](const QString &message) { emitProgressAsync (guard, message); });
7170
72- QObject::connect (&runner, &CommandRunner::errorLine, guard,
73- [guard](const QString &message) {
74- emitProgressAsync (guard, message);
75- });
71+ QObject::connect (
72+ &runner, &CommandRunner::errorLine, guard,
73+ [guard](const QString &message) { emitProgressAsync (guard, message); });
7674
7775 QObject::connect (
7876 &runner, &CommandRunner::commandStarted, guard,
7977 [guard](const QString &program, const QStringList &args, int attempt) {
8078 QStringList visibleArgs = args;
8179 if (!visibleArgs.isEmpty () &&
82- visibleArgs.constFirst ().contains (QStringLiteral (" ro-control-helper" ))) {
80+ visibleArgs.constFirst ().contains (
81+ QStringLiteral (" ro-control-helper" ))) {
8382 visibleArgs.removeFirst ();
8483 }
8584
86- const QString commandLine =
87- QStringLiteral (" $ %1 %2" )
88- .arg (program, visibleArgs.join (QLatin1Char (' ' )).trimmed ());
85+ const QString commandLine = QStringLiteral (" $ %1 %2" ).arg (
86+ program, visibleArgs.join (QLatin1Char (' ' )).trimmed ());
8987 emitProgressAsync (
9088 guard, NvidiaInstaller::tr (" Starting command (attempt %1): %2" )
9189 .arg (attempt)
9290 .arg (commandLine.trimmed ()));
9391 });
9492
95- QObject::connect (&runner, &CommandRunner::commandFinished, guard,
96- [guard]( const QString &program, int exitCode, int attempt ,
97- int elapsedMs) {
98- emitProgressAsync (
99- guard,
100- NvidiaInstaller::tr (
101- " Command finished (attempt %1, exit %2, %3 ms): %4" )
102- .arg (attempt)
103- .arg (exitCode)
104- .arg (elapsedMs)
105- .arg (program));
106- });
93+ QObject::connect (
94+ &runner, &CommandRunner::commandFinished, guard ,
95+ [guard]( const QString &program, int exitCode, int attempt,
96+ int elapsedMs) {
97+ emitProgressAsync (
98+ guard, NvidiaInstaller::tr (
99+ " Command finished (attempt %1, exit %2, %3 ms): %4" )
100+ .arg (attempt)
101+ .arg (exitCode)
102+ .arg (elapsedMs)
103+ .arg (program));
104+ });
107105}
108106
109107} // namespace
@@ -163,9 +161,9 @@ void NvidiaInstaller::installProprietary(bool agreementAccepted) {
163161 refreshProprietaryAgreement ();
164162
165163 if (m_proprietaryAgreementRequired && !agreementAccepted) {
166- emit installFinished (false ,
167- tr (" NVIDIA license review confirmation is required before "
168- " installation." ));
164+ emit installFinished (
165+ false , tr (" NVIDIA license review confirmation is required before "
166+ " installation." ));
169167 return ;
170168 }
171169
@@ -178,8 +176,8 @@ void NvidiaInstaller::installProprietary(bool agreementAccepted) {
178176 CommandRunner runner;
179177 attachRunnerLogging (runner, guard);
180178
181- emitProgressAsync (guard,
182- NvidiaInstaller::tr (" Checking RPM Fusion repositories..." ));
179+ emitProgressAsync (
180+ guard, NvidiaInstaller::tr (" Checking RPM Fusion repositories..." ));
183181
184182 CommandRunner rpmRunner;
185183 const auto fedoraResult =
@@ -193,7 +191,8 @@ void NvidiaInstaller::installProprietary(bool agreementAccepted) {
193191 [guard]() {
194192 if (guard) {
195193 emit guard->installFinished (
196- false , NvidiaInstaller::tr (" Platform version could not be detected." ));
194+ false , NvidiaInstaller::tr (
195+ " Platform version could not be detected." ));
197196 }
198197 },
199198 Qt::QueuedConnection);
@@ -226,8 +225,9 @@ void NvidiaInstaller::installProprietary(bool agreementAccepted) {
226225 }
227226
228227 emitProgressAsync (
229- guard, NvidiaInstaller::tr (
230- " Installing the proprietary NVIDIA driver (akmod-nvidia)..." ));
228+ guard,
229+ NvidiaInstaller::tr (
230+ " Installing the proprietary NVIDIA driver (akmod-nvidia)..." ));
231231
232232 QStringList installArgs{QStringLiteral (" install" ), QStringLiteral (" -y" ),
233233 QStringLiteral (" --refresh" ),
@@ -237,8 +237,8 @@ void NvidiaInstaller::installProprietary(bool agreementAccepted) {
237237 result = runner.runAsRoot (QStringLiteral (" dnf" ), installArgs);
238238
239239 if (!result.success ()) {
240- const QString error =
241- NvidiaInstaller::tr ( " Installation failed: " ) + result.stderr .trimmed ();
240+ const QString error = NvidiaInstaller::tr ( " Installation failed: " ) +
241+ result.stderr .trimmed ();
242242 QMetaObject::invokeMethod (
243243 guard,
244244 [guard, error]() {
@@ -253,7 +253,8 @@ void NvidiaInstaller::installProprietary(bool agreementAccepted) {
253253 emitProgressAsync (
254254 guard,
255255 NvidiaInstaller::tr (" Building the kernel module (akmods --force)..." ));
256- result = runner.runAsRoot (QStringLiteral (" akmods" ), {QStringLiteral (" --force" )});
256+ result =
257+ runner.runAsRoot (QStringLiteral (" akmods" ), {QStringLiteral (" --force" )});
257258 if (!result.success ()) {
258259 const QString error =
259260 NvidiaInstaller::tr (" Kernel module build failed: " ) +
@@ -289,8 +290,8 @@ void NvidiaInstaller::installProprietary(bool agreementAccepted) {
289290 [guard]() {
290291 if (guard) {
291292 emit guard->installFinished (
292- true ,
293- NvidiaInstaller::tr ( " The proprietary NVIDIA driver was installed "
293+ true , NvidiaInstaller::tr (
294+ " The proprietary NVIDIA driver was installed "
294295 " successfully. Please restart the system." ));
295296 }
296297 },
@@ -308,8 +309,8 @@ void NvidiaInstaller::installOpenSource() {
308309 CommandRunner runner;
309310 attachRunnerLogging (runner, guard);
310311
311- emitProgressAsync (
312- guard, NvidiaInstaller::tr ( " Switching to NVIDIA open kernel modules..." ));
312+ emitProgressAsync (guard, NvidiaInstaller::tr (
313+ " Switching to NVIDIA open kernel modules..." ));
313314
314315 auto result = runner.runAsRoot (
315316 QStringLiteral (" dnf" ),
@@ -318,7 +319,8 @@ void NvidiaInstaller::installOpenSource() {
318319
319320 if (!result.success ()) {
320321 const QString error =
321- NvidiaInstaller::tr (" Failed to remove conflicting NVIDIA kernel packages: " ) +
322+ NvidiaInstaller::tr (
323+ " Failed to remove conflicting NVIDIA kernel packages: " ) +
322324 commandError (result);
323325 QMetaObject::invokeMethod (
324326 guard,
@@ -335,13 +337,14 @@ void NvidiaInstaller::installOpenSource() {
335337 QStringLiteral (" --refresh" ),
336338 QStringLiteral (" --best" ),
337339 QStringLiteral (" --allowerasing" )};
338- installArgs
339- << buildDriverInstallTargets ( QStringLiteral (" akmod-nvidia-open" ));
340+ installArgs << buildDriverInstallTargets (
341+ QStringLiteral (" akmod-nvidia-open" ));
340342 result = runner.runAsRoot (QStringLiteral (" dnf" ), installArgs);
341343
342344 if (!result.success ()) {
343345 const QString error =
344- NvidiaInstaller::tr (" Open NVIDIA kernel module installation failed: " ) +
346+ NvidiaInstaller::tr (
347+ " Open NVIDIA kernel module installation failed: " ) +
345348 commandError (result);
346349 QMetaObject::invokeMethod (
347350 guard,
@@ -357,8 +360,8 @@ void NvidiaInstaller::installOpenSource() {
357360 emitProgressAsync (
358361 guard,
359362 NvidiaInstaller::tr (" Building the kernel module (akmods --force)..." ));
360- result = runner. runAsRoot ( QStringLiteral ( " akmods " ),
361- {QStringLiteral (" --force" )});
363+ result =
364+ runner. runAsRoot ( QStringLiteral ( " akmods " ), {QStringLiteral (" --force" )});
362365 if (!result.success ()) {
363366 const QString error =
364367 NvidiaInstaller::tr (" Kernel module build failed: " ) +
@@ -395,9 +398,9 @@ void NvidiaInstaller::installOpenSource() {
395398 [guard]() {
396399 if (guard) {
397400 emit guard->installFinished (
398- true ,
399- NvidiaInstaller::tr ( " NVIDIA open kernel modules were installed "
400- " successfully. Please restart the system." ));
401+ true , NvidiaInstaller::tr (
402+ " NVIDIA open kernel modules were installed "
403+ " successfully. Please restart the system." ));
401404 }
402405 },
403406 Qt::QueuedConnection);
@@ -420,14 +423,14 @@ void NvidiaInstaller::remove() {
420423 const auto result = runner.runAsRoot (
421424 QStringLiteral (" dnf" ),
422425 {QStringLiteral (" remove" ), QStringLiteral (" -y" ),
423- QStringLiteral (" akmod-nvidia" ),
424- QStringLiteral (" akmod-nvidia-open" ),
426+ QStringLiteral (" akmod-nvidia" ), QStringLiteral (" akmod-nvidia-open" ),
425427 QStringLiteral (" xorg-x11-drv-nvidia*" )});
426428
427429 const bool success = result.success ();
428430 const QString message =
429- success ? NvidiaInstaller::tr (" Driver removed successfully." )
430- : NvidiaInstaller::tr (" Removal failed: " ) + result.stderr .trimmed ();
431+ success
432+ ? NvidiaInstaller::tr (" Driver removed successfully." )
433+ : NvidiaInstaller::tr (" Removal failed: " ) + result.stderr .trimmed ();
431434 QMetaObject::invokeMethod (
432435 guard,
433436 [guard, success, message]() {
@@ -449,18 +452,18 @@ void NvidiaInstaller::deepClean() {
449452 CommandRunner runner;
450453 attachRunnerLogging (runner, guard);
451454
452- emitProgressAsync (guard,
453- NvidiaInstaller::tr (" Cleaning legacy driver leftovers..." ));
455+ emitProgressAsync (
456+ guard, NvidiaInstaller::tr (" Cleaning legacy driver leftovers..." ));
454457
455- const auto removeResult = runner. runAsRoot (
456- QStringLiteral (" dnf" ),
457- {QStringLiteral (" remove" ), QStringLiteral (" -y" ),
458- QStringLiteral (" *nvidia*" ), QStringLiteral (" *akmod*" ),
459- QStringLiteral (" *nvidia-open*" )});
458+ const auto removeResult =
459+ runner. runAsRoot ( QStringLiteral (" dnf" ),
460+ {QStringLiteral (" remove" ), QStringLiteral (" -y" ),
461+ QStringLiteral (" *nvidia*" ), QStringLiteral (" *akmod*" ),
462+ QStringLiteral (" *nvidia-open*" )});
460463
461464 if (!removeResult.success ()) {
462- const QString error =
463- NvidiaInstaller::tr ( " Deep clean failed: " ) + removeResult.stderr .trimmed ();
465+ const QString error = NvidiaInstaller::tr ( " Deep clean failed: " ) +
466+ removeResult.stderr .trimmed ();
464467 QMetaObject::invokeMethod (
465468 guard,
466469 [guard, error]() {
@@ -493,7 +496,8 @@ void NvidiaInstaller::deepClean() {
493496 guard,
494497 [guard]() {
495498 if (guard) {
496- emit guard->progressMessage (NvidiaInstaller::tr (" Deep clean completed." ));
499+ emit guard->progressMessage (
500+ NvidiaInstaller::tr (" Deep clean completed." ));
497501 emit guard->removeFinished (
498502 true , NvidiaInstaller::tr (" Legacy NVIDIA cleanup completed." ));
499503 }
@@ -502,8 +506,6 @@ void NvidiaInstaller::deepClean() {
502506 });
503507}
504508
505-
506-
507509bool NvidiaInstaller::applySessionSpecificSetup (CommandRunner &runner,
508510 const QString &sessionType,
509511 QString *errorMessage) {
0 commit comments