diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2009-06-22 16:22:15 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2009-06-22 16:22:15 +0200 |
commit | 696cfa043215d4140b0d9c5ac2fdb8b8789b92c9 (patch) | |
tree | 4ff1cd4d7e733d73370217c5f060128495e8c915 /src/plugins/qt4projectmanager/wizards | |
parent | 1b168b686d8eaeca536891096d7e1620331b87f9 (diff) | |
download | qt-creator-696cfa043215d4140b0d9c5ac2fdb8b8789b92c9.tar.gz |
Add a license template setting to the CppTools settings.
Acked-by: con <qtc-committer@nokia.com>
Diffstat (limited to 'src/plugins/qt4projectmanager/wizards')
3 files changed, 13 insertions, 7 deletions
diff --git a/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp b/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp index 6db15fc714..a9670ba41a 100644 --- a/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/consoleappwizard.cpp @@ -34,6 +34,7 @@ #include "qt4projectmanagerconstants.h" #include <utils/pathchooser.h> +#include <cpptools/cppmodelmanagerinterface.h> #include <QtCore/QDir> #include <QtCore/QTextStream> @@ -77,12 +78,13 @@ 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(QLatin1String(mainCppC)); + source.setContents(license + QLatin1String(mainCppC)); // Create files: Profile const QString profileName = Core::BaseFileWizard::buildFileName(projectPath, params.name,profileSuffix()); diff --git a/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp b/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp index b984a7fcad..8dcaeca883 100644 --- a/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/guiappwizard.cpp @@ -36,6 +36,7 @@ #include <utils/pathchooser.h> #include <projectexplorer/projectnodes.h> +#include <cpptools/cppmodelmanagerinterface.h> #include <QtCore/QDir> #include <QtCore/QFile> @@ -95,6 +96,7 @@ Core::GeneratedFiles GuiAppWizard::generateFiles(const QWizard *w, const QtProjectParameters projectParams = dialog->projectParameters(); const QString projectPath = projectParams.projectPath(); const GuiAppParameters params = dialog->parameters(); + const QString license = CppTools::AbstractEditorSupport::licenseTemplate(); // Generate file names. Note that the path for the project files is the // newly generated project directory. @@ -105,21 +107,21 @@ 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(contents); + mainSource.setContents(license + contents); // Create files: form source const QString formSourceTemplate = params.designerForm ? QLatin1String("mywidget_form.cpp") : QLatin1String("mywidget.cpp"); const QString formSourceFileName = buildFileName(projectPath, params.sourceFileName, sourceSuffix()); Core::GeneratedFile formSource(formSourceFileName); if (!parametrizeTemplate(templatePath, formSourceTemplate, params, &contents, errorMessage)) return Core::GeneratedFiles(); - formSource.setContents(contents); + formSource.setContents(license + contents); // Create files: form header const QString formHeaderName = buildFileName(projectPath, params.headerFileName, headerSuffix()); const QString formHeaderTemplate = params.designerForm ? QLatin1String("mywidget_form.h") : QLatin1String("mywidget.h"); Core::GeneratedFile formHeader(formHeaderName); if (!parametrizeTemplate(templatePath, formHeaderTemplate, params, &contents, errorMessage)) return Core::GeneratedFiles(); - formHeader.setContents(contents); + formHeader.setContents(license + contents); // Create files: form QSharedPointer<Core::GeneratedFile> form; if (params.designerForm) { diff --git a/src/plugins/qt4projectmanager/wizards/librarywizard.cpp b/src/plugins/qt4projectmanager/wizards/librarywizard.cpp index 82e24a3977..9707f9dd43 100644 --- a/src/plugins/qt4projectmanager/wizards/librarywizard.cpp +++ b/src/plugins/qt4projectmanager/wizards/librarywizard.cpp @@ -34,6 +34,7 @@ #include <utils/codegeneration.h> #include <utils/pathchooser.h> +#include <cpptools/cppmodelmanagerinterface.h> #include <QtCore/QDir> #include <QtCore/QFileInfo> @@ -73,6 +74,7 @@ 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.name); @@ -91,7 +93,7 @@ Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w, const QString globalHeaderName = buildFileName(projectPath, projectParams.name + QLatin1String(sharedHeaderPostfixC), headerSuffix()); Core::GeneratedFile globalHeader(globalHeaderName); globalHeaderFileName = QFileInfo(globalHeader.path()).fileName(); - globalHeader.setContents(LibraryParameters::generateSharedHeader(globalHeaderFileName, projectParams.name, sharedLibExportMacro)); + globalHeader.setContents(license + LibraryParameters::generateSharedHeader(globalHeaderFileName, projectParams.name, sharedLibExportMacro)); rc.push_back(globalHeader); } @@ -101,8 +103,8 @@ Core::GeneratedFiles LibraryWizard::generateFiles(const QWizard *w, globalHeaderFileName, sharedLibExportMacro, /* indentation*/ 4, &headerContents, &sourceContents); - source.setContents(sourceContents); - header.setContents(headerContents); + source.setContents(license + sourceContents); + header.setContents(license + headerContents); rc.push_back(source); rc.push_back(header); // Create files: profile |