first steps to a fully semi-automated settings system

Tomaz Canabrava tcanabrava at kde.org
Mon Jan 25 12:37:34 PST 2016


and I think I need to clarify something,
if we didn't had the prefs.h, I could have made a QObjectification of the
settings there is much, much smaller than the one I did right now (around
1.6k LOC) because for each variable of the prefs struct ( and it's
substructs ) I needed to do:

a Q_PROPERTY (type name READ name WRITE setName SIGNAL nameChanged)
for that specific property
a getter that is mostly an one liner, return prefs.something;
a setter that creates a QSettings, updates it, and also updates the prefs
variable and emits the changed signal
a signal to be emitted

if we didn't had the prefs struct (or if it was a C++ class instead of a C
Struct) I only needed to do the Q_PROPERTY (type name MEMBER var_name)

so - maybe it's something to consider in the far - far - far future?

either way, Here is the usage of the 1.6k LOC monster for the toolbar
buttons that trigger the replot of the profile: (it already helped to
simplify the handling of it, yey)
I'm not pretty sure that this is bug free, but I tested this together with
master so there isn't any obvious bugs.

Tomaz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160125/2e8434db/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Start-to-use-the-QSettings-ObjectWrapper.patch
Type: text/x-patch
Size: 17893 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160125/2e8434db/attachment-0006.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Changed-quite-a-few-shorts-to-bool-on-the-c-implemen.patch
Type: text/x-patch
Size: 25077 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160125/2e8434db/attachment-0007.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-More-Profile-Itens-on-the-new-Settings.patch
Type: text/x-patch
Size: 7377 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160125/2e8434db/attachment-0008.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Fix-Display-Hide-Calculated-Ceiling.patch
Type: text/x-patch
Size: 1074 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160125/2e8434db/attachment-0009.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Fix-Ceiling-Graph.patch
Type: text/x-patch
Size: 1965 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160125/2e8434db/attachment-0010.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Fix-bug-on-the-visibility-of-the-Ruler-Graph.patch
Type: text/x-patch
Size: 3269 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20160125/2e8434db/attachment-0011.bin>


More information about the subsurface mailing list