Commit 47ec0bda authored by Harald Sitter's avatar Harald Sitter 🏳🌈
Browse files

parse xorg version for nicer display

instead of just printing a random integer lets try to print a
nice looking version string. since I couldn't find
cross-implementation documentation on what the format of the
int is, I am going to assume it is vendor specific and guard
the xorg specific parsing behind a guard based on the vendor
string containig

BUG: 344038
FIXED-IN: 5.18.0

Test Plan: version looks nice in xorg module

Reviewers: mart

Reviewed By: mart

Subscribers: plasma-devel

Tags: #plasma

Differential Revision:
parent 87d793d1
...@@ -29,6 +29,7 @@ License along with this library. If not, see <>. ...@@ -29,6 +29,7 @@ License along with this library. If not, see <>.
#include <QTextStream> #include <QTextStream>
#include <QTreeWidget> #include <QTreeWidget>
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include <QVersionNumber>
#include <KLocalizedString> #include <KLocalizedString>
#include <config-X11.h> #include <config-X11.h>
...@@ -239,11 +240,22 @@ static bool GetInfo_XServer_Generic(QTreeWidget *lBox) { ...@@ -239,11 +240,22 @@ static bool GetInfo_XServer_Generic(QTreeWidget *lBox) {
last = new QTreeWidgetItem(next, displayNameList); last = new QTreeWidgetItem(next, displayNameList);
QStringList vendorList; QStringList vendorList;
vendorList << i18n("Vendor String") << QLatin1String(ServerVendor(dpy)); const QString vendor = QString::fromLatin1(ServerVendor(dpy));
vendorList << i18n("Vendor String") << vendor;
last = new QTreeWidgetItem(next, vendorList); last = new QTreeWidgetItem(next, vendorList);
QStringList vendorReleaseList; QStringList vendorReleaseList;
vendorReleaseList << i18n("Vendor Release Number") << Value((int)VendorRelease(dpy)); const int releaseNumber = VendorRelease(dpy);
QString releaseString = Value(releaseNumber);
if (vendor.contains(QStringLiteral(""), Qt::CaseInsensitive)) {
// Pipe through QVersionNumber to ensure output is sane.
// As a side effect we ignore the potential 4th level as QVN doesn't
// have support for it anyway.
releaseString = QVersionNumber(releaseNumber / 10000000,
(releaseNumber / 100000) % 100,
(releaseNumber / 1000) % 100).toString();
vendorReleaseList << i18n("Vendor Release Number") << releaseString;
last = new QTreeWidgetItem(next, vendorReleaseList); last = new QTreeWidgetItem(next, vendorReleaseList);
QStringList versionList; QStringList versionList;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment