Skip to content

Commit 4cc35e0

Browse files
authored
Add XDG_SESSION_TYPE to diagnostics (#1303)
IB-8134 Signed-off-by: Raul Metsma <[email protected]>
1 parent 54b781d commit 4cc35e0

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
@@ -90,8 +90,7 @@ void Diagnostics::run()
9090
info.clear();
9191

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

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

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

0 commit comments

Comments
 (0)