From cd7a0bbef5e0a419f70f225433da3219546d8bb7 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 14 Mar 2022 14:02:22 +0100 Subject: [PATCH] Docker: Inform user early if adding device fails When retrieving the list of images there is no indicator when something failed, so add one. Change-Id: I2e0cde4ba33527e1b2abeecb5b3a06507dabf472 Reviewed-by: hjk --- src/plugins/docker/dockerdevice.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/plugins/docker/dockerdevice.cpp b/src/plugins/docker/dockerdevice.cpp index 25770163e35..78456c50888 100644 --- a/src/plugins/docker/dockerdevice.cpp +++ b/src/plugins/docker/dockerdevice.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -1859,12 +1860,19 @@ public: m_log = new QTextBrowser; m_log->setVisible(false); + const QString fail = QString{"Docker: "} + + QCoreApplication::translate("Debugger::Internal::GdbEngine", + "Process failed to start."); + auto errorLabel = new Utils::InfoLabel(fail, Utils::InfoLabel::Error, this); + errorLabel->setVisible(false); + m_buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); using namespace Layouting; Column { m_view, m_log, + errorLabel, m_buttons, }.attachTo(this); @@ -1902,6 +1910,13 @@ public: m_log->append(DockerDevice::tr("Error: %1").arg(out)); }); + connect(m_process, &Utils::QtcProcess::finished, + this, [this, errorLabel]() { + if (m_process->exitCode() != 0) { + errorLabel->setVisible(true); + } + }); + connect(m_view->selectionModel(), &QItemSelectionModel::selectionChanged, [this] { const QModelIndexList selectedRows = m_view->selectionModel()->selectedRows(); QTC_ASSERT(selectedRows.size() == 1, return);