diff options
author | David Schulz <david.schulz@qt.io> | 2022-08-19 14:38:11 +0200 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2022-08-26 04:48:56 +0000 |
commit | 86b451f71ed53c4ed8941460f4a7af695fa7ce04 (patch) | |
tree | 0f5532517c01849fd01e6b5c79dcc071e9b31f25 | |
parent | 327e229ce0e1e04f447b5513aa3da661967613ba (diff) |
CppEditor: rename overview -> outline
There is now a clean border border between outline and overview.
Everything defined in CppEditor uses outline and everything in cplusplus
uses overview.
Change-Id: Ic6637dc53fca3401417180b1873303012a813113
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
-rw-r--r-- | src/plugins/cppeditor/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppbuiltinmodelmanagersupport.cpp | 2 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppeditor.qbs | 4 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppeditordocument.cpp | 2 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppeditordocument.h | 6 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppeditoroutline.cpp | 12 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppeditoroutline.h | 4 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppmodelmanager.cpp | 2 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppmodelmanagersupport.h | 1 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppoutline.cpp | 4 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppoutline.h | 8 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppoutlinemodel.cpp (renamed from src/plugins/cppeditor/cppoverviewmodel.cpp) | 66 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppoutlinemodel.h (renamed from src/plugins/cppeditor/cppoverviewmodel.h) | 4 |
13 files changed, 58 insertions, 59 deletions
diff --git a/src/plugins/cppeditor/CMakeLists.txt b/src/plugins/cppeditor/CMakeLists.txt index d7836fc9cb..7f32e3faa7 100644 --- a/src/plugins/cppeditor/CMakeLists.txt +++ b/src/plugins/cppeditor/CMakeLists.txt @@ -63,7 +63,7 @@ add_qtc_plugin(CppEditor cppmodelmanager.cpp cppmodelmanager.h cppmodelmanagersupport.cpp cppmodelmanagersupport.h cppoutline.cpp cppoutline.h - cppoverviewmodel.cpp cppoverviewmodel.h + cppoutlinemodel.cpp cppoutlinemodel.h cppparsecontext.cpp cppparsecontext.h cpppointerdeclarationformatter.cpp cpppointerdeclarationformatter.h cpppreprocessordialog.cpp cpppreprocessordialog.h cpppreprocessordialog.ui diff --git a/src/plugins/cppeditor/cppbuiltinmodelmanagersupport.cpp b/src/plugins/cppeditor/cppbuiltinmodelmanagersupport.cpp index 5c0a51b040..b4c21ca4f8 100644 --- a/src/plugins/cppeditor/cppbuiltinmodelmanagersupport.cpp +++ b/src/plugins/cppeditor/cppbuiltinmodelmanagersupport.cpp @@ -31,7 +31,7 @@ #include "cppeditorwidget.h" #include "cppelementevaluator.h" #include "cppfollowsymbolundercursor.h" -#include "cppoverviewmodel.h" +#include "cppoutlinemodel.h" #include "cpptoolsreuse.h" #include "symbolfinder.h" diff --git a/src/plugins/cppeditor/cppeditor.qbs b/src/plugins/cppeditor/cppeditor.qbs index 9960d309f8..28f1dc96ac 100644 --- a/src/plugins/cppeditor/cppeditor.qbs +++ b/src/plugins/cppeditor/cppeditor.qbs @@ -142,8 +142,8 @@ QtcPlugin { "cppmodelmanagersupport.h", "cppoutline.cpp", "cppoutline.h", - "cppoverviewmodel.cpp", - "cppoverviewmodel.h", + "cppoutlinemodel.cpp", + "cppoutlinemodel.h", "cppparsecontext.cpp", "cppparsecontext.h", "cpppointerdeclarationformatter.cpp", diff --git a/src/plugins/cppeditor/cppeditordocument.cpp b/src/plugins/cppeditor/cppeditordocument.cpp index cce259c2d8..94bf38dc14 100644 --- a/src/plugins/cppeditor/cppeditordocument.cpp +++ b/src/plugins/cppeditor/cppeditordocument.cpp @@ -393,7 +393,7 @@ ParseContextModel &CppEditorDocument::parseContextModel() return m_parseContextModel; } -OverviewModel &CppEditorDocument::outlineModel() +OutlineModel &CppEditorDocument::outlineModel() { return m_overviewModel; } diff --git a/src/plugins/cppeditor/cppeditordocument.h b/src/plugins/cppeditor/cppeditordocument.h index 3d6dcc2f6a..b20436f4b2 100644 --- a/src/plugins/cppeditor/cppeditordocument.h +++ b/src/plugins/cppeditor/cppeditordocument.h @@ -27,7 +27,7 @@ #include "baseeditordocumentprocessor.h" #include "cppcompletionassistprovider.h" -#include "cppoverviewmodel.h" +#include "cppoutlinemodel.h" #include "cppparsecontext.h" #include "cppsemanticinfo.h" #include "editordocumenthandle.h" @@ -63,7 +63,7 @@ public: void scheduleProcessDocument(); ParseContextModel &parseContextModel(); - OverviewModel &outlineModel(); + OutlineModel &outlineModel(); void updateOutline(); QFuture<CursorInfo> cursorInfo(const CursorInfoParams ¶ms); @@ -137,7 +137,7 @@ private: QScopedPointer<CppEditorDocumentHandle> m_editorDocumentHandle; ParseContextModel m_parseContextModel; - OverviewModel m_overviewModel; + OutlineModel m_overviewModel; }; } // namespace Internal diff --git a/src/plugins/cppeditor/cppeditoroutline.cpp b/src/plugins/cppeditor/cppeditoroutline.cpp index 5d26ae103b..a9c25c9522 100644 --- a/src/plugins/cppeditor/cppeditoroutline.cpp +++ b/src/plugins/cppeditor/cppeditoroutline.cpp @@ -28,7 +28,7 @@ #include "cppeditordocument.h" #include "cppeditorwidget.h" #include "cppmodelmanager.h" -#include "cppoverviewmodel.h" +#include "cppoutlinemodel.h" #include "cpptoolssettings.h" #include <texteditor/texteditor.h> @@ -54,12 +54,12 @@ enum { UpdateOutlineIntervalInMs = 500 }; namespace { -class OverviewProxyModel : public QSortFilterProxyModel +class OutlineProxyModel : public QSortFilterProxyModel { Q_OBJECT public: - OverviewProxyModel(CppEditor::Internal::OverviewModel &sourceModel, QObject *parent) + OutlineProxyModel(CppEditor::Internal::OutlineModel &sourceModel, QObject *parent) : QSortFilterProxyModel(parent) , m_sourceModel(sourceModel) { @@ -75,7 +75,7 @@ public: return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent); } private: - CppEditor::Internal::OverviewModel &m_sourceModel; + CppEditor::Internal::OutlineModel &m_sourceModel; }; QTimer *newSingleShotTimer(QObject *parent, int msInternal, const QString &objectName) @@ -97,7 +97,7 @@ CppEditorOutline::CppEditorOutline(CppEditorWidget *editorWidget) , m_combo(new Utils::TreeViewComboBox) { m_model = &editorWidget->cppEditorDocument()->outlineModel(); - m_proxyModel = new OverviewProxyModel(*m_model, this); + m_proxyModel = new OutlineProxyModel(*m_model, this); m_proxyModel->setSourceModel(m_model); // Set up proxy model @@ -128,7 +128,7 @@ CppEditorOutline::CppEditorOutline(CppEditorWidget *editorWidget) connect(m_combo, &QComboBox::activated, this, &CppEditorOutline::gotoSymbolInEditor); connect(m_combo, &QComboBox::currentIndexChanged, this, &CppEditorOutline::updateToolTip); - connect(m_model, &OverviewModel::modelReset, this, &CppEditorOutline::updateNow); + connect(m_model, &OutlineModel::modelReset, this, &CppEditorOutline::updateNow); // Set up timers m_updateIndexTimer = newSingleShotTimer(this, UpdateOutlineIntervalInMs, QLatin1String("CppEditorOutline::m_updateIndexTimer")); diff --git a/src/plugins/cppeditor/cppeditoroutline.h b/src/plugins/cppeditor/cppeditoroutline.h index f8a05d90e8..4c3945e331 100644 --- a/src/plugins/cppeditor/cppeditoroutline.h +++ b/src/plugins/cppeditor/cppeditoroutline.h @@ -25,7 +25,7 @@ #pragma once -#include "cppoverviewmodel.h" +#include "cppoutlinemodel.h" #include <QModelIndex> #include <QObject> @@ -68,7 +68,7 @@ private: bool isSorted() const; - OverviewModel *m_model = nullptr; // Not owned + OutlineModel *m_model = nullptr; // Not owned CppEditorWidget *m_editorWidget = nullptr; diff --git a/src/plugins/cppeditor/cppmodelmanager.cpp b/src/plugins/cppeditor/cppmodelmanager.cpp index 41f343c11b..4ef2de5d13 100644 --- a/src/plugins/cppeditor/cppmodelmanager.cpp +++ b/src/plugins/cppeditor/cppmodelmanager.cpp @@ -26,7 +26,7 @@ #include "cppmodelmanager.h" #include "abstracteditorsupport.h" -#include "cppoverviewmodel.h" +#include "cppoutlinemodel.h" #include "baseeditordocumentprocessor.h" #include "builtinindexingsupport.h" #include "cppcodemodelinspectordumper.h" diff --git a/src/plugins/cppeditor/cppmodelmanagersupport.h b/src/plugins/cppeditor/cppmodelmanagersupport.h index e7df47bb8d..7133e2e620 100644 --- a/src/plugins/cppeditor/cppmodelmanagersupport.h +++ b/src/plugins/cppeditor/cppmodelmanagersupport.h @@ -42,7 +42,6 @@ class BaseHoverHandler; namespace CppEditor { -class OverviewModel; class BaseEditorDocumentProcessor; class CppCompletionAssistProvider; class ProjectPart; diff --git a/src/plugins/cppeditor/cppoutline.cpp b/src/plugins/cppeditor/cppoutline.cpp index 0a213c239b..91ccefba9d 100644 --- a/src/plugins/cppeditor/cppoutline.cpp +++ b/src/plugins/cppeditor/cppoutline.cpp @@ -28,7 +28,7 @@ #include "cppeditoroutline.h" #include "cppeditordocument.h" #include "cppmodelmanager.h" -#include "cppoverviewmodel.h" +#include "cppoutlinemodel.h" #include <coreplugin/find/itemviewfind.h> #include <coreplugin/editormanager/editormanager.h> @@ -69,7 +69,7 @@ void CppOutlineTreeView::contextMenuEvent(QContextMenuEvent *event) event->accept(); } -CppOutlineFilterModel::CppOutlineFilterModel(OverviewModel &sourceModel, +CppOutlineFilterModel::CppOutlineFilterModel(OutlineModel &sourceModel, QObject *parent) : QSortFilterProxyModel(parent) , m_sourceModel(sourceModel) diff --git a/src/plugins/cppeditor/cppoutline.h b/src/plugins/cppeditor/cppoutline.h index 053213fd4c..36bf05afdd 100644 --- a/src/plugins/cppeditor/cppoutline.h +++ b/src/plugins/cppeditor/cppoutline.h @@ -26,7 +26,7 @@ #pragma once #include "cppeditorwidget.h" -#include "cppoverviewmodel.h" +#include "cppoutlinemodel.h" #include <texteditor/ioutlinewidget.h> @@ -51,13 +51,13 @@ class CppOutlineFilterModel : public QSortFilterProxyModel { Q_OBJECT public: - CppOutlineFilterModel(OverviewModel &sourceModel, QObject *parent); + CppOutlineFilterModel(OutlineModel &sourceModel, QObject *parent); // QSortFilterProxyModel bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override; Qt::DropActions supportedDragActions() const override; private: - OverviewModel &m_sourceModel; + OutlineModel &m_sourceModel; }; class CppOutlineWidget : public TextEditor::IOutlineWidget @@ -85,7 +85,7 @@ private: private: CppEditorWidget *m_editor; CppOutlineTreeView *m_treeView; - OverviewModel * const m_model; + OutlineModel * const m_model; QSortFilterProxyModel *m_proxyModel; QTimer m_updateIndexTimer; diff --git a/src/plugins/cppeditor/cppoverviewmodel.cpp b/src/plugins/cppeditor/cppoutlinemodel.cpp index 3632dc7536..2edda90373 100644 --- a/src/plugins/cppeditor/cppoverviewmodel.cpp +++ b/src/plugins/cppeditor/cppoutlinemodel.cpp @@ -23,7 +23,7 @@ ** ****************************************************************************/ -#include "cppoverviewmodel.h" +#include "cppoutlinemodel.h" #include <cplusplus/Icons.h> #include <cplusplus/Literals.h> @@ -60,13 +60,13 @@ public: } } - auto overviewModel = qobject_cast<const OverviewModel*>(model()); - if (!symbol || !overviewModel) + auto outlineModel = qobject_cast<const OutlineModel*>(model()); + if (!symbol || !outlineModel) return QVariant(); switch (role) { case Qt::DisplayRole: { - QString name = overviewModel->m_overview.prettyName(symbol->name()); + QString name = outlineModel->m_overview.prettyName(symbol->name()); if (name.isEmpty()) name = QLatin1String("anonymous"); if (symbol->asObjCForwardClassDeclaration()) @@ -81,8 +81,8 @@ public: name = QLatin1String("@implementation ") + name; if (clazz->isCategory()) { - name += QString(" (%1)").arg(overviewModel->m_overview.prettyName( - clazz->categoryName())); + name += QString(" (%1)").arg( + outlineModel->m_overview.prettyName(clazz->categoryName())); } } if (symbol->asObjCPropertyDeclaration()) @@ -94,7 +94,7 @@ public: QStringList parameters; parameters.reserve(t->templateParameterCount()); for (int i = 0; i < t->templateParameterCount(); ++i) { - parameters.append(overviewModel->m_overview.prettyName( + parameters.append(outlineModel->m_overview.prettyName( t->templateParameterAt(i)->name())); } name += QString("<%1>").arg(parameters.join(QLatin1String(", "))); @@ -107,10 +107,10 @@ public: else name = QLatin1Char('-') + name; } else if (! symbl->asScope() || symbl->asFunction()) { - QString type = overviewModel->m_overview.prettyType(symbl->type()); + QString type = outlineModel->m_overview.prettyType(symbl->type()); if (Function *f = symbl->type()->asFunctionType()) { name += type; - type = overviewModel->m_overview.prettyType(f->returnType()); + type = outlineModel->m_overview.prettyType(f->returnType()); } if (! type.isEmpty()) name += QLatin1String(": ") + type; @@ -119,7 +119,7 @@ public: } case Qt::EditRole: { - QString name = overviewModel->m_overview.prettyName(symbol->name()); + QString name = outlineModel->m_overview.prettyName(symbol->name()); if (name.isEmpty()) name = QLatin1String("anonymous"); return name; @@ -128,10 +128,10 @@ public: case Qt::DecorationRole: return Icons::iconForSymbol(symbol); - case OverviewModel::FileNameRole: + case OutlineModel::FileNameRole: return QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()); - case OverviewModel::LineNumberRole: + case OutlineModel::LineNumberRole: return symbol->line(); default: @@ -142,7 +142,7 @@ public: CPlusPlus::Symbol *symbol = nullptr; // not owned }; -int OverviewModel::globalSymbolCount() const +int OutlineModel::globalSymbolCount() const { int count = 0; if (m_cppDocument) @@ -150,10 +150,10 @@ int OverviewModel::globalSymbolCount() const return count; } -Symbol *OverviewModel::globalSymbolAt(int index) const +Symbol *OutlineModel::globalSymbolAt(int index) const { return m_cppDocument->globalSymbolAt(index); } -Symbol *OverviewModel::symbolFromIndex(const QModelIndex &index) const +Symbol *OutlineModel::symbolFromIndex(const QModelIndex &index) const { if (!index.isValid()) return nullptr; @@ -161,16 +161,16 @@ Symbol *OverviewModel::symbolFromIndex(const QModelIndex &index) const return item ? item->symbol : nullptr; } -OverviewModel::OverviewModel(QObject *parent) +OutlineModel::OutlineModel(QObject *parent) : Utils::TreeModel<>(parent) { m_updateTimer = new QTimer(this); m_updateTimer->setSingleShot(true); m_updateTimer->setInterval(500); - connect(m_updateTimer, &QTimer::timeout, this, &OverviewModel::rebuild); + connect(m_updateTimer, &QTimer::timeout, this, &OutlineModel::rebuild); } -Qt::ItemFlags OverviewModel::flags(const QModelIndex &index) const +Qt::ItemFlags OutlineModel::flags(const QModelIndex &index) const { if (!index.isValid()) return Qt::NoItemFlags; @@ -178,17 +178,17 @@ Qt::ItemFlags OverviewModel::flags(const QModelIndex &index) const return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled; } -Qt::DropActions OverviewModel::supportedDragActions() const +Qt::DropActions OutlineModel::supportedDragActions() const { return Qt::MoveAction; } -QStringList OverviewModel::mimeTypes() const +QStringList OutlineModel::mimeTypes() const { return Utils::DropSupport::mimeTypesForFilePaths(); } -QMimeData *OverviewModel::mimeData(const QModelIndexList &indexes) const +QMimeData *OutlineModel::mimeData(const QModelIndexList &indexes) const { auto mimeData = new Utils::DropMimeData; for (const QModelIndex &index : indexes) { @@ -204,18 +204,18 @@ QMimeData *OverviewModel::mimeData(const QModelIndexList &indexes) const return mimeData; } -void OverviewModel::update(CPlusPlus::Document::Ptr doc) +void OutlineModel::update(CPlusPlus::Document::Ptr doc) { m_candidate = doc; m_updateTimer->start(); } -int OverviewModel::editorRevision() +int OutlineModel::editorRevision() { return m_cppDocument ? m_cppDocument->editorRevision() : -1; } -void OverviewModel::rebuild() +void OutlineModel::rebuild() { beginResetModel(); m_cppDocument = m_candidate; @@ -227,13 +227,13 @@ void OverviewModel::rebuild() endResetModel(); } -bool OverviewModel::isGenerated(const QModelIndex &sourceIndex) const +bool OutlineModel::isGenerated(const QModelIndex &sourceIndex) const { CPlusPlus::Symbol *symbol = symbolFromIndex(sourceIndex); return symbol && symbol->isGenerated(); } -Utils::Link OverviewModel::linkFromIndex(const QModelIndex &sourceIndex) const +Utils::Link OutlineModel::linkFromIndex(const QModelIndex &sourceIndex) const { CPlusPlus::Symbol *symbol = symbolFromIndex(sourceIndex); if (!symbol) @@ -242,7 +242,7 @@ Utils::Link OverviewModel::linkFromIndex(const QModelIndex &sourceIndex) const return symbol->toLink(); } -Utils::LineColumn OverviewModel::lineColumnFromIndex(const QModelIndex &sourceIndex) const +Utils::LineColumn OutlineModel::lineColumnFromIndex(const QModelIndex &sourceIndex) const { Utils::LineColumn lineColumn; CPlusPlus::Symbol *symbol = symbolFromIndex(sourceIndex); @@ -253,13 +253,13 @@ Utils::LineColumn OverviewModel::lineColumnFromIndex(const QModelIndex &sourceIn return lineColumn; } -OverviewModel::Range OverviewModel::rangeFromIndex(const QModelIndex &sourceIndex) const +OutlineModel::Range OutlineModel::rangeFromIndex(const QModelIndex &sourceIndex) const { Utils::LineColumn lineColumn = lineColumnFromIndex(sourceIndex); return std::make_pair(lineColumn, lineColumn); } -void OverviewModel::buildTree(SymbolItem *root, bool isRoot) +void OutlineModel::buildTree(SymbolItem *root, bool isRoot) { if (!root) return; @@ -291,7 +291,7 @@ void OverviewModel::buildTree(SymbolItem *root, bool isRoot) } } -static bool contains(const OverviewModel::Range &range, int line, int column) +static bool contains(const OutlineModel::Range &range, int line, int column) { if (line < range.first.line || line > range.second.line) return false; @@ -302,14 +302,14 @@ static bool contains(const OverviewModel::Range &range, int line, int column) return true; } -QModelIndex OverviewModel::indexForPosition(int line, int column, - const QModelIndex &rootIndex) const +QModelIndex OutlineModel::indexForPosition(int line, int column, + const QModelIndex &rootIndex) const { QModelIndex lastIndex = rootIndex; const int rowCount = this->rowCount(rootIndex); for (int row = 0; row < rowCount; ++row) { const QModelIndex index = this->index(row, 0, rootIndex); - const OverviewModel::Range range = rangeFromIndex(index); + const OutlineModel::Range range = rangeFromIndex(index); if (range.first.line > line) break; // Skip ranges that do not include current line and column. diff --git a/src/plugins/cppeditor/cppoverviewmodel.h b/src/plugins/cppeditor/cppoutlinemodel.h index d05d51c513..8501f8e865 100644 --- a/src/plugins/cppeditor/cppoverviewmodel.h +++ b/src/plugins/cppeditor/cppoutlinemodel.h @@ -43,12 +43,12 @@ class Link; namespace CppEditor::Internal { class SymbolItem; -class OverviewModel : public Utils::TreeModel<> +class OutlineModel : public Utils::TreeModel<> { Q_OBJECT public: - explicit OverviewModel(QObject *parent = nullptr); + explicit OutlineModel(QObject *parent = nullptr); enum Role { FileNameRole = Qt::UserRole + 1, |