Commit 5a7916d2 authored by Nikolai Kosjar's avatar Nikolai Kosjar

CppEditor: Clean up CppEditor/CppEditorWidget

* Excess includes and forward declarations
* Access protection levels
* QTC_OVERRIDE
* Remove declared but not implemented/used functions.
* Remove unused class

Change-Id: Ia19ddddccd9adde827a7875b466fde5ca4d96e7d
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 5f7f6f87
......@@ -72,12 +72,10 @@
#include <cplusplus/OverviewModel.h>
#include <cplusplus/BackwardsScanner.h>
#include <QDebug>
#include <QTimer>
#include <QPointer>
#include <QSignalMapper>
#include <QAction>
#include <QHeaderView>
#include <QMenu>
#include <QTextEdit>
#include <QSortFilterProxyModel>
......@@ -120,46 +118,9 @@ private:
CPlusPlus::OverviewModel *m_sourceModel;
};
class FindFunctionDefinitions: protected SymbolVisitor
class CanonicalSymbol
{
const Name *_declarationName;
QList<Function *> *_functions;
public:
FindFunctionDefinitions()
: _declarationName(0),
_functions(0)
{ }
void operator()(const Name *declarationName, Scope *globals,
QList<Function *> *functions)
{
_declarationName = declarationName;
_functions = functions;
for (unsigned i = 0; i < globals->memberCount(); ++i) {
accept(globals->memberAt(i));
}
}
protected:
using SymbolVisitor::visit;
virtual bool visit(Function *function)
{
const Name *name = function->name();
if (const QualifiedNameId *q = name->asQualifiedNameId())
name = q->name();
if (_declarationName->match(name))
_functions->append(function);
return false;
}
};
struct CanonicalSymbol
{
CPPEditorWidget *editor;
TypeOfExpression typeOfExpression;
SemanticInfo info;
......
......@@ -36,19 +36,14 @@
#include <cpptools/commentssettings.h>
#include <cpptools/cppsemanticinfo.h>
#include <texteditor/basetexteditor.h>
#include <texteditor/texteditorconstants.h>
#include <utils/qtcoverride.h>
#include <utils/uncommentselection.h>
#include <QFutureWatcher>
#include <QModelIndex>
#include <QMutex>
#include <QThread>
#include <QVector>
#include <QWaitCondition>
QT_BEGIN_NAMESPACE
class QComboBox;
class QSortFilterProxyModel;
class QToolButton;
QT_END_NAMESPACE
......@@ -58,13 +53,6 @@ class OverviewModel;
class Symbol;
}
namespace CppTools {
class CppCodeStyleSettings;
class CppModelManagerInterface;
class CppRefactoringFile;
}
namespace TextEditor { class FontSettings; }
namespace Utils { class TreeViewComboBox; }
namespace CppEditor {
......@@ -97,12 +85,14 @@ class CPPEditor : public TextEditor::BaseTextEditor
public:
CPPEditor(CPPEditorWidget *);
Core::IEditor *duplicate();
Core::IEditor *duplicate() QTC_OVERRIDE;
bool open(QString *errorString, const QString &fileName, const QString &realFileName);
bool open(QString *errorString,
const QString &fileName,
const QString &realFileName) QTC_OVERRIDE;
const Utils::CommentDefinition *commentDefinition() const;
TextEditor::CompletionAssistProvider *completionAssistProvider();
const Utils::CommentDefinition *commentDefinition() const QTC_OVERRIDE;
TextEditor::CompletionAssistProvider *completionAssistProvider() QTC_OVERRIDE;
private:
Utils::CommentDefinition m_commentDefinition;
......@@ -113,44 +103,39 @@ class CPPEditorWidget : public TextEditor::BaseTextEditorWidget
Q_OBJECT
public:
typedef TextEditor::TabSettings TabSettings;
static Link linkToSymbol(CPlusPlus::Symbol *symbol);
static QString identifierUnderCursor(QTextCursor *macroCursor);
public:
CPPEditorWidget(QWidget *parent = 0);
CPPEditorWidget(CPPEditorWidget *other);
~CPPEditorWidget();
CPPEditorDocument *cppEditorDocument() const;
void unCommentSelection();
unsigned editorRevision() const;
bool isOutdated() const;
CppTools::SemanticInfo semanticInfo() const;
CPlusPlus::OverviewModel *outlineModel() const;
QModelIndex outlineModelIndex();
virtual void paste(); // reimplemented from BaseTextEditorWidget
virtual void cut(); // reimplemented from BaseTextEditorWidget
virtual void selectAll(); // reimplemented from BaseTextEditorWidget
bool openLink(const Link &link, bool inNextSplit) { return openCppEditorAt(link, inNextSplit); }
static Link linkToSymbol(CPlusPlus::Symbol *symbol);
static QString identifierUnderCursor(QTextCursor *macroCursor);
virtual TextEditor::IAssistInterface *createAssistInterface(TextEditor::AssistKind kind,
TextEditor::AssistReason reason) const;
QSharedPointer<FunctionDeclDefLink> declDefLink() const;
void applyDeclDefLinkChanges(bool jumpToMatch);
TextEditor::IAssistInterface *createAssistInterface(
TextEditor::AssistKind kind,
TextEditor::AssistReason reason) const QTC_OVERRIDE;
FollowSymbolUnderCursor *followSymbolUnderCursorDelegate(); // exposed for tests
signals:
void outlineModelIndexChanged(const QModelIndex &index);
public slots:
void paste() QTC_OVERRIDE;
void cut() QTC_OVERRIDE;
void selectAll() QTC_OVERRIDE;
void unCommentSelection() QTC_OVERRIDE;
void setSortedOutline(bool sort);
void switchDeclarationDefinition(bool inNextSplit);
void renameSymbolUnderCursor();
......@@ -163,17 +148,20 @@ public slots:
unsigned revision);
protected:
bool event(QEvent *e);
void contextMenuEvent(QContextMenuEvent *);
void keyPressEvent(QKeyEvent *e);
bool event(QEvent *e) QTC_OVERRIDE;
void contextMenuEvent(QContextMenuEvent *) QTC_OVERRIDE;
void keyPressEvent(QKeyEvent *e) QTC_OVERRIDE;
void applyFontSettings();
TextEditor::BaseTextEditor *createEditor();
void applyFontSettings() QTC_OVERRIDE;
TextEditor::BaseTextEditor *createEditor() QTC_OVERRIDE;
bool openLink(const Link &link, bool inNextSplit) QTC_OVERRIDE
{ return openCppEditorAt(link, inNextSplit); }
const CPlusPlus::Macro *findCanonicalMacro(const QTextCursor &cursor,
CPlusPlus::Document::Ptr doc) const;
protected slots:
void slotCodeStyleSettingsChanged(const QVariant &);
void slotCodeStyleSettingsChanged(const QVariant &) QTC_OVERRIDE;
private slots:
void jumpToOutlineElement();
......@@ -206,12 +194,13 @@ private slots:
private:
CPPEditorWidget(TextEditor::BaseTextEditorWidget *); // avoid stupidity
void ctor();
unsigned editorRevision() const;
bool isOutdated() const;
void markSymbols(const QTextCursor &tc, const CppTools::SemanticInfo &info);
bool sortedOutline() const;
TextEditor::ITextEditor *openCppEditorAt(const QString &fileName, int line,
int column = 0);
void highlightUses(const QList<TextEditor::HighlightingResult> &uses,
QList<QTextEdit::ExtraSelection> *selections);
......@@ -223,7 +212,8 @@ private:
Q_SLOT void abortDeclDefLink();
Link findLinkAt(const QTextCursor &, bool resolveTarget = true, bool inNextSplit = false);
Link findLinkAt(const QTextCursor &, bool resolveTarget = true,
bool inNextSplit = false) QTC_OVERRIDE;
bool openCppEditorAt(const Link &, bool inNextSplit = false);
QModelIndex indexForPosition(int line, int column,
......
......@@ -53,6 +53,7 @@
#include <coreplugin/progressmanager/progressmanager.h>
#include <cpptools/cpptoolsconstants.h>
#include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorconstants.h>
#include <texteditor/texteditorsettings.h>
#include <utils/hostosinfo.h>
......
......@@ -37,6 +37,7 @@
#include <cpptools/cpplocalsymbols.h>
#include <cpptools/symbolfinder.h>
#include <texteditor/refactoroverlay.h>
#include <texteditor/texteditorconstants.h>
#include <cplusplus/ASTPath.h>
#include <cplusplus/CppRewriter.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment