diff --git a/client/Diagnostics_unix.cpp b/client/Diagnostics_unix.cpp
index 0cb612322..d36da789a 100644
--- a/client/Diagnostics_unix.cpp
+++ b/client/Diagnostics_unix.cpp
@@ -90,8 +90,7 @@ void Diagnostics::run()
info.clear();
#ifndef Q_OS_DARWIN
- QStringList package = packages({"open-eid"}, false);
- if( !package.isEmpty() )
+ if(QStringList package = packages({"open-eid"}, false); !package.isEmpty())
s << "" << tr("Base version:") << " " << package.first() << "
";
#endif
s << "" << tr("Application version:") << " " << QCoreApplication::applicationVersion() << " (" << QSysInfo::WordSize << " bit)
";
@@ -101,13 +100,10 @@ void Diagnostics::run()
s << "" << tr("OS:") << " " << Common::applicationOs() << "
";
#ifndef Q_OS_DARWIN
s << "" << tr("CPU:") << " ";
- QFile f( "/proc/cpuinfo" );
- if( f.open( QFile::ReadOnly ) )
+ if(QFile f("/proc/cpuinfo"); f.open(QFile::ReadOnly))
{
- QRegularExpression rx(QStringLiteral("model name.*\\: (.*)\n"));
- rx.setPatternOptions(QRegularExpression::InvertedGreedinessOption);
- QRegularExpressionMatch match = rx.match(QString::fromLocal8Bit(f.readAll()));
- if(match.hasMatch())
+ static const QRegularExpression rx(QStringLiteral("model name.*\\: (.*)\n"), QRegularExpression::InvertedGreedinessOption);
+ if(QRegularExpressionMatch match = rx.match(QString::fromLocal8Bit(f.readAll())); match.hasMatch())
s << match.captured(1);
}
s << "
";
@@ -140,8 +136,9 @@ void Diagnostics::run()
info.clear();
#ifndef Q_OS_DARWIN
- QStringList browsers = packages({"chromium-browser", "firefox", "MozillaFirefox", "google-chrome-stable"});
- if( !browsers.isEmpty() )
+ s << "
XDG_SESSION_TYPE: " << qEnvironmentVariable("XDG_SESSION_TYPE");
+
+ if(QStringList browsers = packages({"chromium-browser", "firefox", "MozillaFirefox", "google-chrome-stable"}); !browsers.isEmpty())
s << "
" << tr("Browsers:") << "
" << browsers.join(QStringLiteral("
")) << "
";
emit update( info );
info.clear();
@@ -149,8 +146,7 @@ void Diagnostics::run()
QProcess p;
p.start(QStringLiteral("lsusb"), QStringList());
p.waitForFinished();
- QString cmd = QString::fromLocal8Bit( p.readAll() );
- if( !cmd.isEmpty() )
+ if(QString cmd = QString::fromLocal8Bit(p.readAll()); !cmd.isEmpty())
s << "" << tr("USB info:") << "
" << cmd.replace( "\n", "
" ) << "
";
emit update( info );
info.clear();