aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2016-08-18 13:22:06 +0200
committerTobias Hunger <tobias.hunger@qt.io>2016-08-23 12:12:37 +0000
commit59bab5e0ac450cf1a533b273439d8fba5af83fa7 (patch)
tree4f0d921540ab40b80b1d90e66f9b2733cb98feb4
parent5097acebf3ff25e81e53e4fcab60bcd337ab937b (diff)
CMake: Add CMakeSnippetProvider
This allows to define snippets for CMakeLists.txt files. They can not be used yet:-/ Change-Id: Iad68632798ecfe04018d08d284f9b5a8b0e564ee Reviewed-by: David Schulz <david.schulz@qt.io>
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectconstants.h3
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp2
-rw-r--r--src/plugins/cmakeprojectmanager/cmakesnippetprovider.cpp55
-rw-r--r--src/plugins/cmakeprojectmanager/cmakesnippetprovider.h46
6 files changed, 110 insertions, 0 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h
index 8c4f7b26a13..1f6c33411ea 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectconstants.h
@@ -51,5 +51,8 @@ const char M_CONTEXT[] = "CMakeEditor.ContextMenu";
// Settings page
const char CMAKE_SETTINGSPAGE_ID[] = "Z.CMake";
+// Snippets
+const char CMAKE_SNIPPETS_GROUP_ID[] = "CMake";
+
} // namespace Constants
} // namespace CMakeProjectManager
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro
index 3e0dadcc24e..4621c40c15d 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro
@@ -18,6 +18,7 @@ HEADERS = builddirmanager.h \
cmaketool.h \
cmakeparser.h \
cmakesettingspage.h \
+ cmakesnippetprovider.h \
cmaketoolmanager.h \
cmake_global.h \
cmakekitinformation.h \
@@ -44,6 +45,7 @@ SOURCES = builddirmanager.cpp \
cmaketool.cpp \
cmakeparser.cpp \
cmakesettingspage.cpp \
+ cmakesnippetprovider.cpp \
cmaketoolmanager.cpp \
cmakekitinformation.cpp \
cmakekitconfigwidget.cpp \
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs
index 5c15bc027c4..b199483eaa0 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs
@@ -64,6 +64,8 @@ QtcPlugin {
"cmaketoolmanager.h",
"cmakesettingspage.h",
"cmakesettingspage.cpp",
+ "cmakesnippetprovider.cpp",
+ "cmakesnippetprovider.h",
"cmakeindenter.h",
"cmakeindenter.cpp",
"cmakeautocompleter.h",
diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp
index 1da3cce40de..dba81e9c275 100644
--- a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp
@@ -30,6 +30,7 @@
#include "cmakeprojectmanager.h"
#include "cmakebuildconfiguration.h"
#include "cmakerunconfiguration.h"
+#include "cmakesnippetprovider.h"
#include "cmakeprojectconstants.h"
#include "cmakelocatorfilter.h"
#include "cmakesettingspage.h"
@@ -46,6 +47,7 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
Q_UNUSED(errorMessage)
Utils::MimeDatabase::addMimeTypes(QLatin1String(":cmakeproject/CMakeProjectManager.mimetypes.xml"));
+ addAutoReleasedObject(new Internal::CMakeSnippetProvider);
addAutoReleasedObject(new CMakeSettingsPage);
addAutoReleasedObject(new CMakeManager);
addAutoReleasedObject(new CMakeBuildStepFactory);
diff --git a/src/plugins/cmakeprojectmanager/cmakesnippetprovider.cpp b/src/plugins/cmakeprojectmanager/cmakesnippetprovider.cpp
new file mode 100644
index 00000000000..2b26d812c0d
--- /dev/null
+++ b/src/plugins/cmakeprojectmanager/cmakesnippetprovider.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "cmakesnippetprovider.h"
+
+#include "cmakeprojectconstants.h"
+#include "cmakeeditor.h"
+
+#include <texteditor/snippets/snippeteditor.h>
+
+namespace CMakeProjectManager {
+namespace Internal {
+
+CMakeSnippetProvider::~CMakeSnippetProvider() = default;
+
+QString CMakeProjectManager::Internal::CMakeSnippetProvider::groupId() const
+{
+ return Constants::CMAKE_SNIPPETS_GROUP_ID;
+}
+
+QString CMakeProjectManager::Internal::CMakeSnippetProvider::displayName() const
+{
+ return tr("CMake");
+}
+
+void CMakeProjectManager::Internal::CMakeSnippetProvider::decorateEditor(TextEditor::SnippetEditorWidget *editor) const
+{
+ Q_UNUSED(editor);
+ // What needs to go here?
+}
+
+} // namespace Internal
+} // namespace CMakeProjectManager
diff --git a/src/plugins/cmakeprojectmanager/cmakesnippetprovider.h b/src/plugins/cmakeprojectmanager/cmakesnippetprovider.h
new file mode 100644
index 00000000000..5894186c267
--- /dev/null
+++ b/src/plugins/cmakeprojectmanager/cmakesnippetprovider.h
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#pragma once
+
+#include <texteditor/snippets/isnippetprovider.h>
+
+namespace CMakeProjectManager {
+namespace Internal {
+
+class CMakeSnippetProvider : public TextEditor::ISnippetProvider
+{
+ Q_OBJECT
+
+public:
+ ~CMakeSnippetProvider() final;
+
+ QString groupId() const final;
+ QString displayName() const final;
+ void decorateEditor(TextEditor::SnippetEditorWidget *editor) const final;
+};
+
+} // namespace Internal
+} // namespace CMakeProjectManager