summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@theqtcompany.com>2014-11-20 16:36:51 +0100
committerAndy Nichols <andy.nichols@theqtcompany.com>2014-11-21 13:24:38 +0200
commitaaa4799a8be7bd8b666ff39661e2b7831fc1b4b8 (patch)
treeec0d1f7262af2e9a54543419a333462385ad11be
parent67f7c8ae093c4d99b21f14f8b61a57f5059780d0 (diff)
Fix display when there is not OpenGL available
Disable particle engines when using 2d renderer Enable source images instead of using ShaderEffects Change-Id: Ie65e723cb0482aed4936337b3f0fe1075b42c65a Reviewed-by: Eirik Aavitsland <eirik.aavitsland@theqtcompany.com>
-rw-r--r--qml/ApplicationIcon.qml2
-rw-r--r--qml/BootScreen.qml5
-rw-r--r--qml/GlimmeringQtLogo.qml8
-rw-r--r--qml/Main.qml2
-rw-r--r--src/engine.cpp9
-rw-r--r--src/engine.h5
6 files changed, 21 insertions, 10 deletions
diff --git a/qml/ApplicationIcon.qml b/qml/ApplicationIcon.qml
index a72ead9..7f8d5a3 100644
--- a/qml/ApplicationIcon.qml
+++ b/qml/ApplicationIcon.qml
@@ -34,7 +34,7 @@ Item {
source: icon
asynchronous: true
anchors.fill: parent
- visible: false
+ visible: false || !engine.glAvailable
}
ShaderEffect {
diff --git a/qml/BootScreen.qml b/qml/BootScreen.qml
index 3ae4ace..647e5b7 100644
--- a/qml/BootScreen.qml
+++ b/qml/BootScreen.qml
@@ -76,7 +76,7 @@ Item {
id: sphereSystem;
anchors.fill: logo
- running: visible
+ running: visible && engine.glAvailable
ImageParticle {
id: sphereParticle
@@ -110,8 +110,7 @@ Item {
id: starSystem;
anchors.fill: logo
- running: visible
-
+ running: visible && engine.glAvailable
ImageParticle {
id: starParticle
diff --git a/qml/GlimmeringQtLogo.qml b/qml/GlimmeringQtLogo.qml
index 567a445..8220369 100644
--- a/qml/GlimmeringQtLogo.qml
+++ b/qml/GlimmeringQtLogo.qml
@@ -31,12 +31,12 @@ Item {
height: width * sourceSize.height / sourceSize.width;
source: "images/qt-logo.png"
- visible: false
+ visible: false || !engine.glAvailable
}
HighlightShader {
source: image
- running: true
+ running: engine.glAvailable
interval: 10000
anchors.fill: image;
}
@@ -45,7 +45,7 @@ Item {
id: starSystem;
anchors.fill: image
- running: visible
+ running: visible && engine.glAvailable
ImageParticle {
id: starParticle
@@ -62,7 +62,7 @@ Item {
emitRate: 3
size: 20
sizeVariation: 4
- enabled: visible
+ enabled: visible && engine.glAvailable
velocity: PointDirection { xVariation: 0; yVariation: 0; }
acceleration: PointDirection {
diff --git a/qml/Main.qml b/qml/Main.qml
index cc369d0..0b7557b 100644
--- a/qml/Main.qml
+++ b/qml/Main.qml
@@ -15,7 +15,7 @@
** contact form at http://www.qt.io
**
****************************************************************************/
-import QtQuick 2.3
+import QtQuick 2.4
import QtQuick.Window 2.2
import QtQuick.Enterprise.VirtualKeyboard 1.2
import com.qtcompany.B2QtLauncher 1.0
diff --git a/src/engine.cpp b/src/engine.cpp
index 1adfa6d..8c6264e 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -47,6 +47,7 @@ Engine::Engine(QQuickItem *parent)
, m_apps_ready(false)
, m_fps_enabled(false)
, m_bootAnimationEnabled(true)
+ , m_glAvailable(true)
{
m_state = ENGINE_STATE_BOOTING;
@@ -64,8 +65,14 @@ Engine::Engine(QQuickItem *parent)
m_screenHeight = m_screenSize.height();
connect(this, SIGNAL(windowChanged(QQuickWindow*)), this, SLOT(windowChanged(QQuickWindow*)));
-}
+ //Check for software renderer
+ QString renderer = qgetenv("QMLSCENE_DEVICE");
+ if (renderer.toLower() == "softwarecontext") {
+ m_glAvailable = false;
+ emit glAvailableChanged(false);
+ }
+}
void Engine::updateReadyness()
{
diff --git a/src/engine.h b/src/engine.h
index fe7c058..ec0cbb7 100644
--- a/src/engine.h
+++ b/src/engine.h
@@ -45,6 +45,8 @@ class Engine : public QQuickItem
Q_PROPERTY(const QString qtVersion READ qtVersion)
+ Q_PROPERTY(bool glAvailable READ glAvailable NOTIFY glAvailableChanged)
+
public:
explicit Engine(QQuickItem *parent = 0);
@@ -75,6 +77,7 @@ public:
Q_INVOKABLE int mm(int val) const { return (int)(m_dpcm * val * 0.1); }
Q_INVOKABLE int screenWidth() const { return m_screenWidth; }
Q_INVOKABLE int screenHeight() const { return m_screenHeight; }
+ Q_INVOKABLE bool glAvailable() const { return m_glAvailable; }
protected:
@@ -87,6 +90,7 @@ signals:
void bootAnimationEnabledChanged(bool enabled);
void fpsChanged(qreal fps);
void fpsEnabledChanged(bool enabled);
+ void glAvailableChanged(bool available);
public slots:
void markApplicationsModelReady() { m_apps_ready = true; updateReadyness(); }
@@ -121,6 +125,7 @@ private:
uint m_apps_ready : 1;
uint m_fps_enabled : 1;
uint m_bootAnimationEnabled : 1;
+ bool m_glAvailable;
};
#endif // ENGINE_H