Docker: Use PagedSettings

More compact.

Change-Id: Ic21c6ea9e7faf67e5f507f336f18e1134b371a97
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2023-05-10 14:04:03 +02:00
parent 20f237baf2
commit 98d9ad8b3c
3 changed files with 20 additions and 35 deletions

View File

@@ -28,7 +28,6 @@ public:
DockerSettings m_settings; DockerSettings m_settings;
DockerDeviceFactory m_deviceFactory{&m_settings}; DockerDeviceFactory m_deviceFactory{&m_settings};
DockerSettingsPage m_settingPage{&m_settings};
DockerApi m_dockerApi{&m_settings}; DockerApi m_dockerApi{&m_settings};
}; };

View File

@@ -23,6 +23,25 @@ DockerSettings::DockerSettings()
setSettingsGroup(Constants::DOCKER); setSettingsGroup(Constants::DOCKER);
setAutoApply(false); setAutoApply(false);
setId(Docker::Constants::DOCKER_SETTINGS_ID);
setDisplayName(Tr::tr("Docker"));
setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
setSettings(this);
setLayouter([this](QWidget *widget) {
using namespace Layouting;
// clang-format off
Column {
Group {
title(Tr::tr("Configuration")),
Row { dockerBinaryPath }
},
st
}.attachTo(widget);
// clang-format on
});
FilePaths additionalPaths; FilePaths additionalPaths;
if (HostOsInfo::isWindowsHost()) if (HostOsInfo::isWindowsHost())
additionalPaths.append("C:/Program Files/Docker/Docker/resources/bin"); additionalPaths.append("C:/Program Files/Docker/Docker/resources/bin");
@@ -42,29 +61,4 @@ DockerSettings::DockerSettings()
readSettings(Core::ICore::settings()); readSettings(Core::ICore::settings());
} }
// DockerSettingsPage
DockerSettingsPage::DockerSettingsPage(DockerSettings *settings)
{
setId(Docker::Constants::DOCKER_SETTINGS_ID);
setDisplayName(Tr::tr("Docker"));
setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
setSettings(settings);
setLayouter([settings](QWidget *widget) {
DockerSettings &s = *settings;
using namespace Layouting;
// clang-format off
Column {
Group {
title(Tr::tr("Configuration")),
Row { s.dockerBinaryPath }
},
st
}.attachTo(widget);
// clang-format on
});
}
} // Docker::Internal } // Docker::Internal

View File

@@ -5,11 +5,9 @@
#include <coreplugin/dialogs/ioptionspage.h> #include <coreplugin/dialogs/ioptionspage.h>
#include <utils/aspects.h>
namespace Docker::Internal { namespace Docker::Internal {
class DockerSettings final : public Utils::AspectContainer class DockerSettings final : public Core::PagedSettings
{ {
public: public:
DockerSettings(); DockerSettings();
@@ -17,10 +15,4 @@ public:
Utils::StringAspect dockerBinaryPath; Utils::StringAspect dockerBinaryPath;
}; };
class DockerSettingsPage final : public Core::IOptionsPage
{
public:
explicit DockerSettingsPage(DockerSettings *settings);
};
} // Docker::Internal } // Docker::Internal