New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor settings #5273
base: master
Are you sure you want to change the base?
Refactor settings #5273
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are a couple of comments. Mainly use SFINAO to default most members of the Setting<> specializations.
Also, there are quite a bit of clang-format changes in parts that you did not edit. Could you please remove those changes? They clutter the diff making the reviewing process more complicated and increase the number of conflicts you'll get if you ever need to rebase on a more up to date master branch.
Running git clang-format
(as opposed to asking your IDE to apply clang-format) does exactly that: only apply clang-format to the chunks you modified.
Thanks for your comments, I'll incorporate them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a lot of work! Thanks!!
Here is a partial review. I'll come back for more (but that's a lot to review).
One question: shouldn't SElement be modified to have the same structure as the main Settings class (i.e. not being a std::map but rathen a template)?
I considered doing this, but I ultimately decided not to, as I think it would be better to rework those settings and give them their own, unique type. For example But I would rather do this in another PR as this one is already really big, and reworking those settings would create a lot of changes in additional files. For this PR I would keep the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are some more comments.
Overall, I'm a bit confused about various declarations/definitions. For instance, the importProperty/exportProperty specializations feels misplaced. There are two kinds of such: "generic" specializations, e.g. importProperty, that are used by numerous settings and whose location is alright, and very specific specializations (e.g. importProperty(xmlNodePtr node, std::map<std::string, std::pair<InputDeviceTypeOption, GdkInputSource>>& var)
) which should go directly as IMPORT_FN of the corresponding setting.
TBH, I'm a bit confused at the moment as to why it compiles and links properly while those importProperty<> specializations are only defined in the .cpp file but used in other units.
In addition:
- There are a couple of
where braces should be added, to match our coding conventions.
if (foo) bar()
- There are some C-style casts which should be replaced with static_cast.
Thanks for the review, I have now addressed all of the points you mentioned.
|
@superenginegit Can you please rebase on current master and solve the merge conflicts, so we can see if there are any (new) warnings on different platforms? |
added descriptions for settings added needed import/export functions added code that handles the new settings adjusted some existing functions and classes in order to work with the new code
core/plugin/luapi_application.h modified to receive const XojFont&
Co-authored-by: Benjamin Hennion <17818041+bhennion@users.noreply.github.com>
This reverts commit cde8f98.
Use getter_return_t to replace Setting::getter_return_type
Importer struct replaces most IMPORT_FN elements in Settings that use the default importer for their type
Exporter struct replaces type default EXPORT_FN definitions
2f9428e
to
7be20df
Compare
The clang format should be fixed. I have found the following warning (just one), that should be fixed, too:
|
@bhennion What do you think about the current status of this? Would you like to see any more changes? |
Sorry for the delay. To be perfectly candid, I've been wondering whether this simplifies maintainability or not. It seems to me that we still need to edit in a lot of places to e.g. add a new setting. |
This PR is for issue #5201.
What I have done so far:
What I think could still be done:
I'd appreciate any feedback on this