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 chapter title and page number info to the book page #40

Open iBelieve opened 10 years ago

iBelieve commented 10 years ago

Something that I liked about iBooks that gave it some polish was displaying the book name and page number info on the book page. So, I've done the same (though using chapter title instead).

rschroll commented 10 years ago

Thanks for the patch. One thing I've wanted is some progress indicator, so it's good to see a page count.

That said, I have some concerns about this approach:

First, the title and page count should look like they're part of the page. But because they're done in QML, they don't get the font, color, or background of the page. While we could imitate this with QML, it seems like it'd be easier to do in HTML. Monocle does have the capacity to add information to each page. (See http://monocle.inventivelabs.com.au/books/dubliners for an example.)

Along these lines, we'd need to figure out how these would interact with the margins. Note that the lower margin should be twice the upper one; the current layout doesn't respect that.

I'm not sold on putting the chapter title at the top of each page.
Part of that could be that lots of my books have chapter titles like "Chapter Four", which isn't so interesting to see. Besides, the current chapter is highlighted in the chapter list, so it's not difficult to find out that.

In a little bit of testing, I've noticed that the total page count jumps around quite a bit on chapter changes. I haven't really understood the code yet, but it seems to be estimating the total number of pages based on a ratio from the current chapter. Why do it this way? Why not to a more careful calculation when the book is opened?
If it's expensive, it could be moved into the cover calculation and stored in the database.

But before we do that, two other ideas:

I'm also going to comment on some of the code inline. This is just to alert you to the type of things I'm pedantic about. Don't worry about fixing them yet. Let's get a plan of action before putting more code down.

rschroll commented 10 years ago

After some more thought -- this could be something that depends of screen size. On a phone, you probably don't want anything other than text on the page. But on a tablet, you can't (comfortably) fill up the whole screen with text, so we can add these bits to take up some of the room.

Already, we're adjusting the margins to account for this. The left and right margins will grow to keep the width of the text block, in characters, about constant. For the first bit, the top and bottom margins grown in proportion. But these are capped at some value (5 and 10%, I think; the bottom is always twice the top). Past that point, we could add in a header and/or footer.

Are you interested in working on this further?

iBelieve commented 10 years ago

Sorry for the delay - here are my responses to your comments:

iBelieve commented 10 years ago

On the phone, you could use the new bottom-edge gesture to bring up the slider to move around in the book, and then on further dragging up, bring up the table of contents. But normally the title and percent could be hidden by default.

rschroll commented 10 years ago

I wanted this to percolate in my mind for a bit, but then I forgot about it. Sorry.

Here are my current thoughts:

Let me know if this seems reasonable and if I can help point you in the right direction on implementation.