mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-09 13:34:14 +02:00
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 <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user