# HG changeset patch # User Teemu Piippo # Date 1656433297 -10800 # Node ID 9f85a54ead291f40bc9931c36f884a903a53886d # Parent f071ec94c0220f1e2fcba5c83ba5cd768debf2e1 Add OpenGL information to about page diff -r f071ec94c022 -r 9f85a54ead29 src/about.ui --- a/src/about.ui Tue Jun 28 18:02:51 2022 +0300 +++ b/src/about.ui Tue Jun 28 19:21:37 2022 +0300 @@ -36,11 +36,18 @@ </style></head><body style=" font-family:'EPSONEXT 丸ゴシック体M'; font-size:11pt; font-weight:400; font-style:normal;"> <h1 style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/icons/appicon.png" height="64" /><span style=" font-size:xx-large; font-weight:600;"> %APPNAME% %VERSION%</span></h1> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt version: %QTVERSION%</p> +<hr /> +<h2 style=" margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:x-large; font-weight:600;">Build time information</span></h2> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The following information was gathered during the build of this program.</p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">%GLMVERSIONSTRING%</p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Build type: %BUILDTYPE%</p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Compiler: %COMPILER_ID% %COMPILER_VERSION%</p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Compiler system: %COMPILER_SYSTEM% (%COMPILER_CPU%)</p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Compiler flags: %COMPILER_FLAGS%</p></body></html> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Compiler flags: %COMPILER_FLAGS%</p> +<hr /> +<h2 style=" margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:x-large; font-weight:600;">OpenGL information</span></h2> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">OpenGL version: %GL_VERSION%</p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">OpenGL Extensions: %GL_EXTENSIONS%</p></body></html> diff -r f071ec94c022 -r 9f85a54ead29 src/main.cpp --- a/src/main.cpp Tue Jun 28 18:02:51 2022 +0300 +++ b/src/main.cpp Tue Jun 28 19:21:37 2022 +0300 @@ -20,6 +20,7 @@ #include "src/ui/objecteditor.h" #include "src/version.h" #include "src/widgets/colorselectdialog.h" +#include static const QDir LOCALE_DIR {":/locale"}; @@ -380,6 +381,17 @@ QDialog dialog{parent}; Ui_About ui; ui.setupUi(&dialog); + const char* glVersion = reinterpret_cast(glGetString(GL_VERSION)); + const QString extensions = []{ + GLint numExtensions; + glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions); + QStringList extensionsList; + for (GLint i = 0; i < numExtensions; i++) { + const GLubyte* ext = glGetStringi(GL_EXTENSIONS, i); + extensionsList.push_back(reinterpret_cast(ext)); + } + return extensionsList.join(" "); + }(); for (QTextBrowser* browser : dialog.findChildren()) { browser->setHtml( browser->toHtml() @@ -395,6 +407,8 @@ .replace("%COMPILER_CPU%", CMAKE_SYSTEM_PROCESSOR) .replace("%COMPILER_SYSTEM%", CMAKE_SYSTEM) .replace("%GLMVERSIONSTRING%", GLM_VERSION_MESSAGE) + .replace("%GL_VERSION%", glVersion) + .replace("%GL_EXTENSIONS%", extensions) ); } dialog.setWindowTitle(QObject::tr("About %1").arg(CMAKE_PROJECT_NAME)); @@ -775,7 +789,14 @@ QObject::connect( ui.actionAbout, &QAction::triggered, - [&mainWindow]{about(&mainWindow);} + [&mainWindow, &ui]{ + // Make sure that there's an OpenGL context active, otherwise + // we cannot obtain OpenGL information + if (ui.mdiArea->findChildren().empty()) { + ui.actionNew->trigger(); + } + about(&mainWindow); + } ); mainWindow.tabifyDockWidget(ui.messageLogDock, ui.toolOptionsDock); mainWindow.restoreGeometry(setting());