File indexing completed on 2024-04-28 05:49:07

0001 /*  This file is part of the Kate project.
0002  *
0003  *  SPDX-FileCopyrightText: 2010 Christoph Cullmann <cullmann@kde.org>
0004  *
0005  *  SPDX-License-Identifier: LGPL-2.0-or-later
0006  */
0007 
0008 #pragma once
0009 
0010 #include <QLineEdit>
0011 #include <QTreeView>
0012 #include <QWidget>
0013 
0014 class KateProjectPluginView;
0015 class KMessageWidget;
0016 class KateProject;
0017 class QStandardItemModel;
0018 
0019 /**
0020  * Class representing a view of a project.
0021  * A tree like view of project content.
0022  */
0023 class KateProjectInfoViewIndex : public QWidget
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     /**
0029      * construct project info view for given project
0030      * @param pluginView our plugin view
0031      * @param project project this view is for
0032      */
0033     KateProjectInfoViewIndex(KateProjectPluginView *pluginView, KateProject *project, QWidget *parent = nullptr);
0034 
0035     /**
0036      * deconstruct info view
0037      */
0038     ~KateProjectInfoViewIndex() override;
0039 
0040     /**
0041      * our project.
0042      * @return project
0043      */
0044     KateProject *project() const
0045     {
0046         return m_project;
0047     }
0048 
0049 private Q_SLOTS:
0050     /**
0051      * Called if text in lineedit changes, then we need to search
0052      * @param text new text
0053      */
0054     void slotTextChanged(const QString &text);
0055 
0056     /**
0057      * item got clicked, do stuff, like open document
0058      * @param index model index of clicked item
0059      */
0060     void slotClicked(const QModelIndex &index);
0061 
0062     /**
0063      * called whenever the index of the project was updated. Here,
0064      * it's used to show a warning, if ctags is not installed.
0065      */
0066     void indexAvailable();
0067 
0068     /**
0069      * called to enable or disable widgets
0070      * @param enable
0071      */
0072     void enableWidgets(bool enable);
0073 
0074     /**
0075      * called if goto symbol is requested
0076      * @param text target symbol
0077      * @param number of results
0078      */
0079     void slotGotoSymbol(const QString &text, int &results);
0080 
0081 private:
0082     /**
0083      * our plugin view
0084      */
0085     KateProjectPluginView *m_pluginView;
0086 
0087     /**
0088      * our project
0089      */
0090     KateProject *m_project;
0091 
0092     /**
0093      * information widget showing a warning about missing ctags.
0094      */
0095     KMessageWidget *m_messageWidget;
0096 
0097     /**
0098      * line edit which allows to search index
0099      */
0100     QLineEdit *m_lineEdit;
0101 
0102     /**
0103      * tree view for results
0104      */
0105     QTreeView *m_treeView;
0106 
0107     /**
0108      * standard item model for results
0109      */
0110     QStandardItemModel *m_model;
0111 };