Commit graph

45 commits

Author SHA1 Message Date
jan Iversen
21243ec4f7 core: activate qPrefDivePlanner
remove DivePlanner from SettingsObjectWrapper and reference qPrefDivePlanner

update files using SettingsObjectWrapper/DivePlanner to use qPrefDivePlanner

this activated qPrefDivePlanner and removed the similar class from
SettingsObjectWrapper.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-08 14:29:50 +02:00
jan Iversen
357510b9cd core: create qPrefDivePlanner from SettingsObjectWrapper
Update set/get functions to follow common name scheme:
- get function have same name as in struct diveComputer
- set function have set_<name>
- signal function have <name>_changed

one class one .h/.cpp is the C++ idiom. Having load/sync of each
variable in 1 functions (in contrast to the distributed way
SettingsObjectWrapper handles it) secures the same storage name
is used. Having the set/get/load/sync functions grouped together
makes it easier to get an overview.

REMARK: this commit only defines the class, it is not active in production

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-08 14:29:50 +02:00
jan Iversen
334099951a core: qPref add STRUCT macro
In order to solve use of e.g. depth_t a new macro is added

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-08 14:29:50 +02:00
jan Iversen
264aa883b2 core: qPref, remove inline and ; for inline functions
Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-02 13:31:08 -07:00
jan Iversen
affdc9d394 core: activate qPrefUnits
remove Units from SettingsObjectWrapper and reference qPrefUnits

update files using SettingsObjectWrapper/Units to use qPrefUnits

this activated qPrefUnits and removed the similar class from
SettingsObjectWrapper.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-02 08:59:56 -07:00
jan Iversen
54335e1ec6 core: create qPrefUnit from SettingsObjectWrapper
Update set/get functions to follow common name scheme:
- get function have same name as in struct diveComputer
- set function have set_<name>
- signal function have <name>_changed

one class one .h/.cpp is the C++ idiom. Having load/sync of each
variable in 1 functions (in contrast to the distributed way
SettingsObjectWrapper handles it) secures the same storage name
is used. Having the set/get/load/sync functions grouped together
makes it easier to get an overview.

REMARK: this commit only defines the class, it is not active in production

Signed-off-by: Jan Iversen <jani@apache.org>
2018-08-02 08:59:56 -07:00
jan Iversen
181d2cf364 core: activate qPrefProxy
remove Proxy from SettingsObjectWrapper and reference qPrefProxy

update files using SettingsObjectWrapper/Proxy to use qPrefProxy

this activated qPrefProxy and removed the similar class from
SettingsObjectWrapper.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30 07:43:22 -07:00
jan Iversen
f4f798f8dd core: create qPrefProxy from SettingsObjectWrapper
Update set/get functions to follow common name scheme:
- get function have same name as in struct prefs
- set function have set_<name>
- signal function have <name>_changed

one class one .h/.cpp is the C++ idiom. Having load/sync of each
variable in 1 functions (in contrast to the distributed way
SettingsObjectWrapper handles it) secures the same storage name
is used. Having the set/get/load/sync functions grouped together
makes it easier to get an overview.

REMARK: this commit only defines the class, it is not active in production

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30 07:43:22 -07:00
jan Iversen
311b2672da core: qPrefPrivate.h added HANDLE_PREFERENCE_INT_DEF_EXT
Add missing type macro, needed for qPrefProxy

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-30 07:43:22 -07:00
jan Iversen
e0f1817fdc core: create qPrefFacebook from SettingsObjectWrapper
Update set/get functions to follow common name scheme:
- get function have same name as in struct diveComputer
- set function have set_<name>
- signal function have <name>_changed

one class one .h/.cpp is the C++ idiom. Having load/sync of each
variable in 1 functions (in contrast to the distributed way
SettingsObjectWrapper handles it) secures the same storage name
is used. Having the set/get/load/sync functions grouped together
makes it easier to get an overview.

REMARK: this commit only defines the class, it is not active in production

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-27 12:36:20 -07:00
jan Iversen
037ee9994d core: fix qPrefCloudStorage to derive git_url
remove set_git_url and git_url_changed, because it is not possible
to set git_url, this is done inderectly through set_base_url

Update disk_base_url to generated git_url for both load/sync

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-27 12:23:09 -07:00
Dirk Hohndel
128fc5f4b8 Whitespace cleanup core/settings
We can argue about any of the changes here, but they are the result of our
whitespace.pl script - so if any of this is offensive to you, part of the
resolution will be fixing the script...

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-07-26 16:32:51 +03:00
jan Iversen
19871a6ab2 core: qPrefCloudStorage save userid to new location
userid was saved outside all groups, even though it belongs to cloudStorage

Add code to save in new location and read from new/old location

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
3d6848b22c core: activate qPrefDiveComputer
remove DiveComputer from SettingsObjectWrapper and reference qPrefDiveComputer

update files using SettingsObjectWrapper/DiveComputer to use qPrefDiveComputer

this activated qPrefDiveComputer and removed the similar class from
SettingsObjectWrapper.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
98820cf970 core: update qPrefDisplay to new consensus
add inline to load/sync
remove const from QString getters

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
8cfe048150 core: update qPrefCloudStorage to new consensus
make load/sync inline
remove const from QString getters

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
5f3471bf86 core: make load/sync inline in qPref
Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
254ba61fd9 core: make load/sync inline in qPrefAnimations
Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
0002cd2d20 core: create qPrefDiveComputer from SettingsObjectWrapper
Update set/get functions to follow common name scheme:
- get function have same name as in struct diveComputer
- set function have set_<name>
- signal function have <name>_changed

one class one .h/.cpp is the C++ idiom. Having load/sync of each
variable in 1 functions (in contrast to the distributed way
SettingsObjectWrapper handles it) secures the same storage name
is used. Having the set/get/load/sync functions grouped together
makes it easier to get an overview.

REMARK: this commit only defines the class, it is not active in production

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
69c7ed676a core: add qPrefAnimations to SettingsObjectWrapper/qPref load
correct missng qPrefAnimations in global load functions

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
ead05c8e17 core: expand qPref macros to handle sub structure
Expand SET_, DISK_ and HANDLE_ macros with field for substructure

Structure prefs contains e.g. prefs.dive_computer.vendor an extra field
are added to the macros to allow this.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
92ade62260 core: remove LOADSYNC* macros
expend LOADSYNC* into DISK_* macros
remove LOADSYNC* from qPrefPrivate.h
update qPrefDisplay to not use LOADSYNC*

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
3eae683b57 core: make qPrefAnimations/CloudStorage getters static and inline
Add static and inline to getter in all qPref header files
Remove call to GET_PREFERENCE_* in qPrefDisplay.cpp
Remove GET_PREFERENCE_* from qPrefPrivate.h

static inline is slightly faster than a function call, but it saves
a lot of coding lines (no lines in qPref*.cpp). Getters are a direct
reference to struct preferences, so they will normally only be used
from QML.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
87d8963c78 core: make qPrefDisplay getters static and inline
Add static and inline to getter in all qPref header files
Remove call to GET_PREFERENCE_* in qPrefDisplay.cpp

static inline is slightly faster than a function call, but it saves
a lot of coding lines (no lines in qPref*.cpp). Getters are a direct
reference to struct preferences, so they will normally only be used
from QML.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
7f4123d0d1 core: isolate qPrefPrivate to qPref* classes
Make functions in qPrefPrivate private and add
qPref* as friends

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
f1648d297b core: qPref replace COPY_TXT with copy_txt in qPrefPrivate
Add copy_txt function to qPrefPrivate class
Remove macro COPY_TXT from qPrefPrivate.h
Replace use of COPY_TXT with copy_txt in qPref classes

copy_txt is only once, COPY_TXT was expanded approx. 160 times, so
this commit saves space (and removes a macro).

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-25 08:35:04 -07:00
jan Iversen
b9b1f03f0d core: activate qPrefCloudStorage
remove CloudStorage from SettingsObjectWrapper and reference qPrefCloudStorage

update files using SettingsObjectWrapper/CloudStorage to use qPrefCloudStorage

this activated qPrefCloudStorage and removed the similar class from
SettingsObjectWrapper.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-21 07:49:25 -07:00
jan Iversen
4b68329c9d core: create qPrefCloudStorage from SettingsObjectWrapper
Update set/get functions to follow common name scheme:
- get function have same name as in struct preferences
- set function have set_<name> (from struct preferences>)
- signal function have <name>_changed (from struct preferences>)

one class one .h/.cpp is the C++ idiom. Having load/sync of each
variable in 1 functions (in contrast to the distributed way SettingsObjectWrapper
handles it) secures the same storage name is used. Having the set/get/load/sync
functions grouped together makes it easier to get an overview.

REMARK: this commit only defines the class, it is not active in production
Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-21 07:49:25 -07:00
jan Iversen
3c3729711c core: remove QSettings in qPref* and use a shared variable
Add qPrefPrivate class which contains one QSettings variable,
delete QSettings from qPref* class definitions

this secures there are only instance of QSettings
(QSettings needs to be in a QObject class to work)

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-18 10:40:08 -07:00
jan Iversen
c0e9e978a1 core: remove include QSettings from QPref
remove QSettings header file from qPref.h (which is included in many files)
to isolate the use of QSettings in the total system.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-18 10:40:08 -07:00
jan Iversen
80761beb93 core: solve copy/paste error in qPref_private
DISK_LOADSYNC_INT used double correct to int

DISK_LOADSYNC_INT used double correct to int

Signed-off-by: Jan Iversen <jani@apache.org>Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-15 14:35:31 +02:00
jan Iversen
8d857a650d core: qPrefDisplay correct font setting.
SettingsObjectWrapper contained some delicate font handling mixing font and
font_size, breaking that into 2 parts broke font handling on some platforms

Copy font + font_size handling 1-1 from SettingsObjectWrapper

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-15 14:35:31 +02:00
jan Iversen
3a314c3dec core: copy Animations from SettingsObjectWrapper to qPref as its own class
Update set/get functions to follow common name scheme:
- get function have same name as in struct preferences
- set function have set_<name in struct preferences>
- signal function have <name in struct preferences>_changed

one class one .h/.cpp is the C++ idiom. Having load/sync of each
variable in 1 functions (in contrast to the distributed way SettingsObjectWrapper
handles it) secures the same storage name is used. Having the set/get/load/sync
functions grouped together makes it easier to get an overview.

REMARK: this commit only defines the class, it is not active in production
Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-12 19:07:49 +02:00
jan Iversen
928fc1ee79 core: move load of display variables to qPrefDisplay from SettingsObjectWrapper
ensure SettingsObjectWrapper load() loads all display variables.

Copy font setting code from SettingsObjectWrapper to qPrefDisplay

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-12 18:44:31 +02:00
jan Iversen
da61c1714f core: activate qPrefDisplay in SettingsObjectWrapper
add the prepared class qPrefDisplay to SettingsObjectWrapper and thereby making it active.

As a consequence of the uniform naming standard desktop-widgets/preferences_defaults.cpp and
tests/testpreferences.cpp have been updated.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-12 18:44:31 +02:00
jan Iversen
4a4bc1c8f3 core: add version variables to qPref and make it qml loadable
add canonical_version and mobile_version to qPref

Having a property in qPref, allows the use in qml, and prepare the
interface for qml testing.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-10 10:30:50 -07:00
jan Iversen
8d66633fe7 core: make qPref::cloud_status the only version of the enum
add enum to qPref and remove elsewhere
update source core to reference qPref.

the enum cannot be in pref.h because it is to be used in qml and Q_ENUM
need the enum to be defined as part of the class

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-10 10:30:50 -07:00
jan Iversen
516e3421b1 core: update qPrefDisplay.cpp to use all qPref macros.
change qPrefDisplay.cpp to use qPref_private macros, for each variable. The macros
used depend on how standard the variable is handled.

Remark: this commit is production code, but qPrefDisplay is NOT integrated into
SettingsObjectWrapper and thus not active in the live system

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-07 09:44:06 -07:00
jan Iversen
2971984687 core: add macros to handle get/set/loadsync functions
Add macros to handle get/set/loadsync function set functions in qPref

These macros are only convinience functions to write less for all those
variables who are traited standardized.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-07 09:44:06 -07:00
jan Iversen
e3767fdc43 core: add macros to handle setter functions
Add macros to handle full function set functions in qPref

Remark: the function name is fixed to be "set_<name>" where name is
identical to the variable in struct preferences

This is not our standard naming, but is consistent with struct
preferences (that also use different name schemes).

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-07 09:44:06 -07:00
jan Iversen
7ee1aab728 core: add macros to replace getter functions
Add macros to handle full getter functions

Remark: it is assumed the name of getter function is identical to
the name in struct preferences.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-07 09:44:06 -07:00
jan Iversen
ce358fdb68 core: qPref private add macros to replace disk* functions
Use a private QSettings variable, instead of declaring it each time

Add macros to handle full disk* functions

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-07 09:44:06 -07:00
jan Iversen
e5dace2233 core: copy Display from SettingsObjectWrapper to qPref as its own class
copy Display from SettingsObjectWrapper to qPref as its own class
file. Update Display to use a common load/sync scheme.

Update set/get functions to follow common name scheme:
- get function have same name as in struct preferences
- set function have set_<name in struct preferences>
- signal function have <name in struct preferences>_changed

one class one .h/.cpp is the C++ idiom. Having load/sync of each
variable in 1 functions (in contrast to the distributed way SettingsObjectWrapper
handles it) secures the same storage name is used. Having the set/get/load/sync
functions grouped together makes it easier to get an overview.

REMARK: this commit are made to show the use of the low level LOADSYNC macros, which will
be used for special cases. This class is NOT linked into the live system.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-07 09:44:06 -07:00
jan Iversen
2f95141330 core: remove double definition of enum cloud_storage_status
Remove cloud_storage_status from qmlprefs.h.
usage to qPref::

enum cloud_storage_status is not used from C, but only from C++, and
having the same structure defined multiple times is a maintenance
challenge.

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-04 05:32:30 +08:00
jan Iversen
d02a03983d core: add qPref.h_and qPrefprivate.h
add 2 header files and 1 cpp file (qPrefPrivate does not have an implementation)

The rewrite/consoliadation of SettingsObjectWrapper, qmlmanager, qmlpref and planner
needs a place to put common private parts (qPrefPrivate) and 1 common class (qPref).

Signed-off-by: Jan Iversen <jani@apache.org>
2018-07-04 05:32:30 +08:00