1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 01:18:38 -05:00

Merge pull request #1083 from srcejon/status_opengl_version

Display OpenGL version in status bar.
This commit is contained in:
Edouard Griffiths 2021-12-13 12:46:33 +01:00 committed by GitHub
commit 8715f4c037
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 2 deletions

View File

@ -40,6 +40,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); //HiDPI pixmaps
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts); // Needed for WebGL in QWebEngineView and MainWindow::openGLVersion
#endif
QApplication a(argc, argv);

View File

@ -865,14 +865,43 @@ void MainWindow::saveCommandSettings()
{
}
QString MainWindow::openGLVersion()
{
QOpenGLContext *glCurrentContext = QOpenGLContext::globalShareContext();
if (glCurrentContext)
{
if (glCurrentContext->isValid())
{
int major = glCurrentContext->format().majorVersion();
int minor = glCurrentContext->format().minorVersion();
bool es = glCurrentContext->isOpenGLES();
QString version = QString("%1.%2%3").arg(major).arg(minor).arg(es ? " ES" : "");
// Waterfall doesn't work if major version is less than 3, so display in red
if (major < 3) {
version = "<span style=\"color:red\">" + version + "</span>";
}
return version;
}
else
{
return "N/A";
}
}
else
{
return "N/A";
}
}
void MainWindow::createStatusBar()
{
QString qtVersionStr = QString("Qt %1 ").arg(QT_VERSION_STR);
QString openGLVersionStr = QString("OpenGL %1 ").arg(openGLVersion());
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
m_showSystemWidget = new QLabel("SDRangel " + qApp->applicationVersion() + " " + qtVersionStr
m_showSystemWidget = new QLabel("SDRangel " + qApp->applicationVersion() + " " + qtVersionStr + openGLVersionStr
+ QSysInfo::currentCpuArchitecture() + " " + QSysInfo::prettyProductName(), this);
#else
m_showSystemWidget = new QLabel("SDRangel " + qApp->applicationVersion() + " " + qtVersionStr, this);
m_showSystemWidget = new QLabel("SDRangel " + qApp->applicationVersion() + " " + qtVersionStr + openGLVersionStr, this);
#endif
statusBar()->addPermanentWidget(m_showSystemWidget);

View File

@ -129,6 +129,7 @@ private:
void saveFeatureSetPresetSettings(FeatureSetPreset* preset, int featureSetIndex);
void saveCommandSettings();
QString openGLVersion();
void createStatusBar();
void closeEvent(QCloseEvent*);
void updatePresetControls();