forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -51,5 +51,8 @@ const char M_CONTEXT[] = "CMakeEditor.ContextMenu";
|
|||||||
// Settings page
|
// Settings page
|
||||||
const char CMAKE_SETTINGSPAGE_ID[] = "Z.CMake";
|
const char CMAKE_SETTINGSPAGE_ID[] = "Z.CMake";
|
||||||
|
|
||||||
|
// Snippets
|
||||||
|
const char CMAKE_SNIPPETS_GROUP_ID[] = "CMake";
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
} // namespace CMakeProjectManager
|
} // namespace CMakeProjectManager
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ HEADERS = builddirmanager.h \
|
|||||||
cmaketool.h \
|
cmaketool.h \
|
||||||
cmakeparser.h \
|
cmakeparser.h \
|
||||||
cmakesettingspage.h \
|
cmakesettingspage.h \
|
||||||
|
cmakesnippetprovider.h \
|
||||||
cmaketoolmanager.h \
|
cmaketoolmanager.h \
|
||||||
cmake_global.h \
|
cmake_global.h \
|
||||||
cmakekitinformation.h \
|
cmakekitinformation.h \
|
||||||
@@ -44,6 +45,7 @@ SOURCES = builddirmanager.cpp \
|
|||||||
cmaketool.cpp \
|
cmaketool.cpp \
|
||||||
cmakeparser.cpp \
|
cmakeparser.cpp \
|
||||||
cmakesettingspage.cpp \
|
cmakesettingspage.cpp \
|
||||||
|
cmakesnippetprovider.cpp \
|
||||||
cmaketoolmanager.cpp \
|
cmaketoolmanager.cpp \
|
||||||
cmakekitinformation.cpp \
|
cmakekitinformation.cpp \
|
||||||
cmakekitconfigwidget.cpp \
|
cmakekitconfigwidget.cpp \
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ QtcPlugin {
|
|||||||
"cmaketoolmanager.h",
|
"cmaketoolmanager.h",
|
||||||
"cmakesettingspage.h",
|
"cmakesettingspage.h",
|
||||||
"cmakesettingspage.cpp",
|
"cmakesettingspage.cpp",
|
||||||
|
"cmakesnippetprovider.cpp",
|
||||||
|
"cmakesnippetprovider.h",
|
||||||
"cmakeindenter.h",
|
"cmakeindenter.h",
|
||||||
"cmakeindenter.cpp",
|
"cmakeindenter.cpp",
|
||||||
"cmakeautocompleter.h",
|
"cmakeautocompleter.h",
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "cmakeprojectmanager.h"
|
#include "cmakeprojectmanager.h"
|
||||||
#include "cmakebuildconfiguration.h"
|
#include "cmakebuildconfiguration.h"
|
||||||
#include "cmakerunconfiguration.h"
|
#include "cmakerunconfiguration.h"
|
||||||
|
#include "cmakesnippetprovider.h"
|
||||||
#include "cmakeprojectconstants.h"
|
#include "cmakeprojectconstants.h"
|
||||||
#include "cmakelocatorfilter.h"
|
#include "cmakelocatorfilter.h"
|
||||||
#include "cmakesettingspage.h"
|
#include "cmakesettingspage.h"
|
||||||
@@ -46,6 +47,7 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
|
|||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
Utils::MimeDatabase::addMimeTypes(QLatin1String(":cmakeproject/CMakeProjectManager.mimetypes.xml"));
|
Utils::MimeDatabase::addMimeTypes(QLatin1String(":cmakeproject/CMakeProjectManager.mimetypes.xml"));
|
||||||
|
|
||||||
|
addAutoReleasedObject(new Internal::CMakeSnippetProvider);
|
||||||
addAutoReleasedObject(new CMakeSettingsPage);
|
addAutoReleasedObject(new CMakeSettingsPage);
|
||||||
addAutoReleasedObject(new CMakeManager);
|
addAutoReleasedObject(new CMakeManager);
|
||||||
addAutoReleasedObject(new CMakeBuildStepFactory);
|
addAutoReleasedObject(new CMakeBuildStepFactory);
|
||||||
|
|||||||
55
src/plugins/cmakeprojectmanager/cmakesnippetprovider.cpp
Normal file
55
src/plugins/cmakeprojectmanager/cmakesnippetprovider.cpp
Normal file
@@ -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
|
||||||
46
src/plugins/cmakeprojectmanager/cmakesnippetprovider.h
Normal file
46
src/plugins/cmakeprojectmanager/cmakesnippetprovider.h
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user