aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <[email protected]>2025-07-04 11:44:24 +0200
committerEike Ziller <[email protected]>2025-07-04 10:09:02 +0000
commitc0ab3b876ad1cf544d2f78c93679849f7e887d1b (patch)
tree195efd6e742b25eff0e7b3e937f399e242f32056
parentd201bd9e78489700ae951ce9e12cc8c7eb25ffea (diff)
ProjectExplorer: Keep environmentId compatible and actually read itHEADmaster
It was serialized as a QVariant::fromValue<QByteArray> before, and that is different from QVariant::fromValue<QUuid>. Switch to a TypedAspect<QByteArray> instead. The setting was also no longer read, because it was not added to the settings container. Amends 5604613df55fd8155ebecfeeecbaced7ced6627f Change-Id: I31de4aea60b241a28100eee042dd38733605da14 Reviewed-by: Jarek Kobus <[email protected]> Reviewed-by: hjk <[email protected]>
-rw-r--r--src/plugins/projectexplorer/projectexplorersettings.cpp2
-rw-r--r--src/plugins/projectexplorer/projectexplorersettings.h2
-rw-r--r--src/plugins/projectexplorer/userfileaccessor.cpp15
3 files changed, 10 insertions, 9 deletions
diff --git a/src/plugins/projectexplorer/projectexplorersettings.cpp b/src/plugins/projectexplorer/projectexplorersettings.cpp
index b768924acb6..ec2e841f39c 100644
--- a/src/plugins/projectexplorer/projectexplorersettings.cpp
+++ b/src/plugins/projectexplorer/projectexplorersettings.cpp
@@ -161,7 +161,7 @@ ProjectExplorerSettings::ProjectExplorerSettings()
}
if (environmentId().isNull()) {
- environmentId.setValue(QUuid::createUuid());
+ environmentId.setValue(QUuid::createUuid().toByteArray());
environmentId.writeSettings();
}
diff --git a/src/plugins/projectexplorer/projectexplorersettings.h b/src/plugins/projectexplorer/projectexplorersettings.h
index 7daca272f0d..50dc158107e 100644
--- a/src/plugins/projectexplorer/projectexplorersettings.h
+++ b/src/plugins/projectexplorer/projectexplorersettings.h
@@ -45,7 +45,7 @@ public:
// Add a UUid which is used to identify the development environment.
// This is used to warn the user when he is trying to open a .user file that was created
// somewhere else (which might lead to unexpected results).
- Utils::TypedAspect<QUuid> environmentId;
+ Utils::TypedAspect<QByteArray> environmentId{this};
};
PROJECTEXPLORER_EXPORT ProjectExplorerSettings &projectExplorerSettings();
diff --git a/src/plugins/projectexplorer/userfileaccessor.cpp b/src/plugins/projectexplorer/userfileaccessor.cpp
index 1d0aebc274e..f2dac24266f 100644
--- a/src/plugins/projectexplorer/userfileaccessor.cpp
+++ b/src/plugins/projectexplorer/userfileaccessor.cpp
@@ -147,7 +147,7 @@ UserFileAccessor::UserFileAccessor(Project *project)
secondary->setReadOnly();
setSecondaryAccessor(std::move(secondary));
- setSettingsId(projectExplorerSettings().environmentId().toByteArray());
+ setSettingsId(projectExplorerSettings().environmentId());
// Register Upgraders:
addVersionUpgrader(std::make_unique<UserFileVersion18Upgrader>());
@@ -518,8 +518,8 @@ private slots:
Store result = accessor.prepareToWriteSettings(data);
QCOMPARE(result.count(), data.count() + 2);
- QCOMPARE(result.value("EnvironmentId").toByteArray(),
- projectExplorerSettings().environmentId().toByteArray());
+ QCOMPARE(
+ result.value("EnvironmentId").toByteArray(), projectExplorerSettings().environmentId());
QCOMPARE(result.value("UserStickyKeys"), QVariant(QStringList({"shared1"})));
QCOMPARE(result.value("Version").toInt(), accessor.currentVersion());
QCOMPARE(result.value("shared1"), data.value("shared1"));
@@ -541,7 +541,7 @@ private slots:
Store data;
data.insert("Version", accessor.currentVersion());
- data.insert("EnvironmentId", projectExplorerSettings().environmentId().toByteArray());
+ data.insert("EnvironmentId", projectExplorerSettings().environmentId());
data.insert("UserStickyKeys", QStringList({"shared1"}));
data.insert("shared1", "bar1");
data.insert("unique1", 1234);
@@ -552,8 +552,9 @@ private slots:
QVERIFY(!result.hasIssue());
QCOMPARE(result.data.count(), data.count() + 1);
// mergeSettings does not run updateSettings, so no OriginalVersion will be set
- QCOMPARE(result.data.value("EnvironmentId").toByteArray(),
- projectExplorerSettings().environmentId().toByteArray()); // unchanged
+ QCOMPARE(
+ result.data.value("EnvironmentId").toByteArray(),
+ projectExplorerSettings().environmentId()); // unchanged
QCOMPARE(result.data.value("UserStickyKeys"), QVariant(QStringList({"shared1"}))); // unchanged
QCOMPARE(result.data.value("Version").toInt(), accessor.currentVersion()); // forced
QCOMPARE(result.data.value("shared1"), data.value("shared1")); // from data
@@ -594,7 +595,7 @@ private slots:
Store data;
data.insert("Version", accessor.currentVersion());
data.insert("OriginalVersion", accessor.currentVersion());
- data.insert("EnvironmentId", projectExplorerSettings().environmentId().toByteArray());
+ data.insert("EnvironmentId", projectExplorerSettings().environmentId());
data.insert("UserStickyKeys", QStringList({"shared1"}));
data.insert("shared1", "bar1");
data.insert("unique1", 1234);