forked from qt-creator/qt-creator
ClangFormat: Hide plugin class definition in .cpp
Change-Id: I37017641a55287b5049d99064a2ca77c6a7dc201 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -10,7 +10,7 @@ add_qtc_plugin(ClangFormat
|
|||||||
clangformatconstants.h
|
clangformatconstants.h
|
||||||
clangformatfile.cpp clangformatfile.h
|
clangformatfile.cpp clangformatfile.h
|
||||||
clangformatindenter.cpp clangformatindenter.h
|
clangformatindenter.cpp clangformatindenter.h
|
||||||
clangformatplugin.cpp clangformatplugin.h
|
clangformatplugin.cpp
|
||||||
clangformatsettings.cpp clangformatsettings.h
|
clangformatsettings.cpp clangformatsettings.h
|
||||||
clangformattr.h
|
clangformattr.h
|
||||||
clangformatutils.cpp clangformatutils.h
|
clangformatutils.cpp clangformatutils.h
|
||||||
|
@@ -46,7 +46,6 @@ QtcPlugin {
|
|||||||
"clangformatindenter.cpp",
|
"clangformatindenter.cpp",
|
||||||
"clangformatindenter.h",
|
"clangformatindenter.h",
|
||||||
"clangformatplugin.cpp",
|
"clangformatplugin.cpp",
|
||||||
"clangformatplugin.h",
|
|
||||||
"clangformatsettings.cpp",
|
"clangformatsettings.cpp",
|
||||||
"clangformatsettings.h",
|
"clangformatsettings.h",
|
||||||
"clangformattr.h",
|
"clangformattr.h",
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
// Copyright (C) 2016 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "clangformatplugin.h"
|
|
||||||
|
|
||||||
#include "clangformatconfigwidget.h"
|
#include "clangformatconfigwidget.h"
|
||||||
#include "clangformatconstants.h"
|
#include "clangformatconstants.h"
|
||||||
#include "clangformatglobalconfigwidget.h"
|
#include "clangformatglobalconfigwidget.h"
|
||||||
@@ -21,6 +19,8 @@
|
|||||||
#include <cppeditor/cppcodestylepreferencesfactory.h>
|
#include <cppeditor/cppcodestylepreferencesfactory.h>
|
||||||
#include <cppeditor/cppeditorconstants.h>
|
#include <cppeditor/cppeditorconstants.h>
|
||||||
|
|
||||||
|
#include <extensionsystem/iplugin.h>
|
||||||
|
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
|
|
||||||
#include <texteditor/icodestylepreferences.h>
|
#include <texteditor/icodestylepreferences.h>
|
||||||
@@ -36,7 +36,7 @@ using namespace Utils;
|
|||||||
|
|
||||||
namespace ClangFormat {
|
namespace ClangFormat {
|
||||||
|
|
||||||
class ClangFormatStyleFactory : public CppCodeStylePreferencesFactory
|
class ClangFormatStyleFactory final : public CppCodeStylePreferencesFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Indenter *createIndenter(QTextDocument *doc) const override
|
Indenter *createIndenter(QTextDocument *doc) const override
|
||||||
@@ -57,14 +57,19 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ClangFormatPlugin::~ClangFormatPlugin()
|
class ClangFormatPlugin final : public ExtensionSystem::IPlugin
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ClangFormat.json")
|
||||||
|
|
||||||
|
~ClangFormatPlugin() final
|
||||||
|
{
|
||||||
TextEditorSettings::unregisterCodeStyleFactory(CppEditor::Constants::CPP_SETTINGS_ID);
|
TextEditorSettings::unregisterCodeStyleFactory(CppEditor::Constants::CPP_SETTINGS_ID);
|
||||||
delete m_factory;
|
delete m_factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangFormatPlugin::initialize()
|
void initialize() final
|
||||||
{
|
{
|
||||||
TextEditorSettings::unregisterCodeStyleFactory(CppEditor::Constants::CPP_SETTINGS_ID);
|
TextEditorSettings::unregisterCodeStyleFactory(CppEditor::Constants::CPP_SETTINGS_ID);
|
||||||
m_factory = new ClangFormatStyleFactory;
|
m_factory = new ClangFormatStyleFactory;
|
||||||
TextEditorSettings::registerCodeStyleFactory(m_factory);
|
TextEditorSettings::registerCodeStyleFactory(m_factory);
|
||||||
@@ -88,6 +93,11 @@ void ClangFormatPlugin::initialize()
|
|||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
addTestCreator(Internal::createClangFormatTest);
|
addTestCreator(Internal::createClangFormatTest);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextEditor::ICodeStylePreferencesFactory *m_factory = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
} // ClangFormat
|
} // ClangFormat
|
||||||
|
|
||||||
|
#include "clangformatplugin.moc"
|
||||||
|
@@ -1,23 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <extensionsystem/iplugin.h>
|
|
||||||
|
|
||||||
namespace TextEditor { class ICodeStylePreferencesFactory; }
|
|
||||||
|
|
||||||
namespace ClangFormat {
|
|
||||||
|
|
||||||
class ClangFormatPlugin : public ExtensionSystem::IPlugin
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "ClangFormat.json")
|
|
||||||
|
|
||||||
~ClangFormatPlugin() override;
|
|
||||||
void initialize() final;
|
|
||||||
|
|
||||||
TextEditor::ICodeStylePreferencesFactory *m_factory = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangTools
|
|
Reference in New Issue
Block a user