diff options
author | Marcus Tillmanns <[email protected]> | 2023-09-07 15:25:07 +0200 |
---|---|---|
committer | Marcus Tillmanns <[email protected]> | 2023-09-12 08:51:31 +0000 |
commit | f6205d6cc7a0f35eca25d645c68eea7f95612822 (patch) | |
tree | 55f3cf8a458c346366aa7ab91ed49c997306f8c8 /src/plugins/docker/dockerdevice.h | |
parent | ed0935733efbd4ff25a2664e3e91b672f3a645c1 (diff) |
Docker: Switch to aspect settings
Change-Id: Id04c48caf2ddd33e176ee424273690b80c77232b
Reviewed-by: <[email protected]>
Reviewed-by: hjk <[email protected]>
Diffstat (limited to 'src/plugins/docker/dockerdevice.h')
-rw-r--r-- | src/plugins/docker/dockerdevice.h | 61 |
1 files changed, 17 insertions, 44 deletions
diff --git a/src/plugins/docker/dockerdevice.h b/src/plugins/docker/dockerdevice.h index 59a11e436a4..821438edb8a 100644 --- a/src/plugins/docker/dockerdevice.h +++ b/src/plugins/docker/dockerdevice.h @@ -14,42 +14,22 @@ namespace Docker::Internal { -class DockerDeviceData +class DockerDeviceSettings : public ProjectExplorer::DeviceSettings { public: - bool operator==(const DockerDeviceData &other) const - { - return imageId == other.imageId && repo == other.repo && tag == other.tag - && useLocalUidGid == other.useLocalUidGid && mounts == other.mounts - && keepEntryPoint == other.keepEntryPoint && enableLldbFlags == other.enableLldbFlags - && clangdExecutable == other.clangdExecutable; - } - - bool operator!=(const DockerDeviceData &other) const { return !(*this == other); } - - // Used for "docker run" - QString repoAndTag() const - { - if (repo == "<none>") - return imageId; - - if (tag == "<none>") - return repo; - - return repo + ':' + tag; - } - - QString repoAndTagEncoded() const { return repoAndTag().replace(':', '.'); } - - QString imageId; - QString repo; - QString tag; - QString size; - bool useLocalUidGid = true; - QStringList mounts = {Core::DocumentManager::projectsDirectory().toString()}; - bool keepEntryPoint = false; - bool enableLldbFlags = false; - Utils::FilePath clangdExecutable; + DockerDeviceSettings(); + + QString repoAndTag() const; + QString repoAndTagEncoded() const; + + Utils::StringAspect imageId{this}; + Utils::StringAspect repo{this}; + Utils::StringAspect tag{this}; + Utils::BoolAspect useLocalUidGid{this}; + Utils::StringListAspect mounts{this}; + Utils::BoolAspect keepEntryPoint{this}; + Utils::BoolAspect enableLldbFlags{this}; + Utils::FilePathAspect clangdExecutable{this}; }; class DockerDevice : public ProjectExplorer::IDevice @@ -58,14 +38,14 @@ public: using Ptr = QSharedPointer<DockerDevice>; using ConstPtr = QSharedPointer<const DockerDevice>; - explicit DockerDevice(const DockerDeviceData &data); + explicit DockerDevice(std::unique_ptr<DockerDeviceSettings> settings); ~DockerDevice(); void shutdown(); - static Ptr create(const DockerDeviceData &data) + static Ptr create(std::unique_ptr<DockerDeviceSettings> settings) { - return Ptr(new DockerDevice(data)); + return Ptr(new DockerDevice(std::move(settings))); } ProjectExplorer::IDeviceWidget *createWidget() override; @@ -87,11 +67,6 @@ public: Utils::Environment systemEnvironment() const override; - const DockerDeviceData data() const; - DockerDeviceData data(); - - void setData(const DockerDeviceData &data); - bool updateContainerAccess() const; void setMounts(const QStringList &mounts) const; @@ -124,5 +99,3 @@ private: }; } // namespace Docker::Internal - -Q_DECLARE_METATYPE(Docker::Internal::DockerDeviceData) |