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

Add progress indicator #85

Open mivoligo opened 9 years ago

mivoligo commented 9 years ago

I like Beru and use it daily on bq phone. One feature I miss from FBReader is the indication where I am in the book at the moment. I have no idea how many pages are still left to read. Below is a link to the screenshot from FBReader. You can see it has the "progress bar" at the bottom of the page. You can also notice there are indications for chapters there. Not sure if it's possible to do in Beru but it'd be a great addition at least for me. :)

https://lh3.ggpht.com/aYkU3ftW0Iovbpr1P_yNxl0tXQ_Joci7ZlRpbHlPecTkA68xICwGro0n-AgnfwqCwg=h900

rschroll commented 9 years ago

It's certainly possible, but it takes a certain amount of guesswork.

The basic problem is getting a page count for the whole book. Monocle, the library I'm using here, doesn't give you that because it only lays out individual components as needed. This is a sensible choice from a performance standpoint, but means we can't say we're on page 137 of 241, for example.

I'm not convinced that we need that specificity, though. We do have a percentage for the current component, and we can estimate the relative sizes of the other components from their file sizes, so we can pretty accurately say you're about 57% of the way through the book.

We do have an accurate page count for the current component, which often, but not always, corresponds to the chapter. So we can say you're on page 8 of 12 of the component, which is useful if you're trying to figure out whether you can finish the current chapter before $activity. But the chapter-component correspondence is not guaranteed, so I'm a bit hesitant to put this in without having some sort of sanity checking.

These issues are discussed further in #40 and #77, in slightly different contexts.