From d159a8be947547c5c48c6c5083abdbca8a22ddac Mon Sep 17 00:00:00 2001 From: ispyisail Date: Fri, 9 Oct 2026 22:09:28 +1300 Subject: [PATCH] Settings files: leave out dialog sizes, trackpad gestures with controls - Dialog sizes and positions (dialoggeometry/...) describe this computer, like the other window layout keys: no longer saved to a settings file, and kept when one is loaded. - The trackpad gestures setting (diagramview/gestures) is in the part for toolbars, shortcuts and gestures rather than all other settings. - Loading only the defaults for new projects now says it is done. Co-Authored-By: Claude Opus 5.5 --- sources/qetapp.cpp | 7 ++++++- sources/utils/configprofile.h | 10 ++++++---- tests/qttest/tst_configprofile.cpp | 4 ++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/sources/qetapp.cpp b/sources/qetapp.cpp index 2699abc14..9fddcead5 100644 --- a/sources/qetapp.cpp +++ b/sources/qetapp.cpp @@ -2305,7 +2305,7 @@ QString partLabel(ConfigProfile::Part part) { switch (part) { case ConfigProfile::Part::Controls: - return QETApp::tr("Toolbars, keyboard shortcuts and mouse gestures"); + return QETApp::tr("Toolbars, keyboard shortcuts, mouse and trackpad gestures"); case ConfigProfile::Part::NewProject: return QETApp::tr("Defaults for new projects: folio, title block, " "wires, numbering"); @@ -2505,6 +2505,11 @@ void QETApp::importConfiguration() if (!restart) { QSettings live_settings; ConfigProfile::importFrom(file_settings, live_settings); + QET::QetMessageBox::information( + parent_widget, + tr("Load settings", "message box title"), + tr("The settings are loaded. They are used for the next " + "new project.")); return; } diff --git a/sources/utils/configprofile.h b/sources/utils/configprofile.h index b7e2a8cac..93d08b4b7 100644 --- a/sources/utils/configprofile.h +++ b/sources/utils/configprofile.h @@ -29,8 +29,8 @@ Two kinds of keys stay out of a profile, because they describe this computer rather than how the user wants QElectroTech to behave: window - sizes, positions and dock layouts (".../geometry", ".../state"), and - the recent-files lists ("...-recentfiles/..."). They are not written to + sizes, positions and dock layouts (".../geometry", ".../state", + "dialoggeometry/..."), and the recent-files lists ("...-recentfiles/..."). They are not written to the file, and loading a profile keeps the current ones. A file can hold every other setting (a complete profile), or only some @@ -52,7 +52,7 @@ namespace ConfigProfile /// The parts the settings are split into. enum class Part { - Controls, ///< toolbars, keyboard shortcuts, shortcut bar, mouse gestures + Controls, ///< toolbars, keyboard shortcuts, shortcut bar, mouse and trackpad gestures NewProject, ///< defaults for new projects: folio, title block, wires, numbering... Other, ///< everything else: appearance, grid, language... Folders ///< folders of the collections, title blocks and macros @@ -71,6 +71,7 @@ namespace ConfigProfile { return key.endsWith(QLatin1String("/geometry")) || key.endsWith(QLatin1String("/state")) + || key.startsWith(QLatin1String("dialoggeometry/")) || key.contains(QLatin1String("-recentfiles/")) || key == marker_key || key == parts_key; @@ -88,7 +89,8 @@ namespace ConfigProfile QStringLiteral("diagrameditor/shortcut_bar/"), QStringLiteral("diagrameditor/gestures/"), QStringLiteral("diagrameditor/mouse_gestures"), - QStringLiteral("diagrameditor/context_toolbar")}; + QStringLiteral("diagrameditor/context_toolbar"), + QStringLiteral("diagramview/gestures")}; static const QStringList new_project{ //BorderProperties, TitleBlockProperties, ConductorProperties, //report, cross-reference and guide defaults all start so diff --git a/tests/qttest/tst_configprofile.cpp b/tests/qttest/tst_configprofile.cpp index ce0535815..73d871348 100644 --- a/tests/qttest/tst_configprofile.cpp +++ b/tests/qttest/tst_configprofile.cpp @@ -18,6 +18,7 @@ private slots: QVERIFY(ConfigProfile::isLocalKey("diagrameditor/geometry")); QVERIFY(ConfigProfile::isLocalKey("elementeditor/state")); QVERIFY(ConfigProfile::isLocalKey("projects-recentfiles/file1")); + QVERIFY(ConfigProfile::isLocalKey("dialoggeometry/ConfigDialog")); QVERIFY(ConfigProfile::isLocalKey(ConfigProfile::marker_key)); QVERIFY(!ConfigProfile::isLocalKey("diagrameditor/Xgrid")); QVERIFY(!ConfigProfile::isLocalKey("shortcuts/mainwindow.fullscreen")); @@ -32,6 +33,7 @@ private slots: live.setValue("lang", "de"); live.setValue("diagrameditor/geometry", QByteArray("xyz")); live.setValue("projects-recentfiles/file1", "/home/a/b.qet"); + live.setValue("dialoggeometry/ConfigDialog", QByteArray("xyz")); QSettings file(path("profile1.conf"), QSettings::IniFormat); QCOMPARE(ConfigProfile::exportTo(live, file), 2); @@ -39,6 +41,7 @@ private slots: QCOMPARE(file.value("diagrameditor/Xgrid").toInt(), 7); QVERIFY(!file.contains("diagrameditor/geometry")); QVERIFY(!file.contains("projects-recentfiles/file1")); + QVERIFY(!file.contains("dialoggeometry/ConfigDialog")); } // Import replaces every setting, removes the ones the profile does not @@ -100,6 +103,7 @@ private slots: QCOMPARE(ConfigProfile::partOf("diagrameditor/gestures/directions"), P::Controls); QCOMPARE(ConfigProfile::partOf("diagrameditor/mouse_gestures"), P::Controls); QCOMPARE(ConfigProfile::partOf("diagrameditor/context_toolbar"), P::Controls); + QCOMPARE(ConfigProfile::partOf("diagramview/gestures"), P::Controls); QCOMPARE(ConfigProfile::partOf("diagrameditor/defaultconductortype"), P::NewProject); QCOMPARE(ConfigProfile::partOf("diagrameditor/defaultreportlabel"), P::NewProject);