File indexing completed on 2024-04-28 04:39:09

0001 /*
0002     SPDX-FileCopyrightText: 2005 Roberto Raggi <roberto@kdevelop.org>
0003     SPDX-FileCopyrightText: 2007 Andreas Pakulat <apaku@gmx.de>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef KDEVPLATFORM_PLUGIN_PROJECTMANAGERVIEW_H
0009 #define KDEVPLATFORM_PLUGIN_PROJECTMANAGERVIEW_H
0010 
0011 #include <QWidget>
0012 
0013 #include <interfaces/context.h>
0014 #include <project/projectutils.h>
0015 
0016 class QModelIndex;
0017 class QAction;
0018 
0019 namespace Ui
0020 {
0021 class ProjectManagerView;
0022 }
0023 
0024 class ProjectProxyModel;
0025 class VcsOverlayProxyModel;
0026 
0027 namespace KDevelop
0028 {
0029 class ProjectBaseItem;
0030 class Path;
0031 }
0032 
0033 class ProjectManagerView;
0034 class ProjectManagerViewPlugin;
0035 
0036 //own subclass to the current view can be passed from ProjectManagetView to ProjectManagerViewPlugin
0037 class ProjectManagerViewItemContext : public KDevelop::ProjectItemContextImpl
0038 {
0039 public:
0040     ProjectManagerViewItemContext(const QList< KDevelop::ProjectBaseItem* >& items, ProjectManagerView *view);
0041     ProjectManagerView *view() const;
0042 private:
0043     ProjectManagerView *m_view;
0044 };
0045 
0046 class ProjectManagerView: public QWidget
0047 {
0048     Q_OBJECT
0049 public:
0050     ProjectManagerView( ProjectManagerViewPlugin*, QWidget *parent );
0051     ~ProjectManagerView() override;
0052 
0053     ProjectManagerViewPlugin* plugin() const { return m_plugin; }
0054     QList<KDevelop::ProjectBaseItem*> selectedItems() const;
0055     void selectItems(const QList<KDevelop::ProjectBaseItem*> &items);
0056     void expandItem(KDevelop::ProjectBaseItem *item);
0057 
0058 protected:
0059     bool eventFilter(QObject* obj, QEvent* event) override;
0060 
0061 private Q_SLOTS:
0062     void selectionChanged();
0063     void raiseAndLocateCurrentDocument();
0064     void open( const KDevelop::Path& );
0065     void toggleHideTargets(bool hidden);
0066     void toggleSyncCurrentDocument(bool sync);
0067 
0068 private:
0069     void locateCurrentDocument();
0070     QModelIndex indexFromView(const QModelIndex& index) const;
0071     QModelIndex indexToView(const QModelIndex& index) const;
0072 
0073     QAction* m_toggleTargetsAction;
0074     Ui::ProjectManagerView* m_ui;
0075     QStringList m_cachedFileList;
0076     ProjectProxyModel* m_modelFilter;
0077     VcsOverlayProxyModel* m_overlayProxy;
0078     ProjectManagerViewPlugin* m_plugin;
0079 };
0080 
0081 #endif // KDEVPLATFORM_PLUGIN_PROJECTMANAGERVIEW_H
0082