CppTools: Export licensetemplate and licensetemplatepath as variables

Change-Id: Id86b72b275d3381a32003c0439ff2d6b3b6ab505
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Tobias Hunger
2014-07-15 11:50:42 +02:00
parent d7b29eb607
commit 4d429751a4
2 changed files with 22 additions and 0 deletions

View File

@@ -48,6 +48,7 @@
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/documentmanager.h> #include <coreplugin/documentmanager.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <coreplugin/variablemanager.h>
#include <coreplugin/vcsmanager.h> #include <coreplugin/vcsmanager.h>
#include <cppeditor/cppeditorconstants.h> #include <cppeditor/cppeditorconstants.h>
@@ -96,6 +97,16 @@ void CppToolsPlugin::clearHeaderSourceCache()
m_headerSourceMapping.clear(); m_headerSourceMapping.clear();
} }
Utils::FileName CppToolsPlugin::licenseTemplatePath()
{
return Utils::FileName::fromString(m_instance->m_fileSettings->licenseTemplatePath);
}
QString CppToolsPlugin::licenseTemplate()
{
return m_instance->m_fileSettings->licenseTemplate();
}
const QStringList &CppToolsPlugin::headerSearchPaths() const QStringList &CppToolsPlugin::headerSearchPaths()
{ {
return m_instance->m_fileSettings->headerSearchPaths; return m_instance->m_fileSettings->headerSearchPaths;
@@ -173,6 +184,13 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
mcpptools->addAction(command); mcpptools->addAction(command);
connect(openInNextSplitAction, SIGNAL(triggered()), this, SLOT(switchHeaderSourceInNextSplit())); connect(openInNextSplitAction, SIGNAL(triggered()), this, SLOT(switchHeaderSourceInNextSplit()));
Core::VariableManager::registerVariable("Cpp:LicenseTemplate",
tr("The license template."),
[]() { return CppToolsPlugin::licenseTemplate(); });
Core::VariableManager::registerFileVariables("Cpp:LicenseTemplatePath",
tr("The configured path to the license template."),
[]() { return CppToolsPlugin::licenseTemplatePath().toString(); });
return true; return true;
} }

View File

@@ -42,6 +42,8 @@ class QFileInfo;
class QDir; class QDir;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Utils { class FileName; }
namespace CppTools { namespace CppTools {
class CppToolsSettings; class CppToolsSettings;
@@ -67,6 +69,8 @@ public:
static const QStringList &headerPrefixes(); static const QStringList &headerPrefixes();
static const QStringList &sourcePrefixes(); static const QStringList &sourcePrefixes();
static void clearHeaderSourceCache(); static void clearHeaderSourceCache();
static Utils::FileName licenseTemplatePath();
static QString licenseTemplate();
bool initialize(const QStringList &arguments, QString *errorMessage); bool initialize(const QStringList &arguments, QString *errorMessage);
void extensionsInitialized(); void extensionsInitialized();