diff --git a/src/debug_console.cpp b/src/debug_console.cpp
index 27c7cefafa..d5f4b65ac4 100644
--- a/src/debug_console.cpp
+++ b/src/debug_console.cpp
@@ -666,8 +666,8 @@ void DebugConsole::initGLTab()
m_ui->glslVersionStringLabel->setText(QString::fromLocal8Bit(gl->glShadingLanguageVersionString()));
m_ui->glDriverLabel->setText(GLPlatform::driverToString(gl->driver()));
m_ui->glGPULabel->setText(GLPlatform::chipClassToString(gl->chipClass()));
- m_ui->glVersionLabel->setText(GLPlatform::versionToString(gl->glVersion()));
- m_ui->glslLabel->setText(GLPlatform::versionToString(gl->glslVersion()));
+ m_ui->glVersionLabel->setText(gl->glVersion().toString());
+ m_ui->glslLabel->setText(gl->glslVersion().toString());
auto extensionsString = [](const auto &extensions) {
QString text = QStringLiteral("
");
diff --git a/src/libkwineffects/glplatform.cpp b/src/libkwineffects/glplatform.cpp
index 2cadf74872..61c4d1a3ef 100644
--- a/src/libkwineffects/glplatform.cpp
+++ b/src/libkwineffects/glplatform.cpp
@@ -540,20 +540,6 @@ static ChipClass detectV3DClass(QByteArrayView chipClass)
return UnknownVideoCore3D;
}
-QString GLPlatform::versionToString(const Version &version)
-{
- return QString::fromLatin1(versionToString8(version));
-}
-
-QByteArray GLPlatform::versionToString8(const Version &version)
-{
- QByteArray string = QByteArray::number(version.major()) + '.' + QByteArray::number(version.minor());
- if (version.patch() != 0) {
- string += '.' + QByteArray::number(version.patch());
- }
- return string;
-}
-
QString GLPlatform::driverToString(Driver driver)
{
return QString::fromLatin1(driverToString8(driver));
@@ -1156,24 +1142,24 @@ void GLPlatform::printResults() const
print(QByteArrayLiteral("Driver:"), driverToString8(m_driver));
if (!isMesaDriver()) {
- print(QByteArrayLiteral("Driver version:"), versionToString8(m_driverVersion));
+ print(QByteArrayLiteral("Driver version:"), m_driverVersion.toByteArray());
}
print(QByteArrayLiteral("GPU class:"), chipClassToString8(m_chipClass));
- print(QByteArrayLiteral("OpenGL version:"), versionToString8(m_context->openglVersion()));
+ print(QByteArrayLiteral("OpenGL version:"), m_context->openglVersion().toByteArray());
if (m_supportsGLSL) {
- print(QByteArrayLiteral("GLSL version:"), versionToString8(m_glslVersion));
+ print(QByteArrayLiteral("GLSL version:"), m_glslVersion.toByteArray());
}
if (isMesaDriver()) {
- print(QByteArrayLiteral("Mesa version:"), versionToString8(mesaVersion()));
+ print(QByteArrayLiteral("Mesa version:"), mesaVersion().toByteArray());
}
// if (galliumVersion() > 0)
// print("Gallium version:", versionToString(m_galliumVersion));
if (serverVersion().isValid()) {
- print(QByteArrayLiteral("X server version:"), versionToString8(m_serverVersion));
+ print(QByteArrayLiteral("X server version:"), m_serverVersion.toByteArray());
}
print(QByteArrayLiteral("Requires strict binding:"), !m_looseBinding ? QByteArrayLiteral("yes") : QByteArrayLiteral("no"));
diff --git a/src/libkwineffects/glplatform.h b/src/libkwineffects/glplatform.h
index 08684f1b4f..0b30ab8404 100644
--- a/src/libkwineffects/glplatform.h
+++ b/src/libkwineffects/glplatform.h
@@ -389,30 +389,6 @@ public:
*/
OpenGLPlatformInterface platformInterface() const;
- /**
- * @returns a human readable form of the @p version as a QString.
- * @since 4.9
- * @see glVersion
- * @see glslVersion
- * @see driverVersion
- * @see mesaVersion
- * @see galliumVersion
- * @see serverVersion
- */
- static QString versionToString(const Version &version);
- /**
- * @returns a human readable form of the @p version as a QByteArray.
- * @since 5.5
- * @see glVersion
- * @see glslVersion
- * @see driverVersion
- * @see mesaVersion
- * @see galliumVersion
- * @see kernelVersion
- * @see serverVersion
- */
- static QByteArray versionToString8(const Version &version);
-
/**
* @returns a human readable form for the @p driver as a QString.
* @since 4.9
diff --git a/src/libkwineffects/version.cpp b/src/libkwineffects/version.cpp
index 2ad45cd56e..82fc8046f5 100644
--- a/src/libkwineffects/version.cpp
+++ b/src/libkwineffects/version.cpp
@@ -8,7 +8,6 @@
*/
#include "version.h"
-#include
#include
#include
@@ -68,4 +67,21 @@ Version Version::parseString(QByteArrayView versionString)
return Version(major, minor, patch);
}
+QString Version::toString() const
+{
+ if (m_patch == 0) {
+ return QString::number(m_major) + '.' + QString::number(m_minor);
+ } else {
+ return QString::number(m_major) + '.' + QString::number(m_minor) + '.' + QString::number(m_patch);
+ }
+}
+
+QByteArray Version::toByteArray() const
+{
+ if (m_patch == 0) {
+ return QByteArray::number(m_major) + '.' + QByteArray::number(m_minor);
+ } else {
+ return QByteArray::number(m_major) + '.' + QByteArray::number(m_minor) + '.' + QByteArray::number(m_patch);
+ }
+}
}
diff --git a/src/libkwineffects/version.h b/src/libkwineffects/version.h
index 78b883b1b9..b25544415b 100644
--- a/src/libkwineffects/version.h
+++ b/src/libkwineffects/version.h
@@ -9,7 +9,8 @@
#pragma once
#include "libkwineffects/kwinglutils_export.h"
-#include
+#include
+#include
namespace KWin
{
@@ -26,6 +27,9 @@ public:
uint32_t minor() const;
uint32_t patch() const;
+ QString toString() const;
+ QByteArray toByteArray() const;
+
static Version parseString(QByteArrayView versionString);
private:
diff --git a/src/workspace.cpp b/src/workspace.cpp
index 8aba56b79a..1749cbb1bf 100644
--- a/src/workspace.cpp
+++ b/src/workspace.cpp
@@ -1782,25 +1782,25 @@ QString Workspace::supportInformation() const
support.append(QStringLiteral("Driver: ") + GLPlatform::driverToString(platform->driver()) + QStringLiteral("\n"));
if (!platform->isMesaDriver()) {
- support.append(QStringLiteral("Driver version: ") + GLPlatform::versionToString(platform->driverVersion()) + QStringLiteral("\n"));
+ support.append(QStringLiteral("Driver version: ") + platform->driverVersion().toString() + QStringLiteral("\n"));
}
support.append(QStringLiteral("GPU class: ") + GLPlatform::chipClassToString(platform->chipClass()) + QStringLiteral("\n"));
- support.append(QStringLiteral("OpenGL version: ") + GLPlatform::versionToString(platform->glVersion()) + QStringLiteral("\n"));
+ support.append(QStringLiteral("OpenGL version: ") + platform->glVersion().toString() + QStringLiteral("\n"));
if (platform->supports(GLFeature::GLSL)) {
- support.append(QStringLiteral("GLSL version: ") + GLPlatform::versionToString(platform->glslVersion()) + QStringLiteral("\n"));
+ support.append(QStringLiteral("GLSL version: ") + platform->glslVersion().toString() + QStringLiteral("\n"));
}
if (platform->isMesaDriver()) {
- support.append(QStringLiteral("Mesa version: ") + GLPlatform::versionToString(platform->mesaVersion()) + QStringLiteral("\n"));
+ support.append(QStringLiteral("Mesa version: ") + platform->mesaVersion().toString() + QStringLiteral("\n"));
}
if (platform->serverVersion().isValid()) {
- support.append(QStringLiteral("X server version: ") + GLPlatform::versionToString(platform->serverVersion()) + QStringLiteral("\n"));
+ support.append(QStringLiteral("X server version: ") + platform->serverVersion().toString() + QStringLiteral("\n"));
}
if (auto kernelVersion = linuxKernelVersion(); kernelVersion.isValid()) {
- support.append(QStringLiteral("Linux kernel version: ") + GLPlatform::versionToString(kernelVersion) + QStringLiteral("\n"));
+ support.append(QStringLiteral("Linux kernel version: ") + kernelVersion.toString() + QStringLiteral("\n"));
}
support.append(QStringLiteral("Direct rendering: "));