mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-17 19:34:13 +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) {
|
switch (part) {
|
||||||
case ConfigProfile::Part::Controls:
|
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:
|
case ConfigProfile::Part::NewProject:
|
||||||
return QETApp::tr("Defaults for new projects: folio, title block, "
|
return QETApp::tr("Defaults for new projects: folio, title block, "
|
||||||
"wires, numbering");
|
"wires, numbering");
|
||||||
@@ -2505,6 +2505,11 @@ void QETApp::importConfiguration()
|
|||||||
if (!restart) {
|
if (!restart) {
|
||||||
QSettings live_settings;
|
QSettings live_settings;
|
||||||
ConfigProfile::importFrom(file_settings, 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
|
|
||||||
Two kinds of keys stay out of a profile, because they describe this
|
Two kinds of keys stay out of a profile, because they describe this
|
||||||
computer rather than how the user wants QElectroTech to behave: window
|
computer rather than how the user wants QElectroTech to behave: window
|
||||||
sizes, positions and dock layouts (".../geometry", ".../state"), and
|
sizes, positions and dock layouts (".../geometry", ".../state",
|
||||||
the recent-files lists ("...-recentfiles/..."). They are not written to
|
"dialoggeometry/..."), and the recent-files lists ("...-recentfiles/..."). They are not written to
|
||||||
the file, and loading a profile keeps the current ones.
|
the file, and loading a profile keeps the current ones.
|
||||||
|
|
||||||
A file can hold every other setting (a complete profile), or only some
|
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.
|
/// The parts the settings are split into.
|
||||||
enum class Part {
|
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...
|
NewProject, ///< defaults for new projects: folio, title block, wires, numbering...
|
||||||
Other, ///< everything else: appearance, grid, language...
|
Other, ///< everything else: appearance, grid, language...
|
||||||
Folders ///< folders of the collections, title blocks and macros
|
Folders ///< folders of the collections, title blocks and macros
|
||||||
@@ -71,6 +71,7 @@ namespace ConfigProfile
|
|||||||
{
|
{
|
||||||
return key.endsWith(QLatin1String("/geometry"))
|
return key.endsWith(QLatin1String("/geometry"))
|
||||||
|| key.endsWith(QLatin1String("/state"))
|
|| key.endsWith(QLatin1String("/state"))
|
||||||
|
|| key.startsWith(QLatin1String("dialoggeometry/"))
|
||||||
|| key.contains(QLatin1String("-recentfiles/"))
|
|| key.contains(QLatin1String("-recentfiles/"))
|
||||||
|| key == marker_key
|
|| key == marker_key
|
||||||
|| key == parts_key;
|
|| key == parts_key;
|
||||||
@@ -88,7 +89,8 @@ namespace ConfigProfile
|
|||||||
QStringLiteral("diagrameditor/shortcut_bar/"),
|
QStringLiteral("diagrameditor/shortcut_bar/"),
|
||||||
QStringLiteral("diagrameditor/gestures/"),
|
QStringLiteral("diagrameditor/gestures/"),
|
||||||
QStringLiteral("diagrameditor/mouse_gestures"),
|
QStringLiteral("diagrameditor/mouse_gestures"),
|
||||||
QStringLiteral("diagrameditor/context_toolbar")};
|
QStringLiteral("diagrameditor/context_toolbar"),
|
||||||
|
QStringLiteral("diagramview/gestures")};
|
||||||
static const QStringList new_project{
|
static const QStringList new_project{
|
||||||
//BorderProperties, TitleBlockProperties, ConductorProperties,
|
//BorderProperties, TitleBlockProperties, ConductorProperties,
|
||||||
//report, cross-reference and guide defaults all start so
|
//report, cross-reference and guide defaults all start so
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ private slots:
|
|||||||
QVERIFY(ConfigProfile::isLocalKey("diagrameditor/geometry"));
|
QVERIFY(ConfigProfile::isLocalKey("diagrameditor/geometry"));
|
||||||
QVERIFY(ConfigProfile::isLocalKey("elementeditor/state"));
|
QVERIFY(ConfigProfile::isLocalKey("elementeditor/state"));
|
||||||
QVERIFY(ConfigProfile::isLocalKey("projects-recentfiles/file1"));
|
QVERIFY(ConfigProfile::isLocalKey("projects-recentfiles/file1"));
|
||||||
|
QVERIFY(ConfigProfile::isLocalKey("dialoggeometry/ConfigDialog"));
|
||||||
QVERIFY(ConfigProfile::isLocalKey(ConfigProfile::marker_key));
|
QVERIFY(ConfigProfile::isLocalKey(ConfigProfile::marker_key));
|
||||||
QVERIFY(!ConfigProfile::isLocalKey("diagrameditor/Xgrid"));
|
QVERIFY(!ConfigProfile::isLocalKey("diagrameditor/Xgrid"));
|
||||||
QVERIFY(!ConfigProfile::isLocalKey("shortcuts/mainwindow.fullscreen"));
|
QVERIFY(!ConfigProfile::isLocalKey("shortcuts/mainwindow.fullscreen"));
|
||||||
@@ -32,6 +33,7 @@ private slots:
|
|||||||
live.setValue("lang", "de");
|
live.setValue("lang", "de");
|
||||||
live.setValue("diagrameditor/geometry", QByteArray("xyz"));
|
live.setValue("diagrameditor/geometry", QByteArray("xyz"));
|
||||||
live.setValue("projects-recentfiles/file1", "/home/a/b.qet");
|
live.setValue("projects-recentfiles/file1", "/home/a/b.qet");
|
||||||
|
live.setValue("dialoggeometry/ConfigDialog", QByteArray("xyz"));
|
||||||
|
|
||||||
QSettings file(path("profile1.conf"), QSettings::IniFormat);
|
QSettings file(path("profile1.conf"), QSettings::IniFormat);
|
||||||
QCOMPARE(ConfigProfile::exportTo(live, file), 2);
|
QCOMPARE(ConfigProfile::exportTo(live, file), 2);
|
||||||
@@ -39,6 +41,7 @@ private slots:
|
|||||||
QCOMPARE(file.value("diagrameditor/Xgrid").toInt(), 7);
|
QCOMPARE(file.value("diagrameditor/Xgrid").toInt(), 7);
|
||||||
QVERIFY(!file.contains("diagrameditor/geometry"));
|
QVERIFY(!file.contains("diagrameditor/geometry"));
|
||||||
QVERIFY(!file.contains("projects-recentfiles/file1"));
|
QVERIFY(!file.contains("projects-recentfiles/file1"));
|
||||||
|
QVERIFY(!file.contains("dialoggeometry/ConfigDialog"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Import replaces every setting, removes the ones the profile does not
|
// 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/gestures/directions"), P::Controls);
|
||||||
QCOMPARE(ConfigProfile::partOf("diagrameditor/mouse_gestures"), P::Controls);
|
QCOMPARE(ConfigProfile::partOf("diagrameditor/mouse_gestures"), P::Controls);
|
||||||
QCOMPARE(ConfigProfile::partOf("diagrameditor/context_toolbar"), 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/defaultconductortype"), P::NewProject);
|
||||||
QCOMPARE(ConfigProfile::partOf("diagrameditor/defaultreportlabel"), P::NewProject);
|
QCOMPARE(ConfigProfile::partOf("diagrameditor/defaultreportlabel"), P::NewProject);
|
||||||
|
|||||||
Reference in New Issue
Block a user