File indexing completed on 2024-04-28 04:38:37
0001 /* 0002 SPDX-FileCopyrightText: 2009 Andreas Pakulat <apaku@gmx.de> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDEVPLATFORM_PLUGIN_DOCUMENTSWITCHERPLUGIN_H 0008 #define KDEVPLATFORM_PLUGIN_DOCUMENTSWITCHERPLUGIN_H 0009 0010 #include <interfaces/iplugin.h> 0011 #include <QVariant> 0012 0013 namespace Sublime 0014 { 0015 class MainWindow; 0016 } 0017 0018 namespace KDevelop 0019 { 0020 class IDocument; 0021 } 0022 0023 class DocumentSwitcherTreeView; 0024 0025 class QStandardItemModel; 0026 class QModelIndex; 0027 class QAction; 0028 0029 class DocumentSwitcherPlugin: public KDevelop::IPlugin { 0030 Q_OBJECT 0031 public: 0032 explicit DocumentSwitcherPlugin( QObject *parent, const QVariantList &args = QVariantList() ); 0033 ~DocumentSwitcherPlugin() override; 0034 0035 void unload() override; 0036 public Q_SLOTS: 0037 void itemActivated( const QModelIndex& ); 0038 void switchToClicked(const QModelIndex& ); 0039 void walkForward(); 0040 void walkBackward(); 0041 void documentOpened(KDevelop::IDocument *document); 0042 void documentActivated(KDevelop::IDocument *document); 0043 void documentClosed(KDevelop::IDocument *document); 0044 protected: 0045 bool eventFilter( QObject*, QEvent* ) override; 0046 private: 0047 void setViewGeometry(Sublime::MainWindow* window); 0048 void enableActions(); 0049 void fillModel(); 0050 void walk(const int from, const int to); 0051 0052 // List of opened document sorted activation. 0053 QList<KDevelop::IDocument *> documentLists; 0054 DocumentSwitcherTreeView* view; 0055 QStandardItemModel* model; 0056 QAction* forwardAction; 0057 QAction* backwardAction; 0058 }; 0059 0060 #endif 0061