Wizards: Remove remaining uses of classToHeaderGuard()

Amends 335c552bda.

Change-Id: I4f43e74f74cd42c4139e91b80abe89bf371411ef
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2024-05-31 08:43:28 +02:00
parent 0cd5230f6a
commit f65c54fa3e
6 changed files with 5 additions and 11 deletions

View File

@@ -238,7 +238,7 @@
{ "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" }, { "key": "CN", "value": "%{JS: Cpp.className(value('Class'))}" },
{ "key": "Base", "value": "%{JS: value('BaseCB') === '' ? value('BaseEdit') : value('BaseCB')}" }, { "key": "Base", "value": "%{JS: value('BaseCB') === '' ? value('BaseEdit') : value('BaseCB')}" },
{ "key": "isQObject", "value": "%{JS: (value('Base') === 'QObject' || value('Base') === 'QWidget' || value('Base') === 'QMainWindow' || value('Base') === 'QQuickItem' ) ? 'true' : 'false'}" }, { "key": "isQObject", "value": "%{JS: (value('Base') === 'QObject' || value('Base') === 'QWidget' || value('Base') === 'QMainWindow' || value('Base') === 'QQuickItem' ) ? 'true' : 'false'}" },
{ "key": "GUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('Class'), Util.suffix(value('HdrFileName'))}" }, { "key": "GUARD", "value": "%{JS: Cpp.headerGuard(value('HdrFileName'))}" },
{ "key": "SharedDataInit", "value": "%{JS: value('IncludeQSharedData') ? 'data(new %{CN}Data)' : '' }" } { "key": "SharedDataInit", "value": "%{JS: value('IncludeQSharedData') ? 'data(new %{CN}Data)' : '' }" }
], ],
\endcode \endcode

View File

@@ -23,8 +23,8 @@
{ "key": "ObjectHdr", "value": "%{JS: Cpp.classToFileName(value('ObjectName'), Util.preferredSuffix('text/x-c++hdr'))}" }, { "key": "ObjectHdr", "value": "%{JS: Cpp.classToFileName(value('ObjectName'), Util.preferredSuffix('text/x-c++hdr'))}" },
{ "key": "ObjectQml", "value": "%{JS: Util.fileName(value('ObjectName') + 'Controls', 'qml')}" }, { "key": "ObjectQml", "value": "%{JS: Util.fileName(value('ObjectName') + 'Controls', 'qml')}" },
{ "key": "PluginName", "value": "%{JS: value('ProjectName').charAt(0).toUpperCase() + value('ProjectName').slice(1) + 'Plugin' }" }, { "key": "PluginName", "value": "%{JS: value('ProjectName').charAt(0).toUpperCase() + value('ProjectName').slice(1) + 'Plugin' }" },
{ "key": "PLUGINGUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('PluginBaseFileName'), Util.preferredSuffix('text/x-c++hdr'))}" }, { "key": "PLUGINGUARD", "value": "%{JS: Cpp.headerGuard(value('PluginHdr'))}" },
{ "key": "OBJECTGUARD", "value": "%{JS: Cpp.classToHeaderGuard(value('ObjectName'), Util.preferredSuffix('text/x-c++hdr'))}" }, { "key": "OBJECTGUARD", "value": "%{JS: Cpp.headerGuard(value('ObjectHdr'))}" },
{ "key": "IsQt6", "value": "%{JS: value('QtVersion').IsQt6}" }, { "key": "IsQt6", "value": "%{JS: value('QtVersion').IsQt6}" },
{ "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" }, { "key": "QtQuickVersion", "value": "%{JS: value('QtVersion').QtQuickVersion}" },
{ "key": "QtQuickFeature", "value": "%{JS: (value('QtQuickVersion')=='') ? 'QtSupport.Wizards.FeatureQt.6.2' : 'QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}'}" }, { "key": "QtQuickFeature", "value": "%{JS: (value('QtQuickVersion')=='') ? 'QtSupport.Wizards.FeatureQt.6.2' : 'QtSupport.Wizards.FeatureQtQuick.%{QtQuickVersion}'}" },

View File

@@ -98,11 +98,6 @@ QString CppToolsJsExtension::classToFileName(const QString &klass, const QString
return finalPath + name + ext; return finalPath + name + ext;
} }
QString CppToolsJsExtension::classToHeaderGuard(const QString &klass, const QString &extension) const
{
return Utils::headerGuard(fileName(className(klass), extension), namespaces(klass));
}
QString CppToolsJsExtension::openNamespaces(const QString &klass) const QString CppToolsJsExtension::openNamespaces(const QString &klass) const
{ {
QString result; QString result;

View File

@@ -39,7 +39,6 @@ public:
// Fix the filename casing as configured in C++/File Naming: // Fix the filename casing as configured in C++/File Naming:
Q_INVOKABLE QString classToFileName(const QString &klass, Q_INVOKABLE QString classToFileName(const QString &klass,
const QString &extension) const; const QString &extension) const;
Q_INVOKABLE QString classToHeaderGuard(const QString &klass, const QString &extension) const;
Q_INVOKABLE QString openNamespaces(const QString &klass) const; Q_INVOKABLE QString openNamespaces(const QString &klass) const;
Q_INVOKABLE QString closeNamespaces(const QString &klass) const; Q_INVOKABLE QString closeNamespaces(const QString &klass) const;
Q_INVOKABLE bool hasQObjectParent(const QString &klassName) const; Q_INVOKABLE bool hasQObjectParent(const QString &klassName) const;

View File

@@ -388,7 +388,7 @@ private:
= Utils::transform<QStringList>(state->namespacePath, [&](const Namespace *ns) { = Utils::transform<QStringList>(state->namespacePath, [&](const Namespace *ns) {
return ov.prettyName(ns->name()); return ov.prettyName(ns->name());
}); });
const QString headerGuard = Utils::headerGuard(headerFileName, namespaceNames); const QString headerGuard = Utils::headerGuard(headerFileName);
if (fileSettings.headerPragmaOnce) { if (fileSettings.headerPragmaOnce) {
headerContent.append("#pragma once\n"); headerContent.append("#pragma once\n");
} else { } else {

View File

@@ -75,7 +75,7 @@ bool QtDesignerFormClassCodeGenerator::generateCpp(const FormClassWizardParamete
const QString sourceLicense = CppEditor::AbstractEditorSupport::licenseTemplate( const QString sourceLicense = CppEditor::AbstractEditorSupport::licenseTemplate(
project, FilePath::fromString(parameters.sourceFile), parameters.className); project, FilePath::fromString(parameters.sourceFile), parameters.className);
// Include guards // Include guards
const QString guard = Utils::headerGuard(parameters.headerFile, namespaceList); const QString guard = Utils::headerGuard(parameters.headerFile);
const QString uiInclude = "ui_" + QFileInfo(parameters.uiFile).completeBaseName() + ".h"; const QString uiInclude = "ui_" + QFileInfo(parameters.uiFile).completeBaseName() + ".h";