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 <hjk@qt.io>
This commit is contained in:
Christian Stenger
2022-03-14 14:02:22 +01:00
parent 4594250b6c
commit cd7a0bbef5

View File

@@ -51,6 +51,7 @@
#include <utils/environment.h>
#include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <utils/infolabel.h>
#include <utils/layoutbuilder.h>
#include <utils/overridecursor.h>
#include <utils/pathlisteditor.h>
@@ -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);