View Single Post
Old 07-19-2014, 05:32 PM   #41
user_none
Sigil & calibre developer
user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.user_none ought to be getting tired of karma fortunes by now.
 
user_none's Avatar
 
Posts: 2,488
Karma: 1063785
Join Date: Jan 2009
Location: Florida, USA
Device: Nook STR
Quote:
Originally Posted by KevinH View Post
Would the best example I could learn from and follow along in the current code be the use of Tidy/Pretty Print in Preferences? Those preferences are accessed in the CleanUp code now I think so would using that as an example to follow be best? Or do you recommend I use something else as a template/example to follow.
Sigil has a settings store which is a subclass of QSettings. First you'll want to add a getter and setter for any settings you're adding. Default values as well if it was never set explicitly via preferences.

A QList of std:air of QChar and QString might be a better way to go since this will always be iterated. This way you don't have to to worry about tracking two variables.
Code:
QList<std::pair <QChar, QString> >
Once you have the SettingsStore entity addition in place you'll need a preference widget. The implementation is in src/Sigil/Dialogs/PreferenceWidgets and the .ui files are in src/Sigil/Form_Files. The convention for the .ui is "PName.ui"

The CleanSourceWidget.cpp is a good example to start with. You need to implement the readSettings and saveSettings functions. As you can see read gets the data from the SettingsStore and set that data into the widget. Save takes the data from the widget and save it in the SettingsStore.

One way you could do the UI is have a user modifiable list where they can add and remove entries. See the SpellCheckWidget for an example of this. I'm not saying do this but you could have two columns. First column is the numeric value of the caracter Since some characters are printable) and the second column is the text the user wants to use. Then you can convert the numeric value into a character for saving into the settings. Reading it back out you'd convert from the char into the number and put that into the list.

Quote:
Originally Posted by KevinH View Post
Sorry to partially drag you back into this, but it has been a few years since I've seen this code and lots and lots of changes and improvements have been made since then. So a few hints would certainly help!!!
No worries. I have no problem helping someone who want to enhance Sigil. I'm just not interested in doing it myself.
user_none is offline   Reply With Quote