forked from qt-creator/qt-creator
docker: Fix StringAspect default value handling
The StringAspect needs to return a possible default value if no value was set by the user. Otherwise it would write an empty string when ::apply was called. Also a small improvement for docker error logging is added Change-Id: I85f80253894d2c3e726da714616e5275039febcc Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -1196,12 +1196,18 @@ QVariant StringAspect::volatileValue() const
|
|||||||
switch (d->m_displayStyle) {
|
switch (d->m_displayStyle) {
|
||||||
case PathChooserDisplay:
|
case PathChooserDisplay:
|
||||||
QTC_ASSERT(d->m_pathChooserDisplay, return {});
|
QTC_ASSERT(d->m_pathChooserDisplay, return {});
|
||||||
|
if (d->m_pathChooserDisplay->filePath().isEmpty())
|
||||||
|
return defaultValue().toString();
|
||||||
return d->m_pathChooserDisplay->filePath().toString();
|
return d->m_pathChooserDisplay->filePath().toString();
|
||||||
case LineEditDisplay:
|
case LineEditDisplay:
|
||||||
QTC_ASSERT(d->m_lineEditDisplay, return {});
|
QTC_ASSERT(d->m_lineEditDisplay, return {});
|
||||||
|
if (d->m_lineEditDisplay->text().isEmpty())
|
||||||
|
return defaultValue().toString();
|
||||||
return d->m_lineEditDisplay->text();
|
return d->m_lineEditDisplay->text();
|
||||||
case TextEditDisplay:
|
case TextEditDisplay:
|
||||||
QTC_ASSERT(d->m_textEditDisplay, return {});
|
QTC_ASSERT(d->m_textEditDisplay, return {});
|
||||||
|
if (d->m_textEditDisplay->document()->isEmpty())
|
||||||
|
return defaultValue().toString();
|
||||||
return d->m_textEditDisplay->document()->toPlainText();
|
return d->m_textEditDisplay->document()->toPlainText();
|
||||||
case LabelDisplay:
|
case LabelDisplay:
|
||||||
break;
|
break;
|
||||||
|
@@ -451,8 +451,12 @@ void DockerDevicePrivate::startContainer()
|
|||||||
createProcess.setCommand(dockerCreate);
|
createProcess.setCommand(dockerCreate);
|
||||||
createProcess.runBlocking();
|
createProcess.runBlocking();
|
||||||
|
|
||||||
if (createProcess.result() != ProcessResult::FinishedWithSuccess)
|
if (createProcess.result() != ProcessResult::FinishedWithSuccess) {
|
||||||
|
qCWarning(dockerDeviceLog) << "Failed creating docker container:";
|
||||||
|
qCWarning(dockerDeviceLog) << "Exit Code:" << createProcess.exitCode();
|
||||||
|
qCWarning(dockerDeviceLog) << createProcess.allOutput();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_container = createProcess.cleanedStdOut().trimmed();
|
m_container = createProcess.cleanedStdOut().trimmed();
|
||||||
if (m_container.isEmpty())
|
if (m_container.isEmpty())
|
||||||
@@ -1094,7 +1098,7 @@ public:
|
|||||||
m_view->setSelectionMode(QAbstractItemView::SingleSelection);
|
m_view->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||||
|
|
||||||
m_log = new QTextBrowser;
|
m_log = new QTextBrowser;
|
||||||
m_log->setVisible(false);
|
m_log->setVisible(dockerDeviceLog().isDebugEnabled());
|
||||||
|
|
||||||
const QString fail = QString{"Docker: "}
|
const QString fail = QString{"Docker: "}
|
||||||
+ QCoreApplication::translate("Debugger::Internal::GdbEngine",
|
+ QCoreApplication::translate("Debugger::Internal::GdbEngine",
|
||||||
|
@@ -47,7 +47,7 @@ DockerSettings::DockerSettings()
|
|||||||
registerAspect(&dockerBinaryPath);
|
registerAspect(&dockerBinaryPath);
|
||||||
dockerBinaryPath.setDisplayStyle(StringAspect::PathChooserDisplay);
|
dockerBinaryPath.setDisplayStyle(StringAspect::PathChooserDisplay);
|
||||||
dockerBinaryPath.setExpectedKind(PathChooser::ExistingCommand);
|
dockerBinaryPath.setExpectedKind(PathChooser::ExistingCommand);
|
||||||
dockerBinaryPath.setDefaultValue(FilePath::fromString("docker").searchInPath({"/usr/local/bin"}).toString());
|
dockerBinaryPath.setDefaultFilePath(FilePath::fromString("docker").searchInPath({"/usr/local/bin"}));
|
||||||
dockerBinaryPath.setDisplayName(tr("Docker CLI"));
|
dockerBinaryPath.setDisplayName(tr("Docker CLI"));
|
||||||
dockerBinaryPath.setHistoryCompleter("Docker.Command.History");
|
dockerBinaryPath.setHistoryCompleter("Docker.Command.History");
|
||||||
dockerBinaryPath.setLabelText(tr("Command:"));
|
dockerBinaryPath.setLabelText(tr("Command:"));
|
||||||
|
Reference in New Issue
Block a user