2013-12-10 14:37:32 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2013-12-10 14:37:32 +01:00
|
|
|
**
|
|
|
|
|
** 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
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2013-12-10 14:37:32 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2013-12-10 14:37:32 +01:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2013-12-10 14:37:32 +01:00
|
|
|
|
2015-07-06 12:05:02 +02:00
|
|
|
#include "clangcompletionassistprovider.h"
|
2016-11-21 13:30:26 +01:00
|
|
|
#include "clanguiheaderondiskmanager.h"
|
2015-05-08 15:48:17 +02:00
|
|
|
|
2013-12-10 14:37:32 +01:00
|
|
|
#include <cpptools/cppmodelmanagersupport.h>
|
|
|
|
|
|
2015-05-08 15:48:17 +02:00
|
|
|
#include <QObject>
|
2013-12-10 14:37:32 +01:00
|
|
|
#include <QScopedPointer>
|
|
|
|
|
|
2017-08-03 16:43:38 +02:00
|
|
|
#include <memory>
|
|
|
|
|
|
2015-08-24 18:26:09 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QMenu;
|
|
|
|
|
class QWidget;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2015-05-08 15:48:17 +02:00
|
|
|
namespace Core { class IDocument; }
|
2015-08-24 18:26:09 +02:00
|
|
|
namespace TextEditor { class TextEditorWidget; }
|
2017-09-26 16:00:30 +02:00
|
|
|
namespace CppTools {
|
|
|
|
|
class FollowSymbolInterface;
|
|
|
|
|
class RefactoringEngineInterface;
|
|
|
|
|
} // namespace CppTools
|
2015-05-08 15:48:17 +02:00
|
|
|
|
2013-12-10 14:37:32 +01:00
|
|
|
namespace ClangCodeModel {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2015-05-08 15:48:17 +02:00
|
|
|
class ModelManagerSupportClang:
|
|
|
|
|
public QObject,
|
|
|
|
|
public CppTools::ModelManagerSupport
|
2013-12-10 14:37:32 +01:00
|
|
|
{
|
2015-05-08 15:48:17 +02:00
|
|
|
Q_OBJECT
|
2013-12-10 14:37:32 +01:00
|
|
|
|
|
|
|
|
public:
|
2015-05-08 15:48:17 +02:00
|
|
|
ModelManagerSupportClang();
|
|
|
|
|
~ModelManagerSupportClang();
|
|
|
|
|
|
|
|
|
|
CppTools::CppCompletionAssistProvider *completionAssistProvider() override;
|
|
|
|
|
CppTools::BaseEditorDocumentProcessor *editorDocumentProcessor(
|
|
|
|
|
TextEditor::TextDocument *baseTextDocument) override;
|
2017-09-18 10:19:27 +02:00
|
|
|
CppTools::FollowSymbolInterface &followSymbolInterface() override;
|
2017-09-26 16:00:30 +02:00
|
|
|
CppTools::RefactoringEngineInterface &refactoringEngineInterface() override;
|
2013-12-10 14:37:32 +01:00
|
|
|
|
2017-09-25 15:10:48 +02:00
|
|
|
BackendCommunicator &communicator();
|
2016-11-21 13:30:26 +01:00
|
|
|
QString dummyUiHeaderOnDiskDirPath() const;
|
|
|
|
|
QString dummyUiHeaderOnDiskPath(const QString &filePath) const;
|
2013-12-10 14:37:32 +01:00
|
|
|
|
2016-11-21 13:30:26 +01:00
|
|
|
static ModelManagerSupportClang *instance();
|
2013-12-10 14:37:32 +01:00
|
|
|
|
|
|
|
|
private:
|
2015-05-08 15:48:17 +02:00
|
|
|
void onEditorOpened(Core::IEditor *editor);
|
2015-12-01 11:57:08 +01:00
|
|
|
void onEditorClosed(const QList<Core::IEditor *> &editors);
|
2015-05-08 15:48:17 +02:00
|
|
|
void onCurrentEditorChanged(Core::IEditor *newCurrent);
|
2015-09-15 16:24:52 +02:00
|
|
|
void onCppDocumentAboutToReloadOnTranslationUnit();
|
2015-08-31 16:10:36 +02:00
|
|
|
void onCppDocumentReloadFinishedOnTranslationUnit(bool success);
|
2015-09-28 17:42:43 +02:00
|
|
|
void onCppDocumentContentsChangedOnTranslationUnit(int position,
|
|
|
|
|
int charsRemoved,
|
|
|
|
|
int charsAdded);
|
2015-09-15 16:24:52 +02:00
|
|
|
void onCppDocumentAboutToReloadOnUnsavedFile();
|
2015-08-31 16:10:36 +02:00
|
|
|
void onCppDocumentReloadFinishedOnUnsavedFile(bool success);
|
|
|
|
|
void onCppDocumentContentsChangedOnUnsavedFile();
|
2015-05-08 15:48:17 +02:00
|
|
|
|
|
|
|
|
void onAbstractEditorSupportContentsUpdated(const QString &filePath, const QByteArray &content);
|
|
|
|
|
void onAbstractEditorSupportRemoved(const QString &filePath);
|
|
|
|
|
|
2015-08-24 18:26:09 +02:00
|
|
|
void onTextMarkContextMenuRequested(TextEditor::TextEditorWidget *widget,
|
|
|
|
|
int lineNumber,
|
|
|
|
|
QMenu *menu);
|
|
|
|
|
|
2015-05-08 15:48:17 +02:00
|
|
|
void onProjectPartsUpdated(ProjectExplorer::Project *project);
|
2015-07-14 17:30:17 +02:00
|
|
|
void onProjectPartsRemoved(const QStringList &projectPartIds);
|
2015-05-08 15:48:17 +02:00
|
|
|
|
2015-09-18 12:19:46 +02:00
|
|
|
void unregisterTranslationUnitsWithProjectParts(const QStringList &projectPartIds);
|
|
|
|
|
|
2015-08-31 16:10:36 +02:00
|
|
|
void connectTextDocumentToTranslationUnit(TextEditor::TextDocument *textDocument);
|
|
|
|
|
void connectTextDocumentToUnsavedFiles(TextEditor::TextDocument *textDocument);
|
2015-09-15 16:24:52 +02:00
|
|
|
void connectToTextDocumentContentsChangedForTranslationUnit(
|
|
|
|
|
TextEditor::TextDocument *textDocument);
|
|
|
|
|
void connectToTextDocumentContentsChangedForUnsavedFile(TextEditor::TextDocument *textDocument);
|
2015-08-24 18:26:09 +02:00
|
|
|
void connectToWidgetsMarkContextMenuRequested(QWidget *editorWidget);
|
2015-08-31 16:10:36 +02:00
|
|
|
|
|
|
|
|
private:
|
2016-11-21 13:30:26 +01:00
|
|
|
UiHeaderOnDiskManager m_uiHeaderOnDiskManager;
|
2017-09-25 15:10:48 +02:00
|
|
|
BackendCommunicator m_communicator;
|
2015-06-16 13:59:08 +02:00
|
|
|
ClangCompletionAssistProvider m_completionAssistProvider;
|
2017-09-18 10:19:27 +02:00
|
|
|
std::unique_ptr<CppTools::FollowSymbolInterface> m_followSymbol;
|
2017-09-26 16:00:30 +02:00
|
|
|
std::unique_ptr<CppTools::RefactoringEngineInterface> m_refactoringEngine;
|
2015-05-08 15:48:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class ModelManagerSupportProviderClang : public CppTools::ModelManagerSupportProvider
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
QString id() const override;
|
|
|
|
|
QString displayName() const override;
|
|
|
|
|
|
|
|
|
|
CppTools::ModelManagerSupport::Ptr createModelManagerSupport() override;
|
2013-12-10 14:37:32 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace ClangCodeModel
|