// Copyright (C) 2025 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 using System.Collections.Generic; using System.ComponentModel.Composition; using System.Linq; using System.Threading.Tasks; using Microsoft.Build.Framework.XamlTypes; using Microsoft.VisualStudio.ProjectSystem; using Microsoft.VisualStudio.ProjectSystem.Properties; namespace QtVsTools.Package.MsBuild { using Core; [ExportDynamicEnumValuesProvider("QtVersionProvider")] [AppliesTo("IntegratedConsoleDebugging")] internal class QtVersionProvider : IDynamicEnumValuesProvider, IDynamicEnumValuesGenerator { [ImportingConstructor] protected QtVersionProvider(UnconfiguredProject project) { } public async Task GetProviderAsync(IList opts) { return await Task.FromResult(this); } public bool AllowCustomValues => true; public async Task> GetListedValuesAsync() { return await Task.FromResult(QtVersionManager.GetVersions() .Select(x => new PageEnumValue(new EnumValue { Name = x, DisplayName = x })) .Cast() .ToList()); } public async Task TryCreateEnumValueAsync(string userSuppliedValue) { return await Task.FromResult(new PageEnumValue(new EnumValue { Name = userSuppliedValue, DisplayName = userSuppliedValue })); } } }