diff options
author | Karsten Heimrich <karsten.heimrich@qt.io> | 2024-01-08 14:31:17 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2024-01-16 10:45:08 +0000 |
commit | f725baa8f876bf04aef7f423e75777313adc488c (patch) | |
tree | 83f7a9980f31fadc0ec838180a88a34db3491183 /QtVsTools.Wizards | |
parent | ebcfd90ef0e5960c4168781aaa780765896f7bd9 (diff) |
Refactor Qt version information retrieval for improved concurrency
* Removed unnecessary initialization delays on extension loading.
* Ensured thread safety using a semaphore for cache access.
* Utilized concurrent dictionary for version information caching.
* Cleaned up code for clarity and maintainability.
Change-Id: I01f4d8f4b1bd575d28fa3d3f09c46af7f0fe4c32
Reviewed-by: Miguel Costa <miguel.costa@qt.io>
Diffstat (limited to 'QtVsTools.Wizards')
-rw-r--r-- | QtVsTools.Wizards/ProjectWizard/ConfigPage.xaml.cs | 12 | ||||
-rw-r--r-- | QtVsTools.Wizards/ProjectWizard/ProjectTemplateWizard.cs | 2 |
2 files changed, 7 insertions, 7 deletions
diff --git a/QtVsTools.Wizards/ProjectWizard/ConfigPage.xaml.cs b/QtVsTools.Wizards/ProjectWizard/ConfigPage.xaml.cs index 8ece4590..e069dece 100644 --- a/QtVsTools.Wizards/ProjectWizard/ConfigPage.xaml.cs +++ b/QtVsTools.Wizards/ProjectWizard/ConfigPage.xaml.cs @@ -119,7 +119,7 @@ namespace QtVsTools.Wizards.ProjectWizard private IEnumerable<string> qtVersionList; - readonly QtVersionManager qtVersionManager = QtVersionManager.The(); + readonly QtVersionManager qtVersionManager = QtVersionManager.The; readonly VersionInformation defaultQtVersionInfo; CloneableList<Config> defaultConfigs; @@ -147,7 +147,7 @@ namespace QtVsTools.Wizards.ProjectWizard Loaded -= OnLoaded; qtVersionList = new[] { QT_VERSION_DEFAULT, QT_VERSION_BROWSE } - .Union(QtVersionManager.The().GetVersions()); + .Union(QtVersionManager.GetVersions()); if (defaultQtVersionInfo != null) SetupDefaultConfigsAndConfigTable(defaultQtVersionInfo); @@ -343,7 +343,7 @@ namespace QtVsTools.Wizards.ProjectWizard comboBoxQtVersion.Text = config.QtVersionName; break; default: - if (qtVersionManager.GetVersions().Contains(comboBoxQtVersion.Text)) { + if (QtVersionManager.GetVersions().Contains(comboBoxQtVersion.Text)) { config.QtVersion = qtVersionManager.GetVersionInfo(comboBoxQtVersion.Text); config.QtVersionName = comboBoxQtVersion.Text; config.QtVersionPath = qtVersionManager.GetInstallPath(comboBoxQtVersion.Text); @@ -532,15 +532,15 @@ namespace QtVsTools.Wizards.ProjectWizard var versionName = $"{Path.GetFileName(qtVersionDir)}" + $"_{Path.GetFileName(qmakePath)}".Replace(" ", "_"); - qtVersionManager.SaveVersion(versionName, qmakePath); - qtVersionManager.SaveDefaultVersion(versionName); + QtVersionManager.SaveVersion(versionName, qmakePath); + QtVersionManager.SaveDefaultVersion(versionName); versionInfo.name = versionName; } catch (Exception exception) { Messages.Print("Could not save Qt version."); exception.Log(); } - qtVersionList = new[] { QT_VERSION_BROWSE }.Union(QtVersionManager.The().GetVersions()); + qtVersionList = new[] { QT_VERSION_BROWSE }.Union(QtVersionManager.GetVersions()); SetupDefaultConfigsAndConfigTable(versionInfo); diff --git a/QtVsTools.Wizards/ProjectWizard/ProjectTemplateWizard.cs b/QtVsTools.Wizards/ProjectWizard/ProjectTemplateWizard.cs index 777893eb..6a6ff696 100644 --- a/QtVsTools.Wizards/ProjectWizard/ProjectTemplateWizard.cs +++ b/QtVsTools.Wizards/ProjectWizard/ProjectTemplateWizard.cs @@ -183,7 +183,7 @@ namespace QtVsTools.Wizards.ProjectWizard protected TemplateParameters Parameter => Lazy.Get(() => Parameter, () => new TemplateParameters { Template = this }); - protected QtVersionManager VersionManager => QtVersionManager.The(); + protected QtVersionManager VersionManager => QtVersionManager.The; public virtual void ProjectItemFinishedGenerating(ProjectItem projectItem) { } public virtual void BeforeOpeningFile(ProjectItem projectItem) { } |