aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2023-02-06 12:59:13 +0100
committerKarsten Heimrich <karsten.heimrich@qt.io>2023-02-23 14:28:18 +0000
commitd6336a90746eb4c34f391ce5b1b25575c9de07f6 (patch)
tree7126840cfa7226206a9cecfacf5d5ff23c2cb126
parent4384d2d4061f63ebc6a7cca6000f57bba4e3fa17 (diff)
Remove remaining resource strings and releated classes
Change-Id: I1f045d126060182694e7afed6b069b48ae6ab88d Reviewed-by: Miguel Costa <miguel.costa@qt.io>
-rw-r--r--QtVsTools.Core/Filters.cs10
-rw-r--r--QtVsTools.Core/Messages.cs35
-rw-r--r--QtVsTools.Core/QtProject.cs14
-rw-r--r--QtVsTools.Core/QtVersionManager.cs2
-rw-r--r--QtVsTools.Core/QtVsTools.Core.csproj3
-rw-r--r--QtVsTools.Core/Resources.resx200
-rw-r--r--QtVsTools.Core/SR.cs72
-rw-r--r--QtVsTools.Package/Package/QtMainMenu.cs2
-rw-r--r--QtVsTools.Package/Package/QtMsBuildConverter.cs82
-rw-r--r--QtVsTools.Package/Package/QtProjectContextMenu.cs2
-rw-r--r--QtVsTools.Package/Package/SR.cs72
-rw-r--r--QtVsTools.Package/QtVsTools.Package.csproj4
-rw-r--r--QtVsTools.Package/Resources.resx160
13 files changed, 71 insertions, 587 deletions
diff --git a/QtVsTools.Core/Filters.cs b/QtVsTools.Core/Filters.cs
index a361a0bc..f8ca1249 100644
--- a/QtVsTools.Core/Filters.cs
+++ b/QtVsTools.Core/Filters.cs
@@ -35,7 +35,7 @@ namespace QtVsTools.Core
return new FakeFilter
{
UniqueIdentifier = "{4FC737F1-C7A5-4376-A066-2A32D752A2FF}",
- Name = SR.GetString("Resources_SourceFiles"),
+ Name = "Source Files",
Filter = "cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
};
}
@@ -45,7 +45,7 @@ namespace QtVsTools.Core
return new FakeFilter
{
UniqueIdentifier = "{93995380-89BD-4b04-88EB-625FBE52EBFB}",
- Name = SR.GetString("Resources_HeaderFiles"),
+ Name = "Header Files",
Filter = "h;hh;hpp;hxx;hm;inl;inc;xsd"
};
}
@@ -55,7 +55,7 @@ namespace QtVsTools.Core
return new FakeFilter
{
UniqueIdentifier = "{99349809-55BA-4b9d-BF79-8FDBB0286EB3}",
- Name = SR.GetString("Resources_FormFiles"),
+ Name = "Form Files",
Filter = "ui"
};
}
@@ -65,7 +65,7 @@ namespace QtVsTools.Core
return new FakeFilter
{
UniqueIdentifier = "{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}",
- Name = SR.GetString("Resources_ResourceFiles"),
+ Name = "Resource Files",
ParseFiles = false,
Filter = "qrc;*"
};
@@ -76,7 +76,7 @@ namespace QtVsTools.Core
return new FakeFilter
{
UniqueIdentifier = "{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}",
- Name = SR.GetString("Resources_GeneratedFiles"),
+ Name = "Generated Files",
Filter = "moc;h;cpp",
};
}
diff --git a/QtVsTools.Core/Messages.cs b/QtVsTools.Core/Messages.cs
index ffa8bd01..c20a82da 100644
--- a/QtVsTools.Core/Messages.cs
+++ b/QtVsTools.Core/Messages.cs
@@ -32,7 +32,7 @@ using System.Threading;
using System.Windows.Forms;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Threading;
-
+using static System.Environment;
using Task = System.Threading.Tasks.Task;
namespace QtVsTools.Core
@@ -43,7 +43,7 @@ namespace QtVsTools.Core
{
private static OutputWindowPane Pane { get; set; }
- private static readonly string PaneName = "Qt VS Tools";
+ private const string Name = "Qt VS Tools";
private static readonly Guid PaneGuid = new Guid("8f6a1e44-fa0b-49e5-9934-1c050555350e");
/// <summary>
@@ -96,44 +96,41 @@ namespace QtVsTools.Core
+ $"Stack Trace:\r\n {exception.StackTrace.Trim()}\r\n";
}
- private static readonly string ErrorString = SR.GetString("Messages_ErrorOccured");
- private static readonly string WarningString = SR.GetString("Messages_Warning");
- private static readonly string SolutionString = SR.GetString("Messages_SolveProblem");
+ private const string ErrorString = "The following error occurred:";
+ private static readonly string WarningString = "Warning:" + NewLine;
public static void DisplayCriticalErrorMessage(string msg)
{
- MessageBox.Show(ErrorString +
- msg,
- SR.GetString("Resources_QtVsTools"), MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show(ErrorString + NewLine + msg,
+ Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
public static void DisplayErrorMessage(System.Exception e)
{
MessageBox.Show(ExceptionToString(e),
- SR.GetString("Resources_QtVsTools"), MessageBoxButtons.OK, MessageBoxIcon.Error);
+ Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
public static void DisplayErrorMessage(string msg)
{
- MessageBox.Show(ErrorString +
- msg,
- SR.GetString("Resources_QtVsTools"), MessageBoxButtons.OK, MessageBoxIcon.Error);
+ MessageBox.Show(ErrorString + NewLine + msg,
+ Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
public static void DisplayWarningMessage(System.Exception e, string solution)
{
- MessageBox.Show(WarningString +
- ExceptionToString(e) +
- SolutionString +
- solution,
- SR.GetString("Resources_QtVsTools"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ MessageBox.Show(WarningString
+ + ExceptionToString(e)
+ + NewLine + NewLine + "To solve this problem:" + NewLine
+ + solution,
+ Name, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
public static void DisplayWarningMessage(string msg)
{
MessageBox.Show(WarningString +
msg,
- SR.GetString("Resources_QtVsTools"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ Name, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
public static void ClearPane()
@@ -164,7 +161,7 @@ namespace QtVsTools.Core
{
try {
if (Pane == null)
- Pane = await OutputWindowPane.CreateAsync(PaneName, PaneGuid);
+ Pane = await OutputWindowPane.CreateAsync(Name, PaneGuid);
} catch (Exception ex) {
System.Diagnostics.Debug.WriteLine(ex);
}
diff --git a/QtVsTools.Core/QtProject.cs b/QtVsTools.Core/QtProject.cs
index c31dae5c..b8425845 100644
--- a/QtVsTools.Core/QtProject.cs
+++ b/QtVsTools.Core/QtProject.cs
@@ -83,7 +83,7 @@ namespace QtVsTools.Core
ThreadHelper.ThrowIfNotOnUIThread();
if (project == null)
- throw new QtVSException(SR.GetString("QtProject_CannotConstructWithoutValidProject"));
+ throw new QtVSException("Cannot construct a QtProject object without a valid project.");
envPro = project;
dte = envPro.DTE;
vcPro = envPro.Object as VCProject;
@@ -826,7 +826,7 @@ namespace QtVsTools.Core
}
}
} catch {
- throw new QtVSException(SR.GetString("QtProject_CannotRemoveMocStep", file.FullPath));
+ throw new QtVSException($"Cannot remove a moc step from file {file.FullPath}");
}
}
@@ -883,7 +883,7 @@ namespace QtVsTools.Core
RemoveFileFromFilter(file, vfilt);
} catch {
- throw new QtVSException(SR.GetString("QtProject_CannotRemoveFile", file.Name));
+ throw new QtVSException($"Cannot remove file {file.Name} from filter.");
}
}
@@ -921,7 +921,7 @@ namespace QtVsTools.Core
}
return null;
} catch {
- throw new QtVSException(SR.GetString("QtProject_CannotFindFilter"));
+ throw new QtVSException("Cannot find filter.");
}
}
@@ -936,7 +936,7 @@ namespace QtVsTools.Core
}
return null;
} catch {
- throw new QtVSException(SR.GetString("QtProject_CannotFindFilter"));
+ throw new QtVSException("Cannot find filter.");
}
}
@@ -989,8 +989,8 @@ namespace QtVsTools.Core
writer.WriteLine(l);
writer.Close();
} catch (Exception e) {
- Messages.Print(SR.GetString("QtProject_CannotAdjustWhitespaces",
- e.ToString()));
+ Messages.Print("Cannot adjust whitespace or tabs in file (write)."
+ + Environment.NewLine + $"({e})");
}
}
diff --git a/QtVsTools.Core/QtVersionManager.cs b/QtVsTools.Core/QtVersionManager.cs
index f4e145eb..5185b25a 100644
--- a/QtVsTools.Core/QtVersionManager.cs
+++ b/QtVsTools.Core/QtVersionManager.cs
@@ -385,7 +385,7 @@ namespace QtVsTools.Core
if (key != null)
defaultVersion = (string)key.GetValue("DefaultQtVersion");
} catch {
- Messages.DisplayWarningMessage(SR.GetString("QtVersionManager_CannotLoadQtVersion"));
+ Messages.DisplayWarningMessage("Cannot load the default Qt version.");
}
if (defaultVersion == null) {
diff --git a/QtVsTools.Core/QtVsTools.Core.csproj b/QtVsTools.Core/QtVsTools.Core.csproj
index 627fc5db..9e1e9f9d 100644
--- a/QtVsTools.Core/QtVsTools.Core.csproj
+++ b/QtVsTools.Core/QtVsTools.Core.csproj
@@ -158,7 +158,6 @@
<Compile Include="QtVSException.cs" />
<Compile Include="QtVSIPSettings.cs" />
<Compile Include="Resources.cs" />
- <Compile Include="SR.cs" />
<Compile Include="VersionInformation.cs" />
<Compile Include="VisualStudio\InfoBarMessage.cs" />
<Compile Include="VisualStudio\IProjectTracker.cs" />
@@ -167,8 +166,6 @@
<Compile Include="VisualStudio\VsShell.cs" />
<Compile Include="WaitDialog.cs" />
<Content Include="QtVsTools.Core.ico" />
- <EmbeddedResource Include="Resources.resx">
- </EmbeddedResource>
<EmbeddedResource Include="Resources\delete.png" />
<EmbeddedResource Include="Resources\delete_d.png" />
<EmbeddedResource Include="Resources\newitem.png" />
diff --git a/QtVsTools.Core/Resources.resx b/QtVsTools.Core/Resources.resx
deleted file mode 100644
index a848b492..00000000
--- a/QtVsTools.Core/Resources.resx
+++ /dev/null
@@ -1,200 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="ExportProject_EditProjectFileManually" xml:space="preserve">
- <value>qmake has generated a .vcproj file, but it needs to be converted.
-To do this you must open the .vcproj file manually.
-(Reason: qmake in Qt3 does not support generation of Visual Studio 2005 .vcproj files)</value>
- </data>
- <data name="HelperFunctions_CannotWriteEnvQTDIR" xml:space="preserve">
- <value>Cannot write environment variable QTDIR.</value>
- </data>
- <data name="Messages_ErrorOccured" xml:space="preserve">
- <value>The following error occurred:
-</value>
- </data>
- <data name="Messages_Warning" xml:space="preserve">
- <value>Warning:
-</value>
- </data>
- <data name="Messages_SolveProblem" xml:space="preserve">
- <value>
-
-To solve this problem:
-</value>
- </data>
- <data name="QtProject_CannotConstructWithoutValidProject" xml:space="preserve">
- <value>Cannot construct a QtProject object without a valid project.</value>
- </data>
- <data name="QtProject_CannotAddUicStep" xml:space="preserve">
- <value>Cannot add a uic step to file {0}</value>
- </data>
- <data name="QtProject_CannotAddMocStep" xml:space="preserve">
- <value>Cannot add a moc step to file {0}</value>
- </data>
- <data name="QtProject_CannotRemoveMocStep" xml:space="preserve">
- <value>Cannot remove a moc step from file {0}</value>
- </data>
- <data name="QtProject_CannotRemoveFile" xml:space="preserve">
- <value>Cannot remove file {0} from filter.</value>
- </data>
- <data name="QtProject_CannotFindFilter" xml:space="preserve">
- <value>Cannot find filter.</value>
- </data>
- <data name="QtProject_CannotAdjustWhitespaces" xml:space="preserve">
- <value>Cannot adjust whitespace or tabs in file (write).
-({0})</value>
- </data>
- <data name="QtVersionManager_CannotLoadQtVersion" xml:space="preserve">
- <value>Cannot load the default Qt version.</value>
- </data>
- <data name="Resources_QtVsTools" xml:space="preserve">
- <value>Qt VS Tools</value>
- </data>
- <data name="Resources_SourceFiles" xml:space="preserve">
- <value>Source Files</value>
- </data>
- <data name="Resources_HeaderFiles" xml:space="preserve">
- <value>Header Files</value>
- </data>
- <data name="Resources_FormFiles" xml:space="preserve">
- <value>Form Files</value>
- </data>
- <data name="Resources_ResourceFiles" xml:space="preserve">
- <value>Resource Files</value>
- </data>
- <data name="Resources_GeneratedFiles" xml:space="preserve">
- <value>Generated Files</value>
- </data>
- <data name="QtProject_CannotFindCustomBuildTool" xml:space="preserve">
- <value>Could not find custom build tool for {0}.</value>
- </data>
- <data name="QtProject_CannotAccessUserFile" xml:space="preserve">
- <value>Could not add QTDIR to {0}'s .user file.</value>
- </data>
- <data name="WaitDialogRefreshMoc" xml:space="preserve">
- <value>Updating moc steps...</value>
- </data>
- <data name="CannotChangeQtVersion" xml:space="preserve">
- <value>The Qt version of at least one project cannot be changed.</value>
- </data>
- <data name="DeleteGeneratedFilesError" xml:space="preserve">
- <value>The generated files cannot be deleted.</value>
- </data>
-</root> \ No newline at end of file
diff --git a/QtVsTools.Core/SR.cs b/QtVsTools.Core/SR.cs
deleted file mode 100644
index 09608c56..00000000
--- a/QtVsTools.Core/SR.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2022 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.Resources;
-
-namespace QtVsTools.Core
-{
- internal sealed class SR
- {
- static SR loader;
- readonly ResourceManager resources;
- static readonly object obj = new object();
-
- internal SR()
- {
- resources = new ResourceManager("QtVsTools.Core.Resources", GetType().Assembly);
- }
-
- private static SR GetLoader()
- {
- if (loader == null) {
- lock (obj) {
- if (loader == null)
- loader = new SR();
- }
- }
- return loader;
- }
-
- public static string GetString(string name, params object[] args)
- {
- var sys = GetLoader();
- if (sys == null)
- return null;
-
- var res = sys.resources.GetString(name, null);
- if (args != null && args.Length > 0 && !string.IsNullOrEmpty(res))
- return string.Format(res, args);
- return res;
- }
-
- public static string GetString(string name)
- {
- return GetString(name, null);
- }
- }
-}
diff --git a/QtVsTools.Package/Package/QtMainMenu.cs b/QtVsTools.Package/Package/QtMainMenu.cs
index 57ba0f69..db696830 100644
--- a/QtVsTools.Package/Package/QtMainMenu.cs
+++ b/QtVsTools.Package/Package/QtMainMenu.cs
@@ -140,7 +140,7 @@ namespace QtVsTools
if (QtVsToolsPackage.Instance.Options.UpdateProjectFormat)
Notifications.UpdateProjectFormat.Show();
} else {
- MessageBox.Show(SR.GetString("NoProjectOpened"));
+ MessageBox.Show("No Project Opened");
}
break;
case CommandId.QtOptionsId:
diff --git a/QtVsTools.Package/Package/QtMsBuildConverter.cs b/QtVsTools.Package/Package/QtMsBuildConverter.cs
index 319e5635..d24b5ad1 100644
--- a/QtVsTools.Package/Package/QtMsBuildConverter.cs
+++ b/QtVsTools.Package/Package/QtMsBuildConverter.cs
@@ -43,13 +43,16 @@ namespace QtVsTools
static class QtMsBuildConverter
{
+ private const string CancelConversion = "Project conversion canceled.";
+ private const string ErrorConversion = "Error converting project {0}";
+
public static bool SolutionToQtMsBuild()
{
ThreadHelper.ThrowIfNotOnUIThread();
var allProjects = HelperFunctions.ProjectsInSolution(QtVsToolsPackage.Instance.Dte);
if (allProjects.Count == 0)
- return WarningMessage(SR.GetString("NoProjectsToConvert"));
+ return WarningMessage("No projects to convert.");
var projects = new List<EnvDTE.Project>();
foreach (var project in allProjects.Where(HelperFunctions.IsQtProject)) {
@@ -60,13 +63,12 @@ namespace QtVsTools
projects.Add(project);
}
if (projects.Count == 0)
- return WarningMessage(SR.GetString("NoProjectsToConvert"));
+ return WarningMessage("No projects to convert.");
- if (MessageBox.Show(
- SR.GetString("ConvertAllConfirmation"),
- SR.GetString("ConvertTitle"),
- MessageBoxButtons.YesNo) != DialogResult.Yes)
- return WarningMessage(SR.GetString("CancelConvertingProject"));
+ if (MessageBox.Show("Do you really want to convert all projects?",
+ "Project Conversion", MessageBoxButtons.YesNo) != DialogResult.Yes) {
+ return WarningMessage(CancelConversion);
+ }
bool hasDirtyProjects = projects
.Where(project =>
@@ -75,12 +77,10 @@ namespace QtVsTools
return project.IsDirty;
})
.Any();
- if (hasDirtyProjects) {
- if (MessageBox.Show(
- SR.GetString("ConvertSaveConfirmation"),
- SR.GetString("ConvertTitle"),
- MessageBoxButtons.YesNo) != DialogResult.Yes)
- return WarningMessage(SR.GetString("CancelConvertingProject"));
+ if (hasDirtyProjects
+ && MessageBox.Show("Projects must be saved before conversion. Save projects?",
+ "Project Conversion", MessageBoxButtons.YesNo) != DialogResult.Yes) {
+ return WarningMessage(CancelConversion);
}
var projectPaths = projects
@@ -95,17 +95,17 @@ namespace QtVsTools
string solutionPath = solution.FileName;
solution.Close(true);
- var waitDialog = WaitDialog.StartWithProgress(
- SR.GetString("Resources_QtVsTools"), SR.GetString("ConvertWait"),
- projectPaths.Count, isCancelable: true);
+ var waitDialog = WaitDialog.StartWithProgress("Qt VS Tools",
+ "Converting solution to Qt/MSBuild...", projectPaths.Count, isCancelable: true);
int projCount = 0;
bool canceled = false;
foreach (var projectPath in projectPaths) {
if (waitDialog != null) {
- waitDialog.Update(string.Format(SR.GetString("ConvertProgress"),
- projCount + 1, projectPaths.Count,
- Path.GetFileNameWithoutExtension(projectPath)),
+ waitDialog.Update("Converting solution to Qt/MSBuild..." + Environment.NewLine
+ + string.Format("Converting project {0}/{1}: {2}...", projCount + 1,
+ projectPaths.Count, Path.GetFileNameWithoutExtension(projectPath)
+ ),
projectPaths.Count, projCount);
if (waitDialog.Canceled) {
canceled = true;
@@ -115,7 +115,7 @@ namespace QtVsTools
if (!ConvertProject(projectPath)) {
waitDialog?.Stop();
QtVsToolsPackage.Instance.Dte.Solution.Open(solutionPath);
- return ErrorMessage(string.Format(SR.GetString("ErrorConvertingProject"),
+ return ErrorMessage(string.Format(ErrorConversion,
Path.GetFileName(projectPath)));
}
++projCount;
@@ -125,8 +125,8 @@ namespace QtVsTools
QtVsToolsPackage.Instance.Dte.Solution.Open(solutionPath);
if (canceled && projCount < projectPaths.Count) {
- MessageBox.Show(string.Format(SR.GetString("ConvertCanceled"),
- projectPaths.Count - projCount), SR.GetString("Resources_QtVsTools"),
+ MessageBox.Show($"Conversion canceled. {projectPaths.Count - projCount} "
+ + "projects were not converted.", "Qt VS Tools",
MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
@@ -159,36 +159,37 @@ namespace QtVsTools
ThreadHelper.ThrowIfNotOnUIThread();
if (project == null)
- return ErrorMessage(string.Format(SR.GetString("ErrorConvertingProject"), ""));
+ return ErrorMessage(string.Format(ErrorConversion, ""));
var pathToProject = project.FullName;
if (askConfirmation
- && MessageBox.Show(
- SR.GetString("ConvertConfirmation"),
- SR.GetString("ConvertTitle"),
- MessageBoxButtons.YesNo) != DialogResult.Yes)
- return WarningMessage(SR.GetString("CancelConvertingProject"));
+ && MessageBox.Show("Do you really want to convert the selected project?",
+ "Project Conversion", MessageBoxButtons.YesNo) != DialogResult.Yes) {
+ return WarningMessage(CancelConversion);
+ }
+
if (project.IsDirty) {
if (askConfirmation
- && MessageBox.Show(SR.GetString("ConvertSaveConfirmation"), project.Name,
- MessageBoxButtons.YesNo) != DialogResult.Yes)
- return WarningMessage(SR.GetString("CancelConvertingProject"));
+ && MessageBox.Show("Projects must be saved before conversion. Save projects?",
+ project.Name, MessageBoxButtons.YesNo) != DialogResult.Yes) {
+ return WarningMessage(CancelConversion);
+ }
+
try {
project.Save();
} catch (Exception e) {
- return ErrorMessage(string.Format(SR.GetString("ErrorConvertingProject"),
- string.Format("{0}\r\n{1}", project.Name, e.Message)));
+ return ErrorMessage(string.Format(ErrorConversion, $"{project.Name}\r\n{e.Message}"));
}
}
var vcProject = project.Object as VCProject;
if (vcProject == null)
return ErrorMessage(
- string.Format(SR.GetString("ErrorConvertingProject"), project.Name));
+ string.Format(ErrorConversion, project.Name));
var solution = VsServiceProvider.GetService<SVsSolution, IVsSolution4>();
if (solution == null)
return ErrorMessage(
- string.Format(SR.GetString("ErrorConvertingProject"), project.Name));
+ string.Format(ErrorConversion, project.Name));
var projectGuid = new Guid(vcProject.ProjectGUID);
var projectName = project.Name;
try {
@@ -197,10 +198,9 @@ namespace QtVsTools
(uint)_VSProjectUnloadStatus.UNLOADSTATUS_UnloadedByUser)
!= VSConstants.S_OK)
return ErrorMessage(
- string.Format(SR.GetString("ErrorConvertingProject"), projectName));
+ string.Format(ErrorConversion, projectName));
} catch (Exception e) {
- return ErrorMessage(string.Format(SR.GetString("ErrorConvertingProject"),
- string.Format("{0}\r\n{1}", projectName, e.Message)));
+ return ErrorMessage(string.Format(ErrorConversion, $"{projectName}\r\n{e.Message}"));
}
bool ok = ConvertProject(pathToProject);
@@ -208,12 +208,10 @@ namespace QtVsTools
solution.ReloadProject(ref projectGuid);
} catch (Exception e) {
return ErrorMessage(
- string.Format(SR.GetString("ErrorConvertingProject"),
- string.Format("{0}\r\n{1}", projectName, e.Message)));
+ string.Format(ErrorConversion, $"{projectName}\r\n{e.Message}"));
}
if (!ok) {
- return ErrorMessage(
- string.Format(SR.GetString("ErrorConvertingProject"), projectName));
+ return ErrorMessage(string.Format(ErrorConversion, projectName));
}
return true;
}
diff --git a/QtVsTools.Package/Package/QtProjectContextMenu.cs b/QtVsTools.Package/Package/QtProjectContextMenu.cs
index 0fdec1f2..bdd192cd 100644
--- a/QtVsTools.Package/Package/QtProjectContextMenu.cs
+++ b/QtVsTools.Package/Package/QtProjectContextMenu.cs
@@ -123,7 +123,7 @@ namespace QtVsTools
if (QtVsToolsPackage.Instance.Options.UpdateProjectFormat)
Notifications.UpdateProjectFormat.Show();
} else {
- MessageBox.Show(SR.GetString("NoProjectOpened"));
+ MessageBox.Show("No Project Opened");
}
break;
case CommandId.ProjectConvertToQtMsBuild: {
diff --git a/QtVsTools.Package/Package/SR.cs b/QtVsTools.Package/Package/SR.cs
deleted file mode 100644
index 6e20219b..00000000
--- a/QtVsTools.Package/Package/SR.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2022 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.Resources;
-
-namespace QtVsTools
-{
- internal sealed class SR
- {
- static SR loader;
- readonly ResourceManager resources;
- static readonly object obj = new object();
-
- internal SR()
- {
- resources = new ResourceManager("QtVsTools.Package.Resources", GetType().Assembly);
- }
-
- private static SR GetLoader()
- {
- if (loader == null) {
- lock (obj) {
- if (loader == null)
- loader = new SR();
- }
- }
- return loader;
- }
-
- public static string GetString(string name, params object[] args)
- {
- var sys = GetLoader();
- if (sys == null)
- return null;
-
- var res = sys.resources.GetString(name, null);
- if (args != null && args.Length > 0 && !string.IsNullOrEmpty(res))
- return string.Format(res, args);
- return res;
- }
-
- public static string GetString(string name)
- {
- return GetString(name, null);
- }
- }
-}
diff --git a/QtVsTools.Package/QtVsTools.Package.csproj b/QtVsTools.Package/QtVsTools.Package.csproj
index 4cda2f29..991b3740 100644
--- a/QtVsTools.Package/QtVsTools.Package.csproj
+++ b/QtVsTools.Package/QtVsTools.Package.csproj
@@ -387,7 +387,6 @@
<Compile Include="QtMsBuild\QtProjectTracker.cs" />
<Compile Include="Package\QtProjectContextMenu.cs" />
<Compile Include="Package\QtSolutionContextMenu.cs" />
- <Compile Include="Package\SR.cs" />
<Compile Include="Package\Translation.cs" />
<Compile Include="Package\Notifications.cs" />
<Content Include="..\Changelog">
@@ -476,9 +475,6 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
- <EmbeddedResource Include="Resources.resx">
- <SubType>Designer</SubType>
- </EmbeddedResource>
<T4Template Include="Package\Version.cs">
<Generator>TextTemplatingFileGenerator</Generator>
<OutputFile>Version.tt.cs</OutputFile>
diff --git a/QtVsTools.Package/Resources.resx b/QtVsTools.Package/Resources.resx
deleted file mode 100644
index b1dedce7..00000000
--- a/QtVsTools.Package/Resources.resx
+++ /dev/null
@@ -1,160 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
- <!--
- Microsoft ResX Schema
-
- Version 2.0
-
- The primary goals of this format is to allow a simple XML format
- that is mostly human readable. The generation and parsing of the
- various data types are done through the TypeConverter classes
- associated with the data types.
-
- Example:
-
- ... ado.net/XML headers & schema ...
- <resheader name="resmimetype">text/microsoft-resx</resheader>
- <resheader name="version">2.0</resheader>
- <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
- <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
- <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
- <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
- <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
- <value>[base64 mime encoded serialized .NET Framework object]</value>
- </data>
- <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
- <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
- <comment>This is a comment</comment>
- </data>
-
- There are any number of "resheader" rows that contain simple
- name/value pairs.
-
- Each data row contains a name, and value. The row also contains a
- type or mimetype. Type corresponds to a .NET class that support
- text/value conversion through the TypeConverter architecture.
- Classes that don't support this are serialized and stored with the
- mimetype set.
-
- The mimetype is used for serialized objects, and tells the
- ResXResourceReader how to depersist the object. This is currently not
- extensible. For a given mimetype the value must be set accordingly:
-
- Note - application/x-microsoft.net.object.binary.base64 is the format
- that the ResXResourceWriter will generate, however the reader can
- read any of the formats listed below.
-
- mimetype: application/x-microsoft.net.object.binary.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.soap.base64
- value : The object must be serialized with
- : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
- : and then encoded with base64 encoding.
-
- mimetype: application/x-microsoft.net.object.bytearray.base64
- value : The object must be serialized into a byte array
- : using a System.ComponentModel.TypeConverter
- : and then encoded with base64 encoding.
- -->
- <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
- <xsd:element name="root" msdata:IsDataSet="true">
- <xsd:complexType>
- <xsd:choice maxOccurs="unbounded">
- <xsd:element name="metadata">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" />
- </xsd:sequence>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="type" type="xsd:string" />
- <xsd:attribute name="mimetype" type="xsd:string" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="assembly">
- <xsd:complexType>
- <xsd:attribute name="alias" type="xsd:string" />
- <xsd:attribute name="name" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
- <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
- <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
- <xsd:attribute ref="xml:space" />
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="resheader">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
- </xsd:sequence>
- <xsd:attribute name="name" type="xsd:string" use="required" />
- </xsd:complexType>
- </xsd:element>
- </xsd:choice>
- </xsd:complexType>
- </xsd:element>
- </xsd:schema>
- <resheader name="resmimetype">
- <value>text/microsoft-resx</value>
- </resheader>
- <resheader name="version">
- <value>2.0</value>
- </resheader>
- <resheader name="reader">
- <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <resheader name="writer">
- <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
- </resheader>
- <data name="ConvertConfirmation" xml:space="preserve">
- <value>Do you really want to convert the selected project?</value>
- </data>
- <data name="ConvertTitle" xml:space="preserve">
- <value>Project Conversion</value>
- </data>
- <data name="ConvertAllConfirmation" xml:space="preserve">
- <value>Do you really want to convert all projects?</value>
- </data>
- <data name="ConvertSaveConfirmation" xml:space="preserve">
- <value>Projects must be saved before conversion. Save projects?</value>
- </data>
- <data name="ConvertWait" xml:space="preserve">
- <value>Converting solution to Qt/MSBuild...</value>
- </data>
- <data name="ConvertProgress" xml:space="preserve">
- <value>Converting solution to Qt/MSBuild...
-Converting project {0}/{1}: {2}...</value>
- </data>
- <data name="ConvertCanceled" xml:space="preserve">
- <value>Conversion canceled. {0} projects were not converted.</value>
- </data>
- <data name="ErrorConvertingProject" xml:space="preserve">
- <value>Error converting project {0}</value>
- </data>
- <data name="CancelConvertingProject" xml:space="preserve">
- <value>Project conversion canceled.</value>
- </data>
- <data name="NoProjectsToConvert" xml:space="preserve">
- <value>No projects to convert.</value>
- </data>
- <data name="NoProjectOpened" xml:space="preserve">
- <value>No Project Opened</value>
- </data>
- <data name="ProjectQtVersionNotFoundError" xml:space="preserve">
- <value>There's no Qt version assigned to project {0} for configuration {1}/{2}. Please use the 'Qt Project Settings' editor to change the 'Version' to a valid Qt version for this platform.</value>
- </data>
- <data name="Resources_QtVsTools" xml:space="preserve">
- <value>Qt VS Tools</value>
- </data>
-</root> \ No newline at end of file