diff options
| -rw-r--r-- | src/libs/utils/buildablehelperlibrary.cpp | 18 | ||||
| -rw-r--r-- | src/libs/utils/buildablehelperlibrary.h | 1 | ||||
| -rw-r--r-- | src/plugins/debugger/debuggeritemmanager.cpp | 2 | ||||
| -rw-r--r-- | src/plugins/projectexplorer/toolchainoptionspage.cpp | 11 | ||||
| -rw-r--r-- | src/plugins/qtsupport/qtoptionspage.cpp | 3 | ||||
| -rw-r--r-- | src/plugins/qtsupport/qtsupportconstants.h | 2 | ||||
| -rw-r--r-- | src/plugins/qtsupport/qtsupportplugin.cpp | 20 | ||||
| -rw-r--r-- | src/plugins/qtsupport/qtversionmanager.cpp | 17 |
8 files changed, 35 insertions, 39 deletions
diff --git a/src/libs/utils/buildablehelperlibrary.cpp b/src/libs/utils/buildablehelperlibrary.cpp index fdf7d23121a..a34811e97c4 100644 --- a/src/libs/utils/buildablehelperlibrary.cpp +++ b/src/libs/utils/buildablehelperlibrary.cpp @@ -99,16 +99,22 @@ static FilePaths findQmakesInDir(const FilePath &dir) FilePaths BuildableHelperLibrary::findQtsInEnvironment( const Environment &env, const FilePath &deviceRoot) { - FilePaths qmakeList; - std::set<FilePath> canonicalEnvPaths; - const FilePaths paths = env.path(); - for (const FilePath &path : paths) { + return findQtsInPaths(Utils::transform(env.path(), [&deviceRoot](const FilePath &path) { FilePath devPath = deviceRoot.withNewMappedPath(path); if (QTC_UNEXPECTED(deviceRoot.isEmpty())) devPath = path; - if (!canonicalEnvPaths.insert(devPath.canonicalPath()).second) + return devPath; + })); +} + +FilePaths BuildableHelperLibrary::findQtsInPaths(const FilePaths &paths) +{ + FilePaths qmakeList; + std::set<FilePath> canonicalEnvPaths; + for (const FilePath &path : paths) { + if (!canonicalEnvPaths.insert(path.canonicalPath()).second) continue; - qmakeList << findQmakesInDir(devPath); + qmakeList << findQmakesInDir(path); } return qmakeList; } diff --git a/src/libs/utils/buildablehelperlibrary.h b/src/libs/utils/buildablehelperlibrary.h index a8de770b76e..ee735504708 100644 --- a/src/libs/utils/buildablehelperlibrary.h +++ b/src/libs/utils/buildablehelperlibrary.h @@ -17,6 +17,7 @@ class QTCREATOR_UTILS_EXPORT BuildableHelperLibrary { public: static FilePaths findQtsInEnvironment(const Environment &env, const FilePath &deviceRoot); + static FilePaths findQtsInPaths(const FilePaths &paths); static bool isQtChooser(const FilePath &filePath); static FilePath qtChooserToQmakePath(const FilePath &path); // return true if the qmake at qmakePath is a Qt (used by QtVersion) diff --git a/src/plugins/debugger/debuggeritemmanager.cpp b/src/plugins/debugger/debuggeritemmanager.cpp index 88f973c80e8..67009dd517f 100644 --- a/src/plugins/debugger/debuggeritemmanager.cpp +++ b/src/plugins/debugger/debuggeritemmanager.cpp @@ -1225,7 +1225,7 @@ public: this, [this] { const IDeviceConstPtr dev = currentDevice(); QTC_ASSERT(dev, return); - itemModel().detectDebuggers(dev, dev->systemEnvironment().mappedPath(dev->rootPath())); + itemModel().detectDebuggers(dev, dev->toolSearchPaths()); }); m_deviceComboBox->setCurrentIndex( diff --git a/src/plugins/projectexplorer/toolchainoptionspage.cpp b/src/plugins/projectexplorer/toolchainoptionspage.cpp index 744f62681c1..4b086d65132 100644 --- a/src/plugins/projectexplorer/toolchainoptionspage.cpp +++ b/src/plugins/projectexplorer/toolchainoptionspage.cpp @@ -334,10 +334,13 @@ public: markForRemoval(item); }); - m_filterModel.setDevice(DeviceManager::defaultDesktopDevice()); - connect(m_deviceComboBox, &QComboBox::currentIndexChanged, this, [this](int idx) { - m_filterModel.setDevice(DeviceManager::deviceAt(idx)); - }); + const auto updateDevice = [this](int index) { + m_filterModel.setDevice(m_deviceManagerModel.device(index)); + }; + connect(m_deviceComboBox, &QComboBox::currentIndexChanged, this, updateDevice); + m_deviceComboBox->setCurrentIndex( + m_deviceManagerModel.indexForId(ProjectExplorer::Constants::DESKTOP_DEVICE_ID)); + updateDevice(m_deviceComboBox->currentIndex()); updateState(); } diff --git a/src/plugins/qtsupport/qtoptionspage.cpp b/src/plugins/qtsupport/qtoptionspage.cpp index 06403105f04..44477828eb8 100644 --- a/src/plugins/qtsupport/qtoptionspage.cpp +++ b/src/plugins/qtsupport/qtoptionspage.cpp @@ -801,8 +801,7 @@ void QtSettingsPageWidget::redetect() if (!QTC_GUARD(dev)) return; - const FilePaths qMakes - = BuildableHelperLibrary::findQtsInEnvironment(dev->systemEnvironment(), dev->rootPath()); + const FilePaths qMakes = BuildableHelperLibrary::findQtsInPaths(dev->toolSearchPaths()); for (const FilePath &qmakePath : qMakes) { if (BuildableHelperLibrary::isQtChooser(qmakePath)) continue; diff --git a/src/plugins/qtsupport/qtsupportconstants.h b/src/plugins/qtsupport/qtsupportconstants.h index a5e73a3a215..106ae84d964 100644 --- a/src/plugins/qtsupport/qtsupportconstants.h +++ b/src/plugins/qtsupport/qtsupportconstants.h @@ -39,6 +39,4 @@ const char KIT_QML_IMPORT_PATH[] = "QtSupport.KitQmlImportPath"; const char KIT_HAS_MERGED_HEADER_PATHS_WITH_QML_IMPORT_PATHS[] = "QtSupport.KitHasMergedHeaderPathsWithQmlImportPaths"; -const char QMAKE_TOOL_ID[] = "QMakeTool"; - } // namepsace QtSupport::Constants diff --git a/src/plugins/qtsupport/qtsupportplugin.cpp b/src/plugins/qtsupport/qtsupportplugin.cpp index 3317e4d4262..d4c483b3788 100644 --- a/src/plugins/qtsupport/qtsupportplugin.cpp +++ b/src/plugins/qtsupport/qtsupportplugin.cpp @@ -11,7 +11,6 @@ #include "qtoutputformatter.h" #include "qtparser.h" #include "qtprojectimporter.h" -#include "qtsupportconstants.h" #include "qtsupporttr.h" #include "qttestparser.h" #include "qtversionmanager.h" @@ -27,7 +26,6 @@ #include <projectexplorer/buildpropertiessettings.h> #include <projectexplorer/buildsystem.h> #include <projectexplorer/devicesupport/idevice.h> -#include <projectexplorer/jsonwizard/jsonwizardfactory.h> #include <projectexplorer/project.h> #include <projectexplorer/projectmanager.h> #include <projectexplorer/projecttree.h> @@ -68,23 +66,6 @@ static void processRunnerCallback(ProcessData *data) data->stdOut = proc.rawStdOut(); } -class QmakeToolFactory : public DeviceToolAspectFactory -{ -public: - QmakeToolFactory() - { - setToolId(Constants::QMAKE_TOOL_ID); - setToolType(DeviceToolAspect::BuildTool); - setFilePattern({"qmake"}); - setLabelText(Tr::tr("qmake executable:")); - } -}; - -void setupQmakeToolFactory() -{ - static QmakeToolFactory theQmakeToolFactory; -} - class QtSupportPlugin final : public ExtensionSystem::IPlugin { Q_OBJECT @@ -106,7 +87,6 @@ void QtSupportPlugin::initialize() #endif setupQtVersionManager(this); - setupQmakeToolFactory(); setupDesktopQtVersion(); setupEmbeddedLinuxQtVersion(); diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp index a01ac526643..8637686c022 100644 --- a/src/plugins/qtsupport/qtversionmanager.cpp +++ b/src/plugins/qtsupport/qtversionmanager.cpp @@ -120,7 +120,8 @@ public: bool restoreQtVersions(); void findSystemQt(const IDeviceConstPtr &device); - void handleDeviceToolDetectionRequest(Id deviceId); + void addQtVersionsFromFilePaths(const FilePaths &filePaths); + void handleDeviceToolDetectionRequest(Id deviceId, const FilePaths &searchPaths); void saveQtVersions(); void updateDocumentation(const QtVersions &added, @@ -452,6 +453,7 @@ QString QtVersionManagerImpl::qmakePath(const QString &qtchooser, const QString FilePaths QtVersionManagerImpl::gatherQmakePathsFromQtChooser() { + // FIXME: Desktop-only const QString qtchooser = QStandardPaths::findExecutable(QStringLiteral("qtchooser")); if (qtchooser.isEmpty()) return {}; @@ -474,7 +476,12 @@ void QtVersionManagerImpl::findSystemQt(const IDeviceConstPtr &device) FilePaths systemQMakes = BuildableHelperLibrary::findQtsInEnvironment( device->systemEnvironment(), device->rootPath()); systemQMakes.append(gatherQmakePathsFromQtChooser()); - for (const FilePath &qmakePath : std::as_const(systemQMakes)) { + addQtVersionsFromFilePaths(systemQMakes); +} + +void QtVersionManagerImpl::addQtVersionsFromFilePaths(const FilePaths &filePaths) +{ + for (const FilePath &qmakePath : filePaths) { if (BuildableHelperLibrary::isQtChooser(qmakePath)) continue; const auto isSameQmake = [qmakePath](const QtVersion *version) { @@ -489,10 +496,12 @@ void QtVersionManagerImpl::findSystemQt(const IDeviceConstPtr &device) } } -void QtVersionManagerImpl::handleDeviceToolDetectionRequest(Id deviceId) +void QtVersionManagerImpl::handleDeviceToolDetectionRequest(Id deviceId, const FilePaths &searchPaths) { + Q_UNUSED(deviceId) + const VersionMap qtVersions = m_versions; - findSystemQt(DeviceManager::find(deviceId)); + addQtVersionsFromFilePaths(BuildableHelperLibrary::findQtsInPaths(searchPaths)); if (qtVersions != m_versions) { saveQtVersions(); emit QtVersionManager::instance()->qtVersionsChanged(m_versions.keys()); |
