on xenial help sign in
Fix orientation to landscape for Flo
6e97246Gerry Boland
qml/OrientedShell.qml+5
@@ -27,6 +27,11 @@ Item {
27 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
27 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
28
28
29 property int acceptedOrientationAngle: {
29 property int acceptedOrientationAngle: {
30+ // check device name and fix orientation if necessary
31+ if (applicationArguments.device() === "flo") {
32+ return Screen.angleBetween(Screen.primaryOrientation, Qt.InvertedLandscapeOrientation);
33+ }
34+
30 var screenOrientation = Screen.orientation;
35 var screenOrientation = Screen.orientation;
31 var acceptedOrientation;
36 var acceptedOrientation;
32
37
src/ApplicationArguments.h+11
@@ -21,6 +21,7 @@
21#define APPLICATION_ARGUMENTS_H
21#define APPLICATION_ARGUMENTS_H
22
22
23#include <QObject>
23#include <QObject>
24+#include <QProcess>
24#include <QSize>
25#include <QSize>
25#include <QStringList>
26#include <QStringList>
26
27
@@ -37,6 +38,16 @@ public:
37 Q_INVOKABLE bool hasGeometry() const { return m_size.isValid(); }
38 Q_INVOKABLE bool hasGeometry() const { return m_size.isValid(); }
38 Q_INVOKABLE int width() const { return m_size.width(); }
39 Q_INVOKABLE int width() const { return m_size.width(); }
39 Q_INVOKABLE int height() const { return m_size.height(); }
40 Q_INVOKABLE int height() const { return m_size.height(); }
41+ Q_INVOKABLE QString device() const {
42+ // fetch product name
43+ QProcess process;
44+ process.start("/usr/bin/getprop", QStringList() << "ro.build.product");
45+ if (!process.waitForFinished(100))
46+ return QString();
47+
48+ QString productName(process.readAllStandardOutput());
49+ return productName.trimmed();
50+ }
40
51
41private:
52private:
42 QSize m_size;
53 QSize m_size;