forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user