diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2010-08-09 12:23:21 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2010-08-09 12:26:48 +0200 |
commit | 7ab30d8a63aff133a1a216f4832919e8e25d77aa (patch) | |
tree | eba02d69cf5a100fecdfe54cedf4942af0c5fb12 /src/plugins/qt4projectmanager/wizards | |
parent | 934a9590c4c7ef2fff7f7f92a8284a576e69cb46 (diff) | |
download | qt-creator-7ab30d8a63aff133a1a216f4832919e8e25d77aa.tar.gz |
C++-Settings/License template: Add %FILENAME%, %CLASS% placeholders.
... for doxygen. Change logic for known empty keywords to be replaced
by an empty string.
Task-number: QTCREATORBUG-1854
Diffstat (limited to 'src/plugins/qt4projectmanager/wizards')
4 files changed, 14 insertions, 10 deletions
diff --git a/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp b/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp index d12e3f0e0b..fa8dc63840 100644 --- a/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp @@ -81,13 +81,12 @@ Core::GeneratedFiles const ConsoleAppWizardDialog *wizard = qobject_cast< const ConsoleAppWizardDialog *>(w); const QtProjectParameters params = wizard->parameters(); const QString projectPath = params.projectPath(); - const QString license = CppTools::AbstractEditorSupport::licenseTemplate(); // Create files: Source const QString sourceFileName = Core::BaseFileWizard::buildFileName(projectPath, QLatin1String(mainSourceFileC), sourceSuffix()); Core::GeneratedFile source(sourceFileName); - source.setContents(license + QLatin1String(mainCppC)); + source.setContents(CppTools::AbstractEditorSupport::licenseTemplate(sourceFileName) + QLatin1String(mainCppC)); source.setAttributes(Core::GeneratedFile::OpenEditorAttribute); // Create files: Profile const QString profileName = Core::BaseFileWizard::buildFileName(projectPath, params.fileName, profileSuffix()); diff --git a/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp b/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp index a112fb13ae..24e6344498 100644 --- a/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp @@ -165,7 +165,8 @@ Core::GeneratedFiles GuiAppWizard::generateFiles(const QWizard *w, Core::GeneratedFile mainSource(mainSourceFileName); if (!parametrizeTemplate(templatePath, QLatin1String("main.cpp"), params, &contents, errorMessage)) return Core::GeneratedFiles(); - mainSource.setContents(license + contents); + mainSource.setContents(CppTools::AbstractEditorSupport::licenseTemplate(mainSourceFileName) + + contents); // Create files: form source with or without form const QString formSourceFileName = buildFileName(projectPath, params.sourceFileName, sourceSuffix()); const QString formHeaderName = buildFileName(projectPath, params.headerFileName, headerSuffix()); @@ -187,13 +188,15 @@ Core::GeneratedFiles GuiAppWizard::generateFiles(const QWizard *w, const QString formSourceTemplate = QLatin1String("mywidget.cpp"); if (!parametrizeTemplate(templatePath, formSourceTemplate, params, &contents, errorMessage)) return Core::GeneratedFiles(); - formSource.setContents(license + contents); + formSource.setContents(CppTools::AbstractEditorSupport::licenseTemplate(formSourceFileName) + + contents); formSource.setAttributes(Core::GeneratedFile::OpenEditorAttribute); // Create files: form header const QString formHeaderTemplate = QLatin1String("mywidget.h"); if (!parametrizeTemplate(templatePath, formHeaderTemplate, params, &contents, errorMessage)) return Core::GeneratedFiles(); - formHeader.setContents(license + contents); + formHeader.setContents(CppTools::AbstractEditorSupport::licenseTemplate(formHeaderName) + + contents); } // Create files: profile const QString profileName = buildFileName(projectPath, projectParams.fileName, profileSuffix()); diff --git a/src/plugins/qt4projectmanager/wizards/librarywizard.cpp b/src/plugins/qt4projectmanager/wizards/librarywizard.cpp index 39eede1791..e86de20dcd 100644 --- a/src/plugins/qt4projectmanager/wizards/librarywizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/librarywizard.cpp @@ -82,7 +82,6 @@ Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w, const QtProjectParameters projectParams = dialog->parameters(); const QString projectPath = projectParams.projectPath(); const LibraryParameters params = dialog->libraryParameters(); - const QString license = CppTools::AbstractEditorSupport::licenseTemplate(); const QString sharedLibExportMacro = QtProjectParameters::exportMacro(projectParams.fileName); @@ -102,7 +101,8 @@ Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w, const QString globalHeaderName = buildFileName(projectPath, projectParams.fileName + QLatin1String(sharedHeaderPostfixC), headerSuffix()); Core::GeneratedFile globalHeader(globalHeaderName); globalHeaderFileName = QFileInfo(globalHeader.path()).fileName(); - globalHeader.setContents(license + LibraryParameters::generateSharedHeader(globalHeaderFileName, projectParams.fileName, sharedLibExportMacro)); + globalHeader.setContents(CppTools::AbstractEditorSupport::licenseTemplate(globalHeaderFileName) + + LibraryParameters::generateSharedHeader(globalHeaderFileName, projectParams.fileName, sharedLibExportMacro)); rc.push_back(globalHeader); } @@ -112,8 +112,10 @@ Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w, globalHeaderFileName, sharedLibExportMacro, /* indentation*/ 4, &headerContents, &sourceContents); - source.setContents(license + sourceContents); - header.setContents(license + headerContents); + source.setContents(CppTools::AbstractEditorSupport::licenseTemplate(sourceFileName, params.className) + + sourceContents); + header.setContents(CppTools::AbstractEditorSupport::licenseTemplate(headerFileFullName, params.className) + + headerContents); rc.push_back(source); rc.push_back(header); // Create files: profile diff --git a/src/plugins/qt4projectmanager/wizards/testwizard.cpp b/src/plugins/qt4projectmanager/wizards/testwizard.cpp index 55b3e21ae8..a493270e2b 100644 --- a/src/plugins/qt4projectmanager/wizards/testwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/testwizard.cpp @@ -96,7 +96,7 @@ static QString generateTestCode(const TestWizardParameters &testParams, const QString indent = QString(4, QLatin1Char(' ')); QTextStream str(&rc); // Includes - str << CppTools::AbstractEditorSupport::licenseTemplate() + str << CppTools::AbstractEditorSupport::licenseTemplate(testParams.fileName, testParams.className) << "#include <QtCore/QString>\n#include <QtTest/QtTest>\n"; if (testParams.requiresQApplication) str << "#include <QtCore/QCoreApplication>\n"; |