aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cpptools/abstracteditorsupport.cpp
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@theqtcompany.com>2015-09-14 10:56:10 +0200
committerTobias Hunger <tobias.hunger@theqtcompany.com>2015-09-22 09:16:48 +0000
commitaf7f098366ce0d039bbff24ad9560eca9e49ae02 (patch)
tree726b860c46514bbd7d49ad0fb323226853e7dc48 /src/plugins/cpptools/abstracteditorsupport.cpp
parent61e590a9716bcbb9621ed9f82452b3590a783c91 (diff)
LicenseTemplate: Use macro expansion
Convert existing licensetemplate syntax to macro expansion. That is way more powerful than what we used to have. Do return the (converted) license template and do not try to fill in information since that is not available when querying the template. Change-Id: Ia4f45ccf055772b21b0c2ce3c083cf49c45ae7d8 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/cpptools/abstracteditorsupport.cpp')
-rw-r--r--src/plugins/cpptools/abstracteditorsupport.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/plugins/cpptools/abstracteditorsupport.cpp b/src/plugins/cpptools/abstracteditorsupport.cpp
index 64fd65ff84..c1e49a4a1b 100644
--- a/src/plugins/cpptools/abstracteditorsupport.cpp
+++ b/src/plugins/cpptools/abstracteditorsupport.cpp
@@ -33,6 +33,9 @@
#include "cppfilesettingspage.h"
#include "cppmodelmanager.h"
+#include <utils/fileutils.h>
+#include <utils/macroexpander.h>
+
namespace CppTools {
AbstractEditorSupport::AbstractEditorSupport(CppModelManager *modelmanager) :
@@ -53,7 +56,14 @@ void AbstractEditorSupport::notifyAboutUpdatedContents() const
QString AbstractEditorSupport::licenseTemplate(const QString &file, const QString &className)
{
- return Internal::CppFileSettings::licenseTemplate(file, className);
+ const QString license = Internal::CppFileSettings::licenseTemplate();
+ Utils::MacroExpander expander;
+ expander.registerVariable("Cpp:License:FileName", tr("The file name."),
+ [file]() { return Utils::FileName::fromString(file).fileName(); });
+ expander.registerVariable("Cpp:License:ClassName", tr("The class name"),
+ [className]() { return className; });
+
+ return expander.expand(license);
}
} // namespace CppTools