Skip to content

Commit 932b79d

Browse files
committed
Add XDG_SESSION_TYPE to diagnostics
IB-8134 Signed-off-by: Raul Metsma <[email protected]>
1 parent cd8d216 commit 932b79d

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

client/Diagnostics_unix.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ void Diagnostics::run()
8989
info.clear();
9090

9191
#ifndef Q_OS_DARWIN
92-
QStringList package = packages({"open-eid"}, false);
93-
if( !package.isEmpty() )
92+
if(QStringList package = packages({"open-eid"}, false); !package.isEmpty())
9493
s << "<b>" << tr("Base version:") << "</b> " << package.first() << "<br />";
9594
#endif
9695
s << "<b>" << tr("Application version:") << "</b> " << QCoreApplication::applicationVersion() << " (" << QSysInfo::WordSize << " bit)<br />";
@@ -100,13 +99,10 @@ void Diagnostics::run()
10099
s << "<b>" << tr("OS:") << "</b> " << Common::applicationOs() << "<br />";
101100
#ifndef Q_OS_DARWIN
102101
s << "<b>" << tr("CPU:") << "</b> ";
103-
QFile f( "/proc/cpuinfo" );
104-
if( f.open( QFile::ReadOnly ) )
102+
if(QFile f("/proc/cpuinfo"); f.open(QFile::ReadOnly))
105103
{
106-
QRegularExpression rx(QStringLiteral("model name.*\\: (.*)\n"));
107-
rx.setPatternOptions(QRegularExpression::InvertedGreedinessOption);
108-
QRegularExpressionMatch match = rx.match(QString::fromLocal8Bit(f.readAll()));
109-
if(match.hasMatch())
104+
static const QRegularExpression rx(QStringLiteral("model name.*\\: (.*)\n"), QRegularExpression::InvertedGreedinessOption);
105+
if(QRegularExpressionMatch match = rx.match(QString::fromLocal8Bit(f.readAll())); match.hasMatch())
110106
s << match.captured(1);
111107
}
112108
s << "<br />";
@@ -139,17 +135,17 @@ void Diagnostics::run()
139135
info.clear();
140136

141137
#ifndef Q_OS_DARWIN
142-
QStringList browsers = packages({"chromium-browser", "firefox", "MozillaFirefox", "google-chrome-stable"});
143-
if( !browsers.isEmpty() )
138+
s << "<br /><br /><b>XDG_SESSION_TYPE:</b><br /> " << qEnvironmentVariable("XDG_SESSION_TYPE");
139+
140+
if(QStringList browsers = packages({"chromium-browser", "firefox", "MozillaFirefox", "google-chrome-stable"}); !browsers.isEmpty())
144141
s << "<br /><br /><b>" << tr("Browsers:") << "</b><br />" << browsers.join(QStringLiteral("<br />")) << "<br /><br />";
145142
emit update( info );
146143
info.clear();
147144

148145
QProcess p;
149146
p.start(QStringLiteral("lsusb"), QStringList());
150147
p.waitForFinished();
151-
QString cmd = QString::fromLocal8Bit( p.readAll() );
152-
if( !cmd.isEmpty() )
148+
if(QString cmd = QString::fromLocal8Bit(p.readAll()); !cmd.isEmpty())
153149
s << "<b>" << tr("USB info:") << "</b><br/> " << cmd.replace( "\n", "<br />" ) << "<br />";
154150
emit update( info );
155151
info.clear();

0 commit comments

Comments
 (0)