From dabdb99376bbf3a07de5c33d1af1286bc228c17d Mon Sep 17 00:00:00 2001 From: Michael J Gruber Date: Mon, 19 Apr 2021 16:59:27 +0200 Subject: [PATCH] fix settings comments placement The comments for `scrollbarHideType` and for new pages are misplaced in `settings.xml`, for two different reasons: comments arise as nodes attached to the node which they comment on in the tree but are output before the node in a textual representation. Therefore, the code generating the tree can generate a node comment only after the node it comments on (1st reason). The usage of macros hides this fact, so when you circumvent the macros you have to assign the node variable manually, or else the comment will be attached to the wrong node (2nd reason). Fix both. --- src/control/settings/Settings.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/control/settings/Settings.cpp b/src/control/settings/Settings.cpp index da4c6e76..03fe0e91 100644 --- a/src/control/settings/Settings.cpp +++ b/src/control/settings/Settings.cpp @@ -838,19 +838,18 @@ void Settings::save() { WRITE_BOOL_PROP(disableScrollbarFadeout); if (this->scrollbarHideType == SCROLLBAR_HIDE_BOTH) { - saveProperty("scrollbarHideType", "both", root); + xmlNode = saveProperty("scrollbarHideType", "both", root); } else if (this->scrollbarHideType == SCROLLBAR_HIDE_HORIZONTAL) { - saveProperty("scrollbarHideType", "horizontal", root); + xmlNode = saveProperty("scrollbarHideType", "horizontal", root); } else if (this->scrollbarHideType == SCROLLBAR_HIDE_VERTICAL) { - saveProperty("scrollbarHideType", "vertical", root); + xmlNode = saveProperty("scrollbarHideType", "vertical", root); } else { - saveProperty("scrollbarHideType", "none", root); + xmlNode = saveProperty("scrollbarHideType", "none", root); } - - WRITE_BOOL_PROP(autoloadPdfXoj); WRITE_COMMENT( "Hides scroolbars in the main window, allowed values: \"none\", \"horizontal\", \"vertical\", \"both\""); + WRITE_BOOL_PROP(autoloadPdfXoj); WRITE_STRING_PROP(defaultSaveName); WRITE_BOOL_PROP(autosaveEnabled); @@ -887,8 +886,8 @@ void Settings::save() { WRITE_UINT_PROP(preloadPagesAfter); WRITE_BOOL_PROP(eagerPageCleanup); - WRITE_COMMENT("Config for new pages"); WRITE_STRING_PROP(pageTemplate); + WRITE_COMMENT("Config for new pages"); WRITE_STRING_PROP(sizeUnit);