2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2022 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2021-03-18 08:52:42 +01:00
|
|
|
|
|
|
|
|
#include "dockersettings.h"
|
|
|
|
|
|
2022-07-04 11:09:11 +02:00
|
|
|
#include "dockerconstants.h"
|
2022-07-13 10:43:31 +02:00
|
|
|
#include "dockertr.h"
|
2022-11-17 07:16:39 +01:00
|
|
|
#include "utils/hostosinfo.h"
|
2022-07-04 11:09:11 +02:00
|
|
|
|
2021-03-18 08:52:42 +01:00
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
|
|
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
|
2022-07-04 11:09:11 +02:00
|
|
|
#include <utils/filepath.h>
|
2021-03-18 08:52:42 +01:00
|
|
|
#include <utils/layoutbuilder.h>
|
|
|
|
|
|
|
|
|
|
using namespace Utils;
|
|
|
|
|
|
2022-07-13 10:43:31 +02:00
|
|
|
namespace Docker::Internal {
|
2021-03-18 08:52:42 +01:00
|
|
|
|
|
|
|
|
DockerSettings::DockerSettings()
|
|
|
|
|
{
|
2022-07-04 11:09:11 +02:00
|
|
|
setSettingsGroup(Constants::DOCKER);
|
2021-03-18 08:52:42 +01:00
|
|
|
setAutoApply(false);
|
|
|
|
|
|
2022-11-17 07:16:39 +01:00
|
|
|
FilePaths additionalPaths;
|
|
|
|
|
if (HostOsInfo::isWindowsHost())
|
|
|
|
|
additionalPaths.append("C:/Program Files/Docker/Docker/resources/bin");
|
|
|
|
|
else
|
|
|
|
|
additionalPaths.append("/usr/local/bin");
|
|
|
|
|
|
2022-07-04 11:09:11 +02:00
|
|
|
registerAspect(&dockerBinaryPath);
|
|
|
|
|
dockerBinaryPath.setDisplayStyle(StringAspect::PathChooserDisplay);
|
|
|
|
|
dockerBinaryPath.setExpectedKind(PathChooser::ExistingCommand);
|
2022-11-17 07:16:39 +01:00
|
|
|
dockerBinaryPath.setDefaultFilePath(
|
|
|
|
|
FilePath::fromString("docker").searchInPath(additionalPaths));
|
2022-07-13 10:43:31 +02:00
|
|
|
dockerBinaryPath.setDisplayName(Tr::tr("Docker CLI"));
|
2022-07-04 11:09:11 +02:00
|
|
|
dockerBinaryPath.setHistoryCompleter("Docker.Command.History");
|
2022-07-13 10:43:31 +02:00
|
|
|
dockerBinaryPath.setLabelText(Tr::tr("Command:"));
|
2022-07-04 11:09:11 +02:00
|
|
|
dockerBinaryPath.setSettingsKey("cli");
|
2021-03-18 08:52:42 +01:00
|
|
|
|
2022-07-04 11:09:11 +02:00
|
|
|
readSettings(Core::ICore::settings());
|
2021-03-18 08:52:42 +01:00
|
|
|
}
|
|
|
|
|
|
2022-07-04 11:09:11 +02:00
|
|
|
// DockerSettingsPage
|
2021-03-18 08:52:42 +01:00
|
|
|
|
2022-07-04 14:24:51 +02:00
|
|
|
DockerSettingsPage::DockerSettingsPage(DockerSettings *settings)
|
2021-03-18 08:52:42 +01:00
|
|
|
{
|
2022-07-04 11:09:11 +02:00
|
|
|
setId(Docker::Constants::DOCKER_SETTINGS_ID);
|
2022-07-13 10:43:31 +02:00
|
|
|
setDisplayName(Tr::tr("Docker"));
|
2021-03-18 08:52:42 +01:00
|
|
|
setCategory(ProjectExplorer::Constants::DEVICE_SETTINGS_CATEGORY);
|
2022-07-04 14:24:51 +02:00
|
|
|
setSettings(settings);
|
2021-03-31 17:28:24 +02:00
|
|
|
|
2022-07-04 14:24:51 +02:00
|
|
|
setLayouter([settings](QWidget *widget) {
|
2021-03-31 17:28:24 +02:00
|
|
|
DockerSettings &s = *settings;
|
2022-07-04 11:09:11 +02:00
|
|
|
using namespace Layouting;
|
2021-03-31 17:28:24 +02:00
|
|
|
|
2022-07-04 11:09:11 +02:00
|
|
|
// clang-format off
|
2021-03-31 17:28:24 +02:00
|
|
|
Column {
|
|
|
|
|
Group {
|
2022-07-26 13:46:27 +02:00
|
|
|
title(Tr::tr("Configuration")),
|
2022-07-04 11:09:11 +02:00
|
|
|
Row { s.dockerBinaryPath }
|
2021-03-31 17:28:24 +02:00
|
|
|
},
|
2022-07-22 18:54:04 +02:00
|
|
|
st
|
2021-03-31 17:28:24 +02:00
|
|
|
}.attachTo(widget);
|
2022-07-04 11:09:11 +02:00
|
|
|
// clang-format on
|
2021-03-31 17:28:24 +02:00
|
|
|
});
|
2021-03-18 08:52:42 +01:00
|
|
|
}
|
|
|
|
|
|
2022-07-13 10:43:31 +02:00
|
|
|
} // Docker::Internal
|