dockerplugin: Solve UI fixme's for 8.0

Shortened some lines as requested.

Change-Id: I5d145e8cd28ed1036915a5d1611f0257efd9b023
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
Marcus Tillmanns
2022-04-07 09:01:21 +02:00
parent 6e666b3bfd
commit 4340d18371
3 changed files with 33 additions and 28 deletions

View File

@@ -92,20 +92,18 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
data.useLocalUidGid = on;
});
m_pathsListLabel = new InfoLabel(tr("Paths to mount:"));
// FIXME: 8.0: use
//m_pathsListLabel->setToolTip(tr("Source directory list should not be empty"));
auto pathListLabel = new InfoLabel(tr("Paths to mount:"));
pathListLabel->setAdditionalToolTip(tr("Source directory list should not be empty."));
m_pathsListEdit = new PathListEditor;
// FIXME: 8.0: use
//m_pathsListEdit->setPlaceholderText(tr("Host directories to mount into the container"));
m_pathsListEdit->setPlaceholderText(tr("Host directories to mount into the container"));
m_pathsListEdit->setToolTip(tr("Maps paths in this list one-to-one to the "
"docker container."));
m_pathsListEdit->setPathList(data.mounts);
auto markupMounts = [this] {
auto markupMounts = [this, pathListLabel] {
const bool isEmpty = m_pathsListEdit->pathList().isEmpty();
m_pathsListLabel->setType(isEmpty ? InfoLabel::Warning : InfoLabel::None);
pathListLabel->setType(isEmpty ? InfoLabel::Warning : InfoLabel::None);
};
markupMounts();
@@ -127,8 +125,8 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
searchDirsComboBox->addItem(tr("Search in Selected Directories"));
auto searchDirsLineEdit = new FancyLineEdit;
// FIXME: 8.0: use
//searchDirsLineEdit->setPlaceholderText(tr("Semicolon-separated list of directories"));
searchDirsLineEdit->setPlaceholderText(tr("Semicolon-separated list of directories"));
searchDirsLineEdit->setToolTip(
tr("Select the paths in the docker image that should be scanned for kit entries."));
searchDirsLineEdit->setHistoryCompleter("DockerMounts", true);
@@ -180,7 +178,7 @@ DockerDeviceWidget::DockerDeviceWidget(const IDevice::Ptr &device)
daemonStateLabel, m_daemonReset, m_daemonState, Break(),
m_runAsOutsideUser, Break(),
Column {
m_pathsListLabel,
pathListLabel,
m_pathsListEdit,
}, Break(),
Column {

View File

@@ -55,9 +55,7 @@ private:
QToolButton *m_daemonReset;
QLabel *m_daemonState;
QCheckBox *m_runAsOutsideUser;
Utils::InfoLabel *m_pathsListLabel;
Utils::PathListEditor *m_pathsListEdit;
KitDetector m_kitItemDetector;
};

View File

@@ -24,6 +24,7 @@
****************************************************************************/
#include "kitdetector.h"
#include "dockerconstants.h"
#include <extensionsystem/pluginmanager.h>
@@ -54,7 +55,8 @@ class KitDetectorPrivate
public:
KitDetectorPrivate(KitDetector *parent, const IDevice::ConstPtr &device)
: q(parent), m_device(device)
: q(parent)
, m_device(device)
{}
void autoDetect();
@@ -133,7 +135,7 @@ void KitDetectorPrivate::undoAutoDetect() const
}
};
if (QObject *cmakeManager = ExtensionSystem::PluginManager::getObjectByName("CMakeToolManager")) {
if (auto cmakeManager = ExtensionSystem::PluginManager::getObjectByName("CMakeToolManager")) {
QString logMessage;
const bool res = QMetaObject::invokeMethod(cmakeManager,
"removeDetectedCMake",
@@ -143,7 +145,7 @@ void KitDetectorPrivate::undoAutoDetect() const
emit q->logOutput('\n' + logMessage);
}
if (QObject *debuggerPlugin = ExtensionSystem::PluginManager::getObjectByName("DebuggerPlugin")) {
if (auto debuggerPlugin = ExtensionSystem::PluginManager::getObjectByName("DebuggerPlugin")) {
QString logMessage;
const bool res = QMetaObject::invokeMethod(debuggerPlugin,
"removeDetectedDebuggers",
@@ -164,21 +166,22 @@ void KitDetectorPrivate::listAutoDetected() const
for (Kit *kit : KitManager::kits()) {
if (kit->autoDetectionSource() == m_sharedId)
emit q->logOutput(kit->displayName());
};
}
emit q->logOutput('\n' + tr("Qt versions:"));
for (QtVersion *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")) {
if (QObject *cmakeManager = ExtensionSystem::PluginManager::getObjectByName(
"CMakeToolManager")) {
QString logMessage;
const bool res = QMetaObject::invokeMethod(cmakeManager,
"listDetectedCMake",
@@ -188,7 +191,8 @@ void KitDetectorPrivate::listAutoDetected() const
emit q->logOutput('\n' + logMessage);
}
if (QObject *debuggerPlugin = ExtensionSystem::PluginManager::getObjectByName("DebuggerPlugin")) {
if (QObject *debuggerPlugin = ExtensionSystem::PluginManager::getObjectByName(
"DebuggerPlugin")) {
QString logMessage;
const bool res = QMetaObject::invokeMethod(debuggerPlugin,
"listDetectedDebuggers",
@@ -208,7 +212,10 @@ QtVersions KitDetectorPrivate::autoDetectQtVersions() const
QString error;
const auto handleQmake = [this, &qtVersions, &error](const FilePath &qmake) {
if (QtVersion *qtVersion = QtVersionFactory::createQtVersionFromQMakePath(qmake, false, m_sharedId, &error)) {
if (QtVersion *qtVersion = QtVersionFactory::createQtVersionFromQMakePath(qmake,
false,
m_sharedId,
&error)) {
qtVersions.append(qtVersion);
QtVersionManager::addVersion(qtVersion);
emit q->logOutput(tr("Found \"%1\"").arg(qtVersion->qmakeFilePath().toUserOutput()));
@@ -220,8 +227,10 @@ QtVersions KitDetectorPrivate::autoDetectQtVersions() const
const QStringList candidates = {"qmake-qt6", "qmake-qt5", "qmake"};
for (const FilePath &searchPath : m_searchPaths) {
searchPath.iterateDirectory(handleQmake, {candidates, QDir::Files | QDir::Executable,
QDirIterator::Subdirectories});
searchPath.iterateDirectory(handleQmake,
{candidates,
QDir::Files | QDir::Executable,
QDirIterator::Subdirectories});
}
if (!error.isEmpty())
@@ -316,9 +325,9 @@ void KitDetectorPrivate::autoDetect()
QtSupport::QtKitAspect::setQtVersion(k, qt);
}
Toolchains toolchainsToSet;
toolchainsToSet = ToolChainManager::toolchains([qt, this](const ToolChain *tc){
return tc->detectionSource() == m_sharedId
&& (!qt || qt->qtAbis().contains(tc->targetAbi()));
toolchainsToSet = ToolChainManager::toolchains([qt, this](const ToolChain *tc) {
return tc->detectionSource() == m_sharedId
&& (!qt || qt->qtAbis().contains(tc->targetAbi()));
});
for (ToolChain *toolChain : toolchainsToSet)
ToolChainKitAspect::setToolChain(k, toolChain);
@@ -335,5 +344,5 @@ void KitDetectorPrivate::autoDetect()
QApplication::restoreOverrideCursor();
}
} // Internal
} // Docker
} // namespace Internal
} // namespace Docker