Merge lp:~fboucault/camera-app/orientation_lock_fix into lp:camera-app

Proposed by Florian Boucault
Status: Merged
Approved by: Bill Filler
Approved revision: 534
Merged at revision: 536
Proposed branch: lp:~fboucault/camera-app/orientation_lock_fix
Merge into: lp:camera-app
Diff against target: 58 lines (+33/-1)
1 file modified
ViewFinderOverlay.qml (+33/-1)
To merge this branch: bzr merge lp:~fboucault/camera-app/orientation_lock_fix
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu Phablet Team Pending
Review via email: mp+252428@code.launchpad.net

Commit message

Fix photos/videos when shooting/recording with orientation lock on by not relying on the app orientation returned by unity8 but instead the device orientation itself.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

will need some sort of test for this to land

Revision history for this message
Florian Boucault (fboucault) wrote :

Will write a manual test because automated testing is not really possible
as of yet for lack of ability to set the device's orientation
programatically. Work is in progress to fill that gap:
https://code.launchpad.net/~canonical/unity8/fake_platform_sensors_module/+merge/247334

On Wed, Mar 11, 2015 at 3:29 PM, Bill Filler <email address hidden>
wrote:

> will need some sort of test for this to land
> --
>
> https://code.launchpad.net/~fboucault/camera-app/orientation_lock_fix/+merge/252428
> You are the owner of lp:~fboucault/camera-app/orientation_lock_fix.
>

Revision history for this message
Florian Boucault (fboucault) wrote :

Manual test now added to test plan.

> Will write a manual test because automated testing is not really possible
> as of yet for lack of ability to set the device's orientation
> programatically. Work is in progress to fill that gap:
> https://code.launchpad.net/~canonical/unity8/fake_platform_sensors_module/+mer
> ge/247334
>
> On Wed, Mar 11, 2015 at 3:29 PM, Bill Filler <email address hidden>
> wrote:
>
> > will need some sort of test for this to land
> > --
> >
> > https://code.launchpad.net/~fboucault/camera-
> app/orientation_lock_fix/+merge/252428
> > You are the owner of lp:~fboucault/camera-app/orientation_lock_fix.
> >

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ViewFinderOverlay.qml'
2--- ViewFinderOverlay.qml 2015-01-27 17:37:09 +0000
3+++ ViewFinderOverlay.qml 2015-03-10 13:17:58 +0000
4@@ -20,6 +20,7 @@
5 import Ubuntu.Components.Popups 1.0
6 import QtMultimedia 5.0
7 import QtPositioning 5.2
8+import QtSensors 5.0
9 import CameraApp 0.1
10 import Qt.labs.settings 1.0
11
12@@ -486,6 +487,11 @@
13 }
14 }
15
16+ OrientationSensor {
17+ id: orientationSensor
18+ active: true
19+ }
20+
21 Item {
22 id: controls
23
24@@ -513,7 +519,33 @@
25 }
26
27 function shoot() {
28- var orientation = Screen.angleBetween(Screen.orientation, Screen.primaryOrientation);
29+ var orientation;
30+ switch (orientationSensor.reading.orientation) {
31+ case OrientationReading.TopUp:
32+ orientation = 0;
33+ break;
34+ case OrientationReading.TopDown:
35+ orientation = 180;
36+ break;
37+ case OrientationReading.LeftUp:
38+ orientation = 90;
39+ break;
40+ case OrientationReading.RightUp:
41+ orientation = 270;
42+ break;
43+ default:
44+ /* Workaround for OrientationSensor not setting a valid value until
45+ the device is rotated.
46+ Ref.: https://bugs.launchpad.net/qtubuntu-sensors/+bug/1429865
47+
48+ Note that the value returned by Screen.angleBetween is valid if
49+ the orientation lock is not engaged.
50+ Ref.: https://bugs.launchpad.net/camera-app/+bug/1422762
51+ */
52+ orientation = Screen.angleBetween(Screen.orientation, Screen.primaryOrientation);
53+ break;
54+ }
55+
56 if (Screen.primaryOrientation == Qt.PortraitOrientation) {
57 orientation += 90;
58 }

Subscribers

People subscribed via source and target branches