on xenial help sign in
Fix orientation to landscape for Flo
commite608fc9f8070030f32b460d4aecd343f235a4564 authorGerry Boland <gerry.boland@canonical.com> dateTue 27 May 2014, 14:25 (12 years ago) parenta7f4ee3
2 files changed+16
qml/OrientedShell.qml+5 src/ApplicationArguments.h+11
qml/OrientedShell.qml+5
@@ -27,6 +27,11 @@ Item {
2727 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
2828
2929 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+
3035 var screenOrientation = Screen.orientation;
3136 var acceptedOrientation;
3237
src/ApplicationArguments.h+11
@@ -21,6 +21,7 @@
2121#define APPLICATION_ARGUMENTS_H
2222
2323#include <QObject>
24+#include <QProcess>
2425#include <QSize>
2526#include <QStringList>
2627
@@ -37,6 +38,16 @@ public:
3738 Q_INVOKABLE bool hasGeometry() const { return m_size.isValid(); }
3839 Q_INVOKABLE int width() const { return m_size.width(); }
3940 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+ }
4051
4152private:
4253 QSize m_size;