File indexing completed on 2024-05-05 05:51:37

0001 /*
0002     SPDX-FileCopyrightText: 2020 Waqar Ahmed <waqar.17a@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 #pragma once
0007 
0008 #include <KTextEditor/Cursor>
0009 #include <QWidget>
0010 
0011 class GotoSymbolTreeView;
0012 class GotoSymbolModel;
0013 class QLineEdit;
0014 class CtagsGotoSymbolProxyModel;
0015 class QTreeView;
0016 class GotoGlobalSymbolModel;
0017 class KateCTagsView;
0018 class GotoStyleDelegate;
0019 
0020 namespace KTextEditor
0021 {
0022 class MainWindow;
0023 }
0024 
0025 class GotoSymbolWidget : public QWidget
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     explicit GotoSymbolWidget(KTextEditor::MainWindow *mainWindow, KateCTagsView *pluginView, QWidget *parent = nullptr);
0031 
0032     bool eventFilter(QObject *watched, QEvent *event) override;
0033     void updateViewGeometry();
0034     void showSymbols(const QString &filePath);
0035     void showGlobalSymbols(const QString &tagFilePath);
0036     void loadGlobalSymbols(const QString &text);
0037     void reselectFirst();
0038 
0039     enum Mode { Global, Local };
0040 
0041 private Q_SLOTS:
0042     void slotReturnPressed();
0043 
0044 private:
0045     void changeMode(Mode newMode);
0046 
0047 private:
0048     Mode mode;
0049     KateCTagsView *ctagsPluginView;
0050     GotoStyleDelegate *m_styleDelegate;
0051     KTextEditor::MainWindow *m_mainWindow;
0052     GotoSymbolTreeView *m_treeView;
0053     CtagsGotoSymbolProxyModel *m_proxyModel;
0054     GotoSymbolModel *m_symbolsModel;
0055     GotoGlobalSymbolModel *m_globalSymbolsModel;
0056     QLineEdit *m_lineEdit;
0057     KTextEditor::Cursor oldPos;
0058     QString m_tagFile;
0059 };