Cough.. But I will fix linux BrokenGL builds first

This commit is contained in:
Mark Watkins 2018-06-14 19:12:49 +10:00
parent bb9605fd9b
commit 8e6968fb6d
4 changed files with 19 additions and 11 deletions

View File

@ -9,7 +9,9 @@
#include <QDateTime> #include <QDateTime>
#include <QDir> #include <QDir>
#include <QThread> #include <QThread>
#ifndef BROKEN_OPENGL_BUILD
#include <QGLWidget> #include <QGLWidget>
#endif
#include <QOpenGLFunctions> #include <QOpenGLFunctions>
#include <QDebug> #include <QDebug>
#include <QDir> #include <QDir>
@ -96,25 +98,30 @@ void setCurrentGFXEngine(GFXEngine e)
QString getOpenGLVersionString() QString getOpenGLVersionString()
{ {
static QString glversion; static QString glversion;
if (glversion.isEmpty()) {
#ifdef BROKEN_OPENGL_BUILD
glversion="LegacyGFX";
qDebug() << "This LegacyGFX build has been created without the need for OpenGL";
#else
if (glversion.isEmpty()) {
QGLWidget w; QGLWidget w;
w.makeCurrent(); w.makeCurrent();
#if QT_VERSION < QT_VERSION_CHECK(5,4,0)
glversion = QString(QLatin1String(reinterpret_cast<const char*>(glGetString(GL_VERSION))));
#else
QOpenGLFunctions f; QOpenGLFunctions f;
f.initializeOpenGLFunctions(); f.initializeOpenGLFunctions();
glversion = QString(QLatin1String(reinterpret_cast<const char*>(f.glGetString(GL_VERSION)))); glversion = QString(QLatin1String(reinterpret_cast<const char*>(f.glGetString(GL_VERSION))));
#endif
qDebug() << "OpenGL Version:" << glversion; qDebug() << "OpenGL Version:" << glversion;
} #endif
return glversion; }
return glversion;
} }
float getOpenGLVersion() float getOpenGLVersion()
{ {
#ifdef BROKEN_OPENGL_BUILD
return 0;
#else
QString glversion = getOpenGLVersionString(); QString glversion = getOpenGLVersionString();
glversion = glversion.section(" ",0,0); glversion = glversion.section(" ",0,0);
bool ok; bool ok;
@ -130,6 +137,7 @@ float getOpenGLVersion()
} }
} }
return v; return v;
#endif
} }
QString getGraphicsEngine() QString getGraphicsEngine()

View File

@ -133,10 +133,6 @@ int main(int argc, char *argv[])
mainwin = new MainWindow; mainwin = new MainWindow;
#ifdef BROKEN_OPENGL_BUILD
qDebug() << "This build has been created especially for computers with older graphics hardware.\n";
#endif
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Detection // OpenGL Detection
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -10,7 +10,9 @@
#define MAINWINDOW_H #define MAINWINDOW_H
#include <QMainWindow> #include <QMainWindow>
#ifndef BROKEN_OPENGL_BUILD
#include <QGLContext> #include <QGLContext>
#endif
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
#include <QTimer> #include <QTimer>

View File

@ -10,7 +10,9 @@
#define OVERVIEW_H #define OVERVIEW_H
#include <QWidget> #include <QWidget>
#ifndef BROKEN_OPENGL_BUILD
#include <QGLContext> #include <QGLContext>
#endif
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QDateEdit> #include <QDateEdit>
#include "SleepLib/profiles.h" #include "SleepLib/profiles.h"