eliranwong / UniqueBible

A cross-platform bible application, integrated with high-quality resources and amazing features, running offline in Windows, macOS and Linux, ChromeOS, Android, iOS. Various running modes are supported.
https://UniqueBible.app
GNU General Public License v3.0
127 stars 35 forks source link

Add verse highlighting #49

Closed otseng closed 3 years ago

otseng commented 3 years ago

Add ability to highlight verses.

otseng commented 3 years ago

I'm currently working on this feature now. It will allow highlighting an entire verse and be stored in a separate database so all Bibles will also be highlighted.

onegladiator4u commented 3 years ago

Nice. Are you planning on highlighting with one color or more than one colors?

eliranwong commented 3 years ago

I would like to share my approach, which I implemented for one of my old iOS-only app BibleBento.

I simply created an empty database having the same table as bible module.

For example, table Verses is used currently for bible modules. When users highlight a verse, a new record is created having Book, Chapter, Verse, Scripture. In scripture column, instead of placing bible text, I place html color codes.

When highlighting is removed, I simply removed the record having the same book, chapter, and verse no.

Why use the same table format as bible.module, because I am lazy. When I load verses to open a bible chapter, I use the same query statement to check if highlight database have corresponding records for opening verses.

If records are found, I used a pair of tags to wrap those verses to enable coloring.

To save my time, I simply used color templates available in iOS and let users to choose color as they like. Only html color code string is stored.

I think PySide2 has a similar color picker, somehow I came across in the example folder.

Just to share my old way to do this. I believe you are much better than me in programming. Thanks for taking up this task.

Once you decide the database structure for highlighting, I think I will use the same for upcoming hybrid version.

otseng commented 3 years ago

Nice. Are you planning on highlighting with one color or more than one colors?

Right now it has yellow, blue, and underline. It is easy for me to add more.

There are some issues with it, so by default it will be turned off. Once the code is updated, you can enable it with the enableVerseHighlighting flag and play around with it.

More comments about it at: https://github.com/eliranwong/UniqueBible/pull/50

Please report issues and suggestions.