diff options
author | Oliver Wolff <oliver.wolff@qt.io> | 2016-04-28 15:07:10 +0200 |
---|---|---|
committer | Oliver Wolff <oliver.wolff@qt.io> | 2016-05-11 08:36:02 +0000 |
commit | 3ad7a914d2e2966d5626f071e52d02112b8d57e3 (patch) | |
tree | 15c249e7e1ac4e4f3e36cf80f6707f290b55f52f | |
parent | 556672ac2c86bcaaba9221477cef02e37f4cb8fd (diff) |
Fixed addition of WEC2013 Qt versions1.2
Since VS2010 it has not been possible to create a VCProjectEngine using
"new VCProjectEngineObject". The only way to obtain a project engine
is via currently open projects. As it is possible that the Qt options
dialog is shown while no project is open, we have to find another way of
obtaining the supported Windows CE platforms.
The needed information can be found in the SDK's Properties.xml. As the
installation paths of the Windows CE SDKs can be changed by the user,
they has to be obtained from the registry.
Task-numer: QTVSADDINBUG-422
Change-Id: I7173c3c2f2b09f6fd63e6b6ce17bbaa136148175
Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
-rw-r--r-- | Qt4VS2003/QtProjectLib/HelperFunctions.cs | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/Qt4VS2003/QtProjectLib/HelperFunctions.cs b/Qt4VS2003/QtProjectLib/HelperFunctions.cs index 868b3080..c40dbae6 100644 --- a/Qt4VS2003/QtProjectLib/HelperFunctions.cs +++ b/Qt4VS2003/QtProjectLib/HelperFunctions.cs @@ -1708,13 +1708,54 @@ namespace Digia.Qt5ProjectLib { availablePlatforms.Add(reader.ReadElementContentAsString()); } -#else +#elif VS2008 VCProjectEngine engine = new VCProjectEngineObject(); IVCCollection platforms = engine.Platforms as IVCCollection; foreach (VCPlatform platform in platforms) { availablePlatforms.Add(platform.Name); } +#else + // new VCProjectEngineObject(); does no longer work since VS2010 thus we have to fall + // back to parsing properties.xml inside the Windows CE SDK directories directly + RegistryKey base32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, + RegistryView.Registry32); + if (base32 == null) + return false; + RegistryKey sdks = base32.OpenSubKey("Software\\Microsoft\\Windows CE Tools\\SDKs", false); + if (sdks == null) + return false; + foreach (string platform in sdks.GetSubKeyNames()) + { + string sdkName = ""; + string ideFamily = ""; + RegistryKey platformKey = sdks.OpenSubKey(platform); + string path = platformKey.GetValue(null).ToString(); + path += "Properties.xml"; + + try + { + FileStream stream = new FileStream(path, FileMode.Open); + XmlReader reader = new XmlTextReader(stream); + while (reader.ReadToFollowing("Property")) + { + string attr = reader.GetAttribute("NAME"); + if (attr == "SDK name") + sdkName = reader.ReadString(); + else if (attr == "IdeFamily") + ideFamily = reader.ReadString(); + if (sdkName.Length != 0 && ideFamily.Length != 0) + { + availablePlatforms.Add(sdkName + " (" + ideFamily + ')'); + break; + } + } + } + catch + { + continue; + } + } #endif } |