forked from qt-creator/qt-creator
Docker: Add a button to list auto-detected kit items
Helps to understand what's going on. Change-Id: I5b8c591cbd60227cf250932c8654063236eec05f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -231,6 +231,17 @@ void CMakeToolManager::removeDetectedCMake(const QString &detectionSource, QStri
|
||||
*logMessage = logMessages.join('\n');
|
||||
}
|
||||
|
||||
void CMakeToolManager::listDetectedCMake(const QString &detectionSource, QString *logMessage)
|
||||
{
|
||||
QTC_ASSERT(logMessage, return);
|
||||
QStringList logMessages{tr("CMake:")};
|
||||
for (const auto &tool : qAsConst(d->m_cmakeTools)) {
|
||||
if (tool->detectionSource() == detectionSource)
|
||||
logMessages.append(tool->displayName());
|
||||
}
|
||||
*logMessage = logMessages.join('\n');
|
||||
}
|
||||
|
||||
void CMakeToolManager::notifyAboutUpdate(CMakeTool *tool)
|
||||
{
|
||||
if (!tool || !Utils::contains(d->m_cmakeTools, tool))
|
||||
|
||||
@@ -69,6 +69,7 @@ public slots:
|
||||
void registerCMakeByPath(const Utils::FilePath &cmakePath,
|
||||
const QString &detectionSource);
|
||||
void removeDetectedCMake(const QString &detectionSource, QString *logMessage);
|
||||
void listDetectedCMake(const QString &detectionSource, QString *logMessage);
|
||||
|
||||
signals:
|
||||
void cmakeAdded (const Utils::Id &id);
|
||||
|
||||
@@ -1063,4 +1063,15 @@ void DebuggerItemManager::removeDetectedDebuggers(const QString &detectionSource
|
||||
*logMessage = logMessages.join('\n');
|
||||
}
|
||||
|
||||
void DebuggerItemManager::listDetectedDebuggers(const QString &detectionSource, QString *logMessage)
|
||||
{
|
||||
QTC_ASSERT(logMessage, return);
|
||||
QStringList logMessages{tr("Debuggers:")};
|
||||
d->m_model->forItemsAtLevel<2>([detectionSource, &logMessages](DebuggerTreeItem *titem) {
|
||||
if (titem->m_item.detectionSource() == detectionSource)
|
||||
logMessages.append(titem->m_item.displayName());
|
||||
});
|
||||
*logMessage = logMessages.join('\n');
|
||||
}
|
||||
|
||||
} // namespace Debugger
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
const QString &detectionSource,
|
||||
QString *logMessage);
|
||||
static void removeDetectedDebuggers(const QString &detectionSource, QString *logMessage);
|
||||
static void listDetectedDebuggers(const QString &detectionSource, QString *logMessage);
|
||||
|
||||
static const DebuggerItem *findByCommand(const Utils::FilePath &command);
|
||||
static const DebuggerItem *findById(const QVariant &id);
|
||||
|
||||
@@ -1759,6 +1759,11 @@ void DebuggerPlugin::removeDetectedDebuggers(const QString &detectionSource, QSt
|
||||
dd->m_debuggerItemManager.removeDetectedDebuggers(detectionSource, logMessage);
|
||||
}
|
||||
|
||||
void DebuggerPlugin::listDetectedDebuggers(const QString &detectionSource, QString *logMessage)
|
||||
{
|
||||
dd->m_debuggerItemManager.listDetectedDebuggers(detectionSource, logMessage);
|
||||
}
|
||||
|
||||
void DebuggerPluginPrivate::attachToQmlPort()
|
||||
{
|
||||
AttachToQmlPortDialog dlg(ICore::dialogParent());
|
||||
|
||||
@@ -63,6 +63,7 @@ private:
|
||||
const QString &detectionId,
|
||||
QString *logMessage);
|
||||
Q_SLOT void removeDetectedDebuggers(const QString &detectionId, QString *logMessage);
|
||||
Q_SLOT void listDetectedDebuggers(const QString &detectionId, QString *logMessage);
|
||||
|
||||
QVector<QObject *> createTestObjects() const override;
|
||||
};
|
||||
|
||||
@@ -248,6 +248,7 @@ public:
|
||||
|
||||
void autoDetect();
|
||||
void undoAutoDetect() const;
|
||||
void listAutoDetected() const;
|
||||
|
||||
QList<BaseQtVersion *> autoDetectQtVersions() const;
|
||||
QList<ToolChain *> autoDetectToolChains();
|
||||
@@ -280,6 +281,12 @@ void KitDetector::undoAutoDetect(const QString &sharedId) const
|
||||
d->undoAutoDetect();
|
||||
}
|
||||
|
||||
void KitDetector::listAutoDetected(const QString &sharedId) const
|
||||
{
|
||||
d->m_sharedId = sharedId;
|
||||
d->listAutoDetected();
|
||||
}
|
||||
|
||||
class DockerDevicePrivate : public QObject
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Docker::Internal::DockerDevice)
|
||||
@@ -387,6 +394,7 @@ public:
|
||||
|
||||
auto autoDetectButton = new QPushButton(tr("Auto-detect Kit Items"));
|
||||
auto undoAutoDetectButton = new QPushButton(tr("Remove Auto-Detected Kit Items"));
|
||||
auto listAutoDetectedButton = new QPushButton(tr("List Auto-Detected Kit Items"));
|
||||
|
||||
connect(autoDetectButton, &QPushButton::clicked, this, [this, logView, id = data.id(), dockerDevice] {
|
||||
logView->clear();
|
||||
@@ -409,6 +417,11 @@ public:
|
||||
m_kitItemDetector.undoAutoDetect(id);
|
||||
});
|
||||
|
||||
connect(listAutoDetectedButton, &QPushButton::clicked, this, [this, logView, id = data.id()] {
|
||||
logView->clear();
|
||||
m_kitItemDetector.listAutoDetected(id);
|
||||
});
|
||||
|
||||
using namespace Layouting;
|
||||
|
||||
Form {
|
||||
@@ -419,7 +432,7 @@ public:
|
||||
tr("Paths to mount:"), m_pathsLineEdit, Break(),
|
||||
Column {
|
||||
Space(20),
|
||||
Row { autoDetectButton, undoAutoDetectButton, Stretch() },
|
||||
Row { autoDetectButton, undoAutoDetectButton, listAutoDetectedButton, Stretch() },
|
||||
new QLabel(tr("Detection log:")),
|
||||
logView
|
||||
}
|
||||
@@ -556,6 +569,52 @@ void KitDetectorPrivate::undoAutoDetect() const
|
||||
emit q->logOutput('\n' + tr("Removal of previously auto-detected kit items finished.") + "\n\n");
|
||||
}
|
||||
|
||||
void KitDetectorPrivate::listAutoDetected() const
|
||||
{
|
||||
emit q->logOutput(tr("Start listing auto-detected items associated with this docker image."));
|
||||
|
||||
emit q->logOutput('\n' + tr("Kits:"));
|
||||
for (Kit *kit : KitManager::kits()) {
|
||||
if (kit->autoDetectionSource() == m_sharedId)
|
||||
emit q->logOutput(kit->displayName());
|
||||
};
|
||||
|
||||
emit q->logOutput('\n' + tr("Qt versions:"));
|
||||
for (BaseQtVersion *qtVersion : QtVersionManager::versions()) {
|
||||
if (qtVersion->detectionSource() == m_sharedId)
|
||||
emit q->logOutput(qtVersion->displayName());
|
||||
};
|
||||
|
||||
emit q->logOutput('\n' + tr("Toolchains:"));
|
||||
for (ToolChain *toolChain : ToolChainManager::toolChains()) {
|
||||
if (toolChain->detectionSource() == m_sharedId) {
|
||||
emit q->logOutput(toolChain->displayName());
|
||||
}
|
||||
};
|
||||
|
||||
if (QObject *cmakeManager = ExtensionSystem::PluginManager::getObjectByName("CMakeToolManager")) {
|
||||
QString logMessage;
|
||||
const bool res = QMetaObject::invokeMethod(cmakeManager,
|
||||
"listDetectedCMake",
|
||||
Q_ARG(QString, m_sharedId),
|
||||
Q_ARG(QString *, &logMessage));
|
||||
QTC_CHECK(res);
|
||||
emit q->logOutput('\n' + logMessage);
|
||||
}
|
||||
|
||||
if (QObject *debuggerPlugin = ExtensionSystem::PluginManager::getObjectByName("DebuggerPlugin")) {
|
||||
QString logMessage;
|
||||
const bool res = QMetaObject::invokeMethod(debuggerPlugin,
|
||||
"listDetectedDebuggers",
|
||||
Q_ARG(QString, m_sharedId),
|
||||
Q_ARG(QString *, &logMessage));
|
||||
QTC_CHECK(res);
|
||||
emit q->logOutput('\n' + logMessage);
|
||||
}
|
||||
|
||||
emit q->logOutput('\n' + tr("Listing of previously auto-detected kit items finished.") + "\n\n");
|
||||
}
|
||||
|
||||
QList<BaseQtVersion *> KitDetectorPrivate::autoDetectQtVersions() const
|
||||
{
|
||||
QList<BaseQtVersion *> qtVersions;
|
||||
|
||||
@@ -136,6 +136,7 @@ public:
|
||||
|
||||
void autoDetect(const QString &sharedId) const;
|
||||
void undoAutoDetect(const QString &sharedId) const;
|
||||
void listAutoDetected(const QString &sharedId) const;
|
||||
|
||||
signals:
|
||||
void logOutput(const QString &msg);
|
||||
|
||||
Reference in New Issue
Block a user