Skip to content

Commit

Permalink
Add XDG_SESSION_TYPE to diagnostics
Browse files Browse the repository at this point in the history
IB-8134

Signed-off-by: Raul Metsma <raul@metsma.ee>
  • Loading branch information
metsma committed Nov 18, 2024
1 parent 3c55a63 commit 5986afe
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions client/Diagnostics_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 << "<b>" << tr("Base version:") << "</b> " << package.first() << "<br />";
#endif
s << "<b>" << tr("Application version:") << "</b> " << QCoreApplication::applicationVersion() << " (" << QSysInfo::WordSize << " bit)<br />";
Expand All @@ -101,13 +100,10 @@ void Diagnostics::run()
s << "<b>" << tr("OS:") << "</b> " << Common::applicationOs() << "<br />";
#ifndef Q_OS_DARWIN
s << "<b>" << tr("CPU:") << "</b> ";
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 << "<br />";
Expand Down Expand Up @@ -140,17 +136,17 @@ void Diagnostics::run()
info.clear();

#ifndef Q_OS_DARWIN
QStringList browsers = packages({"chromium-browser", "firefox", "MozillaFirefox", "google-chrome-stable"});
if( !browsers.isEmpty() )
s << "<br /><br /><b>XDG_SESSION_TYPE:</b> " << qEnvironmentVariable("XDG_SESSION_TYPE");

if(QStringList browsers = packages({"chromium-browser", "firefox", "MozillaFirefox", "google-chrome-stable"}); !browsers.isEmpty())
s << "<br /><br /><b>" << tr("Browsers:") << "</b><br />" << browsers.join(QStringLiteral("<br />")) << "<br /><br />";
emit update( info );
info.clear();

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 << "<b>" << tr("USB info:") << "</b><br/> " << cmd.replace( "\n", "<br />" ) << "<br />";
emit update( info );
info.clear();
Expand Down

0 comments on commit 5986afe

Please sign in to comment.