rschroll / beru

The Basic Epub Reader for Ubuntu
http://rschroll.github.io/beru/
GNU General Public License v3.0
24 stars 12 forks source link

Lock orientation setting #38

Open stuartlangridge opened 10 years ago

stuartlangridge commented 10 years ago

It would be very handy to be able to lock the orientation of Beru to portrait. Even if you don't want orientation locked on the whole phone (so that you can, for example, view videos landscape) it would be nice to be able to lock Beru to portrait so you can read in bed. :)

rschroll commented 10 years ago

Is this really better to do at the application level, rather than the OS level? Are there situations in which you'd want only some apps to adjust to the orientation? How easy is it to lock the orientation via the OS, or is it not possible at all?

A few ideas of how this could work:

It'd be nice to detect whether the device was re-orientable; there's no need for these options to show up on the desktop.

stuartlangridge commented 10 years ago

I think it's better to have this in the app, for a few reasons, in no particular order:

  1. It is useful for some apps to be able to rotate. Obvious candidate: YouTube, since most videos are landscape.
  2. Since it's useful for some apps to rotate, some people are loath to turn off screen rotation at OS level.
  3. It is generally more difficult to read books in a landscape environment: it's like reading a book while looking through a letterbox.
  4. It's also useful to be able to read while lying on one's side in bed, and if you do that then the screen rotates and you can't read it.
  5. Ubuntu for phones doesn't currently let you lock at OS level anyway :)

Personally I think that locking the orientation in Beru is something you either like or don't, and so you'll either turn it on once or never turn it on at all, and so it belongs in the settings. However, if people who are not me would frequently like to toggle it on or off, then the toolbar would be a good place for it. I don't have the data to know whether that's the case, though!

Agreed that detecting orientableness would be nice. I don't know how to do that, although I'll bet that it's highly correlated with having an accelerometer, so attempting to read the accelerometer values and treating "I got some values" as "this is an orientable device" might be a way to get started, if there's not an explicit property somewhere?

On Sat, Mar 8, 2014 at 6:23 PM, Robert Schroll notifications@github.comwrote:

Is this really better to do at the application level, rather than the OS level? Are there situations in which you'd want only some apps to adjust to the orientation? How easy is it to lock the orientation via the OS, or is it not possible at all?

A few ideas of how this could work:

  • There could be a lock orientation toggle in one of the settings menu.
  • There could be a lock orientation toggle in the toolbar.
  • The orientation could be locked all the time, but a button to toggle the orientation could be in the toolbar. (This is how my Sony Reader works.)

It'd be nice to detect whether the device was re-orientable; there's no need for these options to show up on the desktop.

— Reply to this email directly or view it on GitHubhttps://github.com/rschroll/beru/issues/38#issuecomment-37105260 .

New Year's Day -- everything is in blossom! I feel about average. -- Kobayashi Issa

rschroll commented 10 years ago

On Sat, Mar 8, 2014 at 1:32 PM, stuartlangridge notifications@github.com wrote:

  1. It is generally more difficult to read books in a landscape environment: it's like reading a book while looking through a letterbox.

I would disable this completely for this reason, but people with poor eyesight may want a large font size, and a landscape view would be the only way to get a reasonable number of words per line.

  1. Ubuntu for phones doesn't currently let you lock at OS level anyway :)

Well, that pretty much settles the issue of where it should go.

I reorient my Sony Reader fairly regularly, but that's to help view PDF files that can't reflow. Landscape view is the only way to see the whole line at a reasonable size. That's not an issue for Beru, so making it nearly permanent should be okay, I think.

Which Pages should this apply to? Definitely the book view, and definitely not the web browser view (since rotating to see a wide webpage could be very useful). But I'm not sure about the book list view.

stuartlangridge commented 10 years ago

I can't think of a good reason to apply it to the book list view, myself! But maybe I'm missing a good use case there...

On Sat, Mar 8, 2014 at 6:48 PM, Robert Schroll notifications@github.comwrote:

On Sat, Mar 8, 2014 at 1:32 PM, stuartlangridge notifications@github.com wrote:

  1. It is generally more difficult to read books in a landscape environment: it's like reading a book while looking through a letterbox.

I would disable this completely for this reason, but people with poor eyesight may want a large font size, and a landscape view would be the only way to get a reasonable number of words per line.

  1. Ubuntu for phones doesn't currently let you lock at OS level anyway :)

Well, that pretty much settles the issue of where it should go.

I reorient my Sony Reader fairly regularly, but that's to help view PDF files that can't reflow. Landscape view is the only way to see the whole line at a reasonable size. That's not an issue for Beru, so making it nearly permanent should be okay, I think.

Which Pages should this apply to? Definitely the book view, and definitely not the web browser view (since rotating to see a wide webpage could be very useful). But I'm not sure about the book list view.

— Reply to this email directly or view it on GitHubhttps://github.com/rschroll/beru/issues/38#issuecomment-37105938 .

New Year's Day -- everything is in blossom! I feel about average. -- Kobayashi Issa

stuartlangridge commented 10 years ago

I just thought, hey, I'll just do this and submit a patch; it's just a toggle switch, a thing to save it to settings, and making MainView.automaticOrientation be the value of the toggle switch. But I didn't, for two reasons: the first is that the global settings dialog is not actually a global settings dialog, it's a global set-the-book-folder dialog and would need a bit more restructuring than just "add a toggle switch and label to it", and the second is that global settings are in sqlite and I don't know if you plan to move them away from sqlite or not...

rschroll commented 10 years ago

Yeah, it's the UI that's blocking me on this. On the one hand, it's a global setting, so it should go in the (restructured) global settings dialog. But if it's only going to affect the book view, it'd be odd for it to be on the library view. It can't go in the book settings, though, since those are all per-book. Right now, I'm leaning towards a toolbar button that will toggle the orientation lock, but that's no particularly extensible, should we discover another similar setting.

Unless there's a good reason to move away from the sqlite storage, I'll leave it as-is. It seems to be working.

stuartlangridge commented 10 years ago

Yeah, maybe a toolbar button; has the advantage of being easy to do because it's just a button which flips a u1db content boolean and that controls lockOrientation or whatever it's called, and also makes it easy for people who want to go back and forth between locked and not (you normally want it locked but occasionally read a PDF). No worries on sqlite; makes sense.

On Wed, Mar 12, 2014 at 6:52 PM, Robert Schroll notifications@github.comwrote:

Yeah, it's the UI that's blocking me on this. On the one hand, it's a global setting, so it should go in the (restructured) global settings dialog. But if it's only going to affect the book view, it'd be odd for it to be on the library view. It can't go in the book settings, though, since those are all per-book. Right now, I'm leaning towards a toolbar button that will toggle the orientation lock, but that's no particularly extensible, should we discover another similar setting.

Unless there's a good reason to move away from the sqlite storage, I'll leave it as-is. It seems to be working.

— Reply to this email directly or view it on GitHubhttps://github.com/rschroll/beru/issues/38#issuecomment-37448886 .

New Year's Day -- everything is in blossom! I feel about average. -- Kobayashi Issa

rschroll commented 10 years ago

Another idea: What if the orientation was locked for the book screen. It can change when you're selecting books, but whatever it is when you open a book sticks. Want to change that? Go back to the library, rotate the screen, then open the book again.

This may be slightly less convenient, but it gets rid of a setting and avoids another bit of state. This may make it easier for the user to understand what's happening.

stuartlangridge commented 10 years ago

That's quite a sneaky idea. I like it!

On 4 July 2014 03:17, Robert Schroll notifications@github.com wrote:

Another idea: What if the orientation was locked for the book screen. It can change when you're selecting books, but whatever it is when you open a book sticks. Want to change that? Go back to the library, rotate the screen, then open the book again.

This may be slightly less convenient, but it gets rid of a setting and avoids another bit of state. This may make it easier for the user to understand what's happening.

— Reply to this email directly or view it on GitHub https://github.com/rschroll/beru/issues/38#issuecomment-48003158.

New Year's Day -- everything is in blossom! I feel about average. -- Kobayashi Issa

rschroll commented 10 years ago

Can you try adding to the onVisibleChanged handler of BookPage.qml the line mainView.automaticOrientation = !visible I hope that will be enough to lock in the current orientation, but I'm not sure and can't test.

randy-jr-olive commented 10 years ago

setting automatic orientation to false (any bool value other than true) automatically forces the mainView into the default portait mode. I can get it to lock into portrait mode from the bookPage, but locking into landscape auto rotates back to portrait on auto orient = false. I'll keep looking, I'm trying to detect the orientation and then force the bookPage to keep that orientation.

randy-jr-olive commented 10 years ago

http://askubuntu.com/questions/516947/how-to-lock-ubuntu-device-orientation-in-portrait-or-landscape-from-user-input

rschroll commented 10 years ago

Yeah, that would have been too easy. Don't feel you have to work on this if it's not interesting to you -- I just wanted to make sure we weren't missing an easy solution. (But if this is interesting, have at it!)

randy-jr-olive commented 10 years ago

This feature is being made available at the OS level, through the system settings and through an indicator (planned). Is this a sufficient solution to this issue?

rschroll commented 10 years ago

As Stuart argued, it'd be nice to set this at the application level. But if there's no API to do it currently, we'll just have to wait until it appears.

rschroll commented 10 years ago

I've gotten confirmation that there's no way to do this yet, but it's on the roadmap.

An additional wrinkle is that the bottom edge is broken when the screen is rotated -- Unity still controls this because it thinks its a side edge. So I'm thinking we should just disable rotation completely right now.

randy-jr-olive commented 10 years ago

I think that could work, at least until the UI gets settled on where everything goes on a rotate. There was a setting to lock orientation for a page, hopefully it's not disabled now.

randy-jr-olive commented 9 years ago

a related launchpad bug that discusses the implementation of an API for app rotation: https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1413121 app level control of the orientation should be possible soon