aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiguel Costa <miguel.costa@qt.io>2021-02-11 11:42:02 +0100
committerMiguel Costa <miguel.costa@qt.io>2021-03-03 09:20:08 +0000
commitb05f7363a2920b3aee1dc58f11aeada23e4d1891 (patch)
tree005426c398ff05fb3b89ae998d02f9adfffce65a
parent3ba1e0f7be14b7dae22c00e6ca09d5c00df0373b (diff)
Move legacy options to separate page
Entries in the Qt Options page pertaining to legacy Qt VS projects, i.e. projects using custom build steps to run Qt tools, are now located in a separate options page, as these options are no longer supported. Also in this change: * Renamed 'QtOptionPage' class to 'QtOptionsPage' * Removed unused VSQtSettings module Change-Id: I9da5f7f8f6b7bd9e3778c87e53a5eef6f6f496eb Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r--src/qtvstools/Options/QtLegacyOptionsPage.cs (renamed from src/qtvstools/Options/QtOptionPage.cs)104
-rw-r--r--src/qtvstools/Options/QtOptionsPage.cs132
-rw-r--r--src/qtvstools/QtMainMenu.cs2
-rw-r--r--src/qtvstools/QtVsTools.csproj6
-rw-r--r--src/qtvstools/VSQtSettings.cs282
-rw-r--r--src/qtvstools/Vsix.cs14
6 files changed, 168 insertions, 372 deletions
diff --git a/src/qtvstools/Options/QtOptionPage.cs b/src/qtvstools/Options/QtLegacyOptionsPage.cs
index 3b5065a4..70b97e97 100644
--- a/src/qtvstools/Options/QtOptionPage.cs
+++ b/src/qtvstools/Options/QtLegacyOptionsPage.cs
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2020 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt VS Tools.
@@ -28,108 +28,54 @@
using System;
using System.ComponentModel;
-using System.Globalization;
using Microsoft.Win32;
using Microsoft.VisualStudio.Shell;
using QtVsTools.Core;
-using QtVsTools.Common;
namespace QtVsTools.Options
{
- using static EnumExt;
-
- public class QtOptionPage : DialogPage
+ public class QtLegacyOptionsPage : DialogPage
{
- public enum QtOptions
- {
- [String("QMLDebug_Timeout")] QmlDebugTimeout
- }
-
- public enum Timeout : uint { Disabled = 0 }
-
- class TimeoutConverter : EnumConverter
- {
- public TimeoutConverter(Type t) : base(t)
- { }
-
- public override bool GetStandardValuesSupported(ITypeDescriptorContext c)
- => true;
-
- public override bool GetStandardValuesExclusive(ITypeDescriptorContext c)
- => false;
-
- public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext c)
- => new StandardValuesCollection(new[] { Timeout.Disabled });
-
- public override object ConvertFrom(
- ITypeDescriptorContext context,
- CultureInfo culture,
- object value)
- {
- uint n = 0;
- try {
- n = Convert.ToUInt32(value);
- } catch { }
- return (Timeout)n;
- }
-
- public override object ConvertTo(
- ITypeDescriptorContext context,
- CultureInfo culture,
- object value,
- Type destinationType)
- {
- if (destinationType == typeof(string))
- return value.ToString();
- return base.ConvertTo(context, culture, value, destinationType);
- }
- }
-
- [Category("Source control")]
- [DisplayName("Ask before checking out files")]
+ [Category(@"Qt VS Project Format v2 (Qt tools integrated via custom-build steps)")]
+ [DisplayName("Source control: Ask before checking out files")]
public bool CheckoutPrompt { get; set; }
- [Category("Source control")]
- [DisplayName("Enable file check-out")]
+ [Category(@"Qt VS Project Format v2 (Qt tools integrated via custom-build steps)")]
+ [DisplayName("Source control: Enable file check-out")]
public bool Checkout { get; set; }
- [Category("Linguist (lupdate/lrelease)")]
- [DisplayName("Default lrelease options")]
+ [Category(@"Qt VS Project Format v2 (Qt tools integrated via custom-build steps)")]
+ [DisplayName("Linguist: Default lrelease options")]
public string DefaultLReleaseOptions { get; set; }
- [Category("Linguist (lupdate/lrelease)")]
- [DisplayName("Default lupdate options")]
+ [Category(@"Qt VS Project Format v2 (Qt tools integrated via custom-build steps)")]
+ [DisplayName("Linguist: Default lupdate options")]
public string DefaultLUpdateOptions { get; set; }
- [Category("Linguist (lupdate/lrelease)")]
- [DisplayName("Run lupdate during build")]
+ [Category(@"Qt VS Project Format v2 (Qt tools integrated via custom-build steps)")]
+ [DisplayName("Linguist: Run lupdate during build")]
public bool EnableLUpdateOnBuild { get; set; }
- [Category("Meta-Object Compiler (moc)")]
- [DisplayName("Default moc generated files directory")]
+ [Category(@"Qt VS Project Format v2 (Qt tools integrated via custom-build steps)")]
+ [DisplayName("Meta-Object Compiler: Default moc generated files directory")]
public string DefaultMocDir { get; set; }
- [Category("Meta-Object Compiler (moc)")]
- [DisplayName("Default additional moc options ")]
+ [Category(@"Qt VS Project Format v2 (Qt tools integrated via custom-build steps)")]
+ [DisplayName("Meta-Object Compiler: Default additional moc options ")]
public string AdditionalMocOptions { get; set; }
- [Category("Meta-Object Compiler (moc)")]
- [DisplayName("Enable automatic moc")]
+ [Category(@"Qt VS Project Format v2 (Qt tools integrated via custom-build steps)")]
+ [DisplayName("Meta-Object Compiler: Enable automatic moc")]
public bool AutoMoc { get; set; }
- [Category("Resource Compiler (rcc)")]
- [DisplayName("Default rcc generated files directory")]
+ [Category(@"Qt VS Project Format v2 (Qt tools integrated via custom-build steps)")]
+ [DisplayName("Resource Compiler: Default rcc generated files directory")]
public string DefaultRccDir { get; set; }
- [Category("User Interface Compiler (uic)")]
- [DisplayName("Default uic generated files directory")]
+ [Category(@"Qt VS Project Format v2 (Qt tools integrated via custom-build steps)")]
+ [DisplayName("User Interface Compiler: Default uic generated files directory")]
public string DefaultUicDir { get; set; }
- [Category("QML Debugging")]
- [DisplayName("Runtime connection timeout (msecs)")]
- [TypeConverter(typeof(TimeoutConverter))]
- public Timeout QmlDebuggerTimeout { get; set; }
-
public override void ResetSettings()
{
CheckoutPrompt = true;
@@ -142,7 +88,6 @@ namespace QtVsTools.Options
AutoMoc = true;
DefaultRccDir = "";
DefaultUicDir = "";
- QmlDebuggerTimeout = (Timeout)60000;
}
public override void LoadSettingsFromStorage()
@@ -173,8 +118,6 @@ namespace QtVsTools.Options
DefaultRccDir = rccDir;
if (key.GetValue(Resources.uicDirKeyword) is string uicDir)
DefaultUicDir = uicDir;
- if (key.GetValue(QtOptions.QmlDebugTimeout.Cast<string>()) is int qmlTimeout)
- QmlDebuggerTimeout = (Timeout)qmlTimeout;
}
} catch (Exception exception) {
Messages.Print(
@@ -199,9 +142,6 @@ namespace QtVsTools.Options
key.SetValue(Resources.disableAutoMocStepsUpdateKeyword, AutoMoc ? 0 : 1);
key.SetValue(Resources.rccDirKeyword, DefaultRccDir);
key.SetValue(Resources.uicDirKeyword, DefaultUicDir);
- key.SetValue(
- QtOptions.QmlDebugTimeout.Cast<string>(),
- (int)QmlDebuggerTimeout);
}
} catch (Exception exception) {
Messages.Print(
diff --git a/src/qtvstools/Options/QtOptionsPage.cs b/src/qtvstools/Options/QtOptionsPage.cs
new file mode 100644
index 00000000..4b82275e
--- /dev/null
+++ b/src/qtvstools/Options/QtOptionsPage.cs
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 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$
+**
+****************************************************************************/
+
+using System;
+using System.ComponentModel;
+using System.Globalization;
+using Microsoft.Win32;
+using Microsoft.VisualStudio.Shell;
+using QtVsTools.Core;
+using QtVsTools.Common;
+
+namespace QtVsTools.Options
+{
+ using static EnumExt;
+
+ public class QtOptionsPage : DialogPage
+ {
+ public enum QtOptions
+ {
+ [String("QMLDebug_Timeout")] QmlDebugTimeout
+ }
+
+ public enum Timeout : uint { Disabled = 0 }
+
+ class TimeoutConverter : EnumConverter
+ {
+ public TimeoutConverter(Type t) : base(t)
+ { }
+
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext c)
+ => true;
+
+ public override bool GetStandardValuesExclusive(ITypeDescriptorContext c)
+ => false;
+
+ public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext c)
+ => new StandardValuesCollection(new[] { Timeout.Disabled });
+
+ public override object ConvertFrom(
+ ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value)
+ {
+ uint n = 0;
+ try {
+ n = Convert.ToUInt32(value);
+ } catch { }
+ return (Timeout)n;
+ }
+
+ public override object ConvertTo(
+ ITypeDescriptorContext context,
+ CultureInfo culture,
+ object value,
+ Type destinationType)
+ {
+ if (destinationType == typeof(string))
+ return value.ToString();
+ return base.ConvertTo(context, culture, value, destinationType);
+ }
+ }
+
+ [Category("QML Debugging")]
+ [DisplayName("Runtime connection timeout (msecs)")]
+ [TypeConverter(typeof(TimeoutConverter))]
+ public Timeout QmlDebuggerTimeout { get; set; }
+
+ public override void ResetSettings()
+ {
+ QmlDebuggerTimeout = (Timeout)60000;
+ }
+
+ public override void LoadSettingsFromStorage()
+ {
+ ResetSettings();
+ try {
+ using (var key = Registry.CurrentUser
+ .OpenSubKey(@"SOFTWARE\" + Resources.registryPackagePath, writable: false)) {
+ if (key == null)
+ return;
+ if (key.GetValue(QtOptions.QmlDebugTimeout.Cast<string>()) is int qmlTimeout)
+ QmlDebuggerTimeout = (Timeout)qmlTimeout;
+ }
+ } catch (Exception exception) {
+ Messages.Print(
+ exception.Message + "\r\n\r\nStacktrace:\r\n" + exception.StackTrace);
+ }
+ }
+
+ public override void SaveSettingsToStorage()
+ {
+ try {
+ using (var key = Registry.CurrentUser
+ .CreateSubKey(@"SOFTWARE\" + Resources.registryPackagePath)) {
+ if (key == null)
+ return;
+ key.SetValue(
+ QtOptions.QmlDebugTimeout.Cast<string>(),
+ (int)QmlDebuggerTimeout);
+ }
+ } catch (Exception exception) {
+ Messages.Print(
+ exception.Message + "\r\n\r\nStacktrace:\r\n" + exception.StackTrace);
+ }
+ }
+ }
+}
diff --git a/src/qtvstools/QtMainMenu.cs b/src/qtvstools/QtMainMenu.cs
index 66aac22c..d2bfb3ef 100644
--- a/src/qtvstools/QtMainMenu.cs
+++ b/src/qtvstools/QtMainMenu.cs
@@ -204,7 +204,7 @@ namespace QtVsTools
}
break;
case CommandId.QtOptionsId:
- Vsix.Instance.ShowOptionPage(typeof(Options.QtOptionPage));
+ Vsix.Instance.ShowOptionPage(typeof(Options.QtOptionsPage));
break;
case CommandId.QtVersionsId:
Vsix.Instance.ShowOptionPage(typeof(Options.QtVersionsPage));
diff --git a/src/qtvstools/QtVsTools.csproj b/src/qtvstools/QtVsTools.csproj
index c7127d52..2f0c5cea 100644
--- a/src/qtvstools/QtVsTools.csproj
+++ b/src/qtvstools/QtVsTools.csproj
@@ -84,7 +84,10 @@
<Compile Include="FormProjectQtSettings.Designer.cs">
<DependentUpon>FormProjectQtSettings.cs</DependentUpon>
</Compile>
- <Compile Include="Options\QtOptionPage.cs">
+ <Compile Include="Options\QtLegacyOptionsPage.cs">
+ <SubType>Component</SubType>
+ </Compile>
+ <Compile Include="Options\QtOptionsPage.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Options\QtVersionsTable.cs">
@@ -167,7 +170,6 @@
<Compile Include="VisualStudio\VsShell.cs" />
<Compile Include="VisualStudio\VsShellSettings.cs" />
<Compile Include="Vsix.cs" />
- <Compile Include="VSQtSettings.cs" />
<Compile Include="VsToolsDialogWindow.cs" />
</ItemGroup>
<ItemGroup>
diff --git a/src/qtvstools/VSQtSettings.cs b/src/qtvstools/VSQtSettings.cs
deleted file mode 100644
index 52b95a77..00000000
--- a/src/qtvstools/VSQtSettings.cs
+++ /dev/null
@@ -1,282 +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$
-**
-****************************************************************************/
-
-using Microsoft.VisualStudio.Settings;
-using Microsoft.VisualStudio.Shell.Interop;
-using Microsoft.VisualStudio.Shell.Settings;
-using QtVsTools.Core;
-using QtVsTools.VisualStudio;
-using System.ComponentModel;
-using System.Text.RegularExpressions;
-
-namespace QtVsTools
-{
- public class VSQtSettings : Observable
- {
- public VSQtSettings()
- {
- newMocDir = QtVSIPSettings.GetMocDirectory();
- newMocOptions = QtVSIPSettings.GetMocOptions();
- newRccDir = QtVSIPSettings.GetRccDirectory();
- newUicDir = QtVSIPSettings.GetUicDirectory();
- newLUpdateOnBuild = QtVSIPSettings.GetLUpdateOnBuild();
- newLUpdateOptions = QtVSIPSettings.GetLUpdateOptions();
- newLReleaseOptions = QtVSIPSettings.GetLReleaseOptions();
- newAskBeforeCheckoutFile = QtVSIPSettings.GetAskBeforeCheckoutFile();
- newDisableCheckoutFiles = QtVSIPSettings.GetDisableCheckoutFiles();
- newDisableAutoMOCStepsUpdate = QtVSIPSettings.GetDisableAutoMocStepsUpdate();
-
- var settingsManager = VsShellSettings.Manager;
- var store = settingsManager.GetReadOnlySettingsStore(SettingsScope.UserSettings);
-
-#if VS2013
- EnableQmlClassifier = store.GetBoolean(Statics.QmlClassifierPath,
- Statics.QmlClassifierKey, true);
-#else
- EnableQmlTextMate = store.GetBoolean(Statics.QmlTextMatePath,
- Statics.QmlTextMateKey, true);
-#endif
- }
-
- private string newMocDir;
- private string newMocOptions;
- private string newRccDir;
- private string newUicDir;
- private bool newLUpdateOnBuild;
- private string newLUpdateOptions;
- private string newLReleaseOptions;
- private bool newAskBeforeCheckoutFile = true;
- private bool newDisableCheckoutFiles = true;
- private bool newDisableAutoMOCStepsUpdate;
-
- public void SaveSettings()
- {
- QtVSIPSettings.SaveMocDirectory(newMocDir);
- QtVSIPSettings.SaveMocOptions(newMocOptions);
- QtVSIPSettings.SaveUicDirectory(newUicDir);
- QtVSIPSettings.SaveRccDirectory(newRccDir);
- QtVSIPSettings.SaveLUpdateOnBuild(newLUpdateOnBuild);
- QtVSIPSettings.SaveLUpdateOptions(newLUpdateOptions);
- QtVSIPSettings.SaveLReleaseOptions(newLReleaseOptions);
- QtVSIPSettings.SaveAskBeforeCheckoutFile(newAskBeforeCheckoutFile);
- QtVSIPSettings.SaveDisableCheckoutFiles(newDisableCheckoutFiles);
- QtVSIPSettings.SaveDisableAutoMocStepsUpdate(newDisableAutoMOCStepsUpdate);
-
- var settingsManager = VsShellSettings.Manager;
- var store = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);
-
-#if VS2013
- store.CreateCollection(Statics.QmlClassifierPath);
- store.SetBoolean(Statics.QmlClassifierPath, Statics.QmlClassifierKey,
- EnableQmlClassifier);
-#else
- store.CreateCollection(Statics.QmlTextMatePath);
- store.SetBoolean(Statics.QmlTextMatePath, Statics.QmlTextMateKey, EnableQmlTextMate);
-#endif
- }
-
- public string MocDirectory
- {
- get
- {
- return newMocDir;
- }
- set
- {
- var tmp = HelperFunctions.NormalizeRelativeFilePath(value);
- if (tmp.ToLower() == newMocDir.ToLower())
- return;
-
- string badMacros = ProjectQtSettings.IncompatibleMacros(tmp);
- if (!string.IsNullOrEmpty(badMacros))
- Messages.DisplayErrorMessage(SR.GetString("IncompatibleMacros", badMacros));
- else
- newMocDir = tmp;
- }
- }
-
- public string MocOptions
- {
- get
- {
- return newMocOptions;
- }
-
- set
- {
- newMocOptions = value;
- }
- }
-
- public string UicDirectory
- {
- get
- {
- return newUicDir;
- }
- set
- {
- var tmp = HelperFunctions.NormalizeRelativeFilePath(value);
- if (tmp.ToLower() == newUicDir.ToLower())
- return;
-
- string badMacros = ProjectQtSettings.IncompatibleMacros(tmp);
- if (!string.IsNullOrEmpty(badMacros))
- Messages.DisplayErrorMessage(SR.GetString("IncompatibleMacros", badMacros));
- else
- newUicDir = tmp;
- }
- }
-
- public string RccDirectory
- {
- get
- {
- return newRccDir;
- }
- set
- {
- var tmp = HelperFunctions.NormalizeRelativeFilePath(value);
- if (tmp.ToLower() == newRccDir.ToLower())
- return;
-
- string badMacros = ProjectQtSettings.IncompatibleMacros(tmp);
- if (!string.IsNullOrEmpty(badMacros))
- Messages.DisplayErrorMessage(SR.GetString("IncompatibleMacros", badMacros));
- else
- newRccDir = tmp;
- }
- }
-
- public bool lupdateOnBuild
- {
- get
- {
- return newLUpdateOnBuild;
- }
- set
- {
- newLUpdateOnBuild = value;
- }
- }
-
- public string LUpdateOptions
- {
- get
- {
- return newLUpdateOptions;
- }
-
- set
- {
- newLUpdateOptions = value;
- }
- }
-
- public string LReleaseOptions
- {
- get
- {
- return newLReleaseOptions;
- }
-
- set
- {
- newLReleaseOptions = value;
- }
- }
-
- [DisplayName("Ask before checkout files")]
- public bool ask_before_checkout_file
- {
- get
- {
- return newAskBeforeCheckoutFile;
- }
- set
- {
- newAskBeforeCheckoutFile = value;
- }
- }
-
- [DisplayName("Disable checkout files")]
- public bool disable_checkout_files
- {
- get
- {
- return newDisableCheckoutFiles;
- }
-
- set
- {
- newDisableCheckoutFiles = value;
- }
- }
-
- [DisplayName("Disable auto MOC steps update")]
- public bool disable_auto_MOC_steps_update
- {
- get
- {
- return newDisableAutoMOCStepsUpdate;
- }
-
- set
- {
- newDisableAutoMOCStepsUpdate = value;
- }
- }
-
-#if VS2013
- [DisplayName("Use QML classifier")]
- public bool EnableQmlClassifier { get; set; }
-#else
- private bool _enableQmlTextMate = true;
- [DisplayName("Use QML TextMate language file")]
- public bool EnableQmlTextMate
- {
- get { return _enableQmlTextMate; }
- set { SetValue(ref _enableQmlTextMate, value); }
- }
-#endif
-
- private static bool ContainsInvalidVariable(string directory)
- {
- if (string.IsNullOrEmpty(directory))
- return false;
-
- var matches = Regex.Matches(directory, "\\$\\([^\\)]+\\)");
- foreach (var m in matches) {
- if (m.ToString() != "$(ConfigurationName)" && m.ToString() != "$(PlatformName)")
- return true;
- }
- return false;
- }
- }
-}
-
diff --git a/src/qtvstools/Vsix.cs b/src/qtvstools/Vsix.cs
index 93bffddf..74dca376 100644
--- a/src/qtvstools/Vsix.cs
+++ b/src/qtvstools/Vsix.cs
@@ -93,12 +93,16 @@ namespace QtVsTools
#endif
// Options page
- [ProvideOptionPage(typeof(Options.QtOptionPage),
- "Qt", "General", 0, 0, true)]
+ [ProvideOptionPage(typeof(Options.QtOptionsPage),
+ "Qt", "General", 0, 0, true, Sort = 0)]
// Qt Versions page
[ProvideOptionPage(typeof(Options.QtVersionsPage),
- "Qt", "Versions", 0, 0, true)]
+ "Qt", "Versions", 0, 0, true, Sort = 1)]
+
+ // Legacy options page
+ [ProvideOptionPage(typeof(Options.QtLegacyOptionsPage),
+ "Qt", "Legacy Project Format", 0, 0, true, Sort = 2)]
public sealed class Vsix : AsyncPackage, IVsServiceProvider, IProjectTracker
{
@@ -142,8 +146,8 @@ namespace QtVsTools
}
}
- public Options.QtOptionPage Options
- => GetDialogPage(typeof(Options.QtOptionPage)) as Options.QtOptionPage;
+ public Options.QtOptionsPage Options
+ => GetDialogPage(typeof(Options.QtOptionsPage)) as Options.QtOptionsPage;
private string qmakeFileReaderPath;
public string QMakeFileReaderPath