aboutsummaryrefslogtreecommitdiffstats
path: root/QtVsTools.Core
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2021-12-06 19:03:00 +0100
committerKarsten Heimrich <karsten.heimrich@qt.io>2021-12-07 14:36:53 +0000
commit7cc928643939d5a361ce9410cb55902eab12be8e (patch)
tree97777da89050bdfa5305a9a108605f2322ff12f3 /QtVsTools.Core
parentcca48eb4c98069c96289145ffc3d0f9eeb2798a4 (diff)
Remove QtModule enumeration
The ID's are now calculated by reading it from the qtmodules.xml. Remove the global enumeration and use int directly instead. Change-Id: Ic8a083e5e9d115d86a0c905191da405ff3c2511c Reviewed-by: Miguel Costa <miguel.costa@qt.io>
Diffstat (limited to 'QtVsTools.Core')
-rw-r--r--QtVsTools.Core/QtModule.cs87
-rw-r--r--QtVsTools.Core/QtModuleInfo.cs10
-rw-r--r--QtVsTools.Core/QtModules.cs7
-rw-r--r--QtVsTools.Core/QtProject.cs14
-rw-r--r--QtVsTools.Core/QtVsTools.Core.csproj1
5 files changed, 13 insertions, 106 deletions
diff --git a/QtVsTools.Core/QtModule.cs b/QtVsTools.Core/QtModule.cs
deleted file mode 100644
index 58136ced..00000000
--- a/QtVsTools.Core/QtModule.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the Qt VS Tools.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-namespace QtVsTools.Core
-{
- public enum QtModule
- {
- Invalid = -1,
- Core = 1,
- Xml = 2,
- Sql = 3,
- OpenGL = 4,
- Network = 5,
- // Compat = 6,
- Gui = 7,
- ActiveQtS = 8,
- ActiveQtC = 9,
- Main = 10,
- // Qt3Library = 11, // ### unused
- // Qt3Main = 12, // ### unused
- Svg = 13,
- Designer = 14,
- Test = 15,
- Script = 16,
- Help = 17,
- WebKit = 18,
- XmlPatterns = 19,
- Enginio = 20,
- Multimedia = 21,
- Declarative = 22,
- ScriptTools = 23,
- UiTools = 24,
-
- Widgets = 25,
- ThreeD = 26,
- Location = 27,
- Nfc = 28,
- Qml = 29,
- Bluetooth = 30,
- Positioning = 31,
- SerialPort = 32,
- PrintSupport = 33,
- WebChannel = 34,
- WebSockets = 35,
- Sensors = 36,
- WindowsExtras = 37,
- QuickWidgets = 38,
- // JSBackend = 39,
- Quick = 40,
- ThreeDQuick = 41,
- // Feedback = 42,
- // QA = 43,
- // QLALR = 44,
- // RepoTools = 45,
- // Translations = 46,
- // CLucene = 48,
- // DesignerComponents = 49,
- WebkitWidgets = 50,
- Concurrent = 51,
- MultimediaWidgets = 52
- }
-}
diff --git a/QtVsTools.Core/QtModuleInfo.cs b/QtVsTools.Core/QtModuleInfo.cs
index 70cb1d7a..c9ef77ed 100644
--- a/QtVsTools.Core/QtModuleInfo.cs
+++ b/QtVsTools.Core/QtModuleInfo.cs
@@ -34,7 +34,6 @@ namespace QtVsTools.Core
{
public class QtModuleInfo
{
- private QtModule moduleId = QtModule.Invalid;
public string Name;
public string ResourceName;
public bool Selectable;
@@ -69,15 +68,12 @@ namespace QtVsTools.Core
}
}
- public QtModuleInfo(QtModule id)
+ public QtModuleInfo(int id)
{
- moduleId = id;
+ ModuleId = id;
}
- public QtModule ModuleId
- {
- get { return moduleId; }
- }
+ public int ModuleId { get; } = -1;
public List<string> GetIncludePath()
{
diff --git a/QtVsTools.Core/QtModules.cs b/QtVsTools.Core/QtModules.cs
index c4bf2cb8..00a57d6a 100644
--- a/QtVsTools.Core/QtModules.cs
+++ b/QtVsTools.Core/QtModules.cs
@@ -39,14 +39,14 @@ namespace QtVsTools.Core
public class QtModules
{
private static QtModules instance = new QtModules();
- private readonly Dictionary<QtModule, QtModuleInfo> dictModuleInfos = new Dictionary<QtModule, QtModuleInfo>();
+ private readonly Dictionary<int, QtModuleInfo> dictModuleInfos = new Dictionary<int, QtModuleInfo>();
public static QtModules Instance
{
get { return instance; }
}
- public QtModuleInfo ModuleInformation(QtModule moduleId)
+ public QtModuleInfo ModuleInformation(int moduleId)
{
QtModuleInfo moduleInfo;
dictModuleInfos.TryGetValue(moduleId, out moduleInfo);
@@ -81,8 +81,7 @@ namespace QtVsTools.Core
} catch { }
if (xml != null) {
foreach (var xModule in xml.Elements("QtVsTools").Elements("Module")) {
- var id = (string)xModule.Attribute("Id");
- QtModule moduleId = (QtModule)Convert.ToUInt32(id);
+ int moduleId = (int)xModule.Attribute("Id");
moduleInfo = new QtModuleInfo(moduleId);
moduleInfo.Name = (string)xModule.Element("Name");
moduleInfo.ResourceName = (string)xModule.Element("ResourceName");
diff --git a/QtVsTools.Core/QtProject.cs b/QtVsTools.Core/QtProject.cs
index 344da799..117e3a7a 100644
--- a/QtVsTools.Core/QtProject.cs
+++ b/QtVsTools.Core/QtProject.cs
@@ -386,9 +386,9 @@ namespace QtVsTools.Core
}
}
- public void AddModule(QtModule module)
+ public void AddModule(int moduleId)
{
- if (HasModule(module))
+ if (HasModule(moduleId))
return;
var vm = QtVersionManager.The();
@@ -398,7 +398,7 @@ namespace QtVsTools.Core
foreach (VCConfiguration config in (IVCCollection)vcPro.Configurations) {
- var info = QtModules.Instance.ModuleInformation(module);
+ var info = QtModules.Instance.ModuleInformation(moduleId);
if (FormatVersion >= Resources.qtMinFormatVersion_Settings) {
var config3 = config as VCConfiguration3;
if (config3 == null)
@@ -451,13 +451,13 @@ namespace QtVsTools.Core
}
}
- public void RemoveModule(QtModule module)
+ public void RemoveModule(int moduleId)
{
foreach (VCConfiguration config in (IVCCollection)vcPro.Configurations) {
var compiler = CompilerToolWrapper.Create(config);
var linker = (VCLinkerTool)((IVCCollection)config.Tools).Item("VCLinkerTool");
- var info = QtModules.Instance.ModuleInformation(module);
+ var info = QtModules.Instance.ModuleInformation(moduleId);
if (compiler != null) {
foreach (var define in info.Defines)
compiler.RemovePreprocessorDefinition(define);
@@ -538,7 +538,7 @@ namespace QtVsTools.Core
}
}
- public bool HasModule(QtModule module)
+ public bool HasModule(int moduleId)
{
var foundInIncludes = false;
var foundInLibs = false;
@@ -549,7 +549,7 @@ namespace QtVsTools.Core
versionInfo = vm.GetVersionInfo(vm.GetDefaultVersion());
if (versionInfo == null)
return false; // neither a default or project Qt version
- var info = QtModules.Instance.ModuleInformation(module);
+ var info = QtModules.Instance.ModuleInformation(moduleId);
if (info == null)
return false;
diff --git a/QtVsTools.Core/QtVsTools.Core.csproj b/QtVsTools.Core/QtVsTools.Core.csproj
index bc8a83e1..5daef37a 100644
--- a/QtVsTools.Core/QtVsTools.Core.csproj
+++ b/QtVsTools.Core/QtVsTools.Core.csproj
@@ -160,7 +160,6 @@
<Compile Include="QrcParser.cs" />
<Compile Include="QrcPrefix.cs" />
<Compile Include="QtConfig.cs" />
- <Compile Include="QtModule.cs" />
<Compile Include="QtModuleInfo.cs" />
<Compile Include="QtModules.cs" />
<Compile Include="QtMsBuild.cs" />