From 104c1f3757b0dc60b3dd2cd3ee9fe4dc09f05557 Mon Sep 17 00:00:00 2001 From: Daniel Teske Date: Mon, 14 Jan 2013 15:31:49 +0100 Subject: [PATCH] Only show Visual Studio compilers if VS is installed Task-number: QTCREATORBUG-8487 Change-Id: Ibc812f14cd8e4de765cabf27d23451c06611d372 Reviewed-by: Friedemann Kleint Reviewed-by: Daniel Teske --- src/plugins/projectexplorer/msvctoolchain.cpp | 15 +++++++++++++++ src/plugins/projectexplorer/msvctoolchain.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index a47d1039e05..00aa65d994f 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -440,6 +440,19 @@ QString MsvcToolChainFactory::id() const return QLatin1String(Constants::MSVC_TOOLCHAIN_ID); } +bool MsvcToolChainFactory::checkForVisualStudioInstallation(const QString &vsName) +{ + const QSettings vsRegistry( +#ifdef Q_OS_WIN64 + QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\SxS\\VS7"), +#else + QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VS7"), +#endif + QSettings::NativeFormat); + + return vsRegistry.contains(vsName); +} + QList MsvcToolChainFactory::autoDetect() { QList results; @@ -501,6 +514,8 @@ QList MsvcToolChainFactory::autoDetect() const int dotPos = vsName.indexOf(QLatin1Char('.')); if (dotPos == -1) continue; + if (!checkForVisualStudioInstallation(vsName)) + continue; const QString path = vsRegistry.value(vsName).toString(); const int version = vsName.left(dotPos).toInt(); diff --git a/src/plugins/projectexplorer/msvctoolchain.h b/src/plugins/projectexplorer/msvctoolchain.h index 8afbf6ebb72..21a0582aaa1 100644 --- a/src/plugins/projectexplorer/msvctoolchain.h +++ b/src/plugins/projectexplorer/msvctoolchain.h @@ -106,6 +106,8 @@ public: { return MsvcToolChain::readFromMap(data); } ToolChainConfigWidget *configurationWidget(ToolChain *); +private: + static bool checkForVisualStudioInstallation(const QString &vsName); }; // --------------------------------------------------------------------------