File indexing completed on 2024-04-28 04:39:52
0001 /* 0002 SPDX-FileCopyrightText: 2012 Miha Čančula <miha@noughmad.eu> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KDEVPLATFORM_PLUGIN_TESTVIEW_H 0008 #define KDEVPLATFORM_PLUGIN_TESTVIEW_H 0009 0010 #include <QTreeView> 0011 #include <QAction> 0012 #include <interfaces/itestcontroller.h> 0013 0014 class QSortFilterProxyModel; 0015 class QStandardItem; 0016 class TestViewPlugin; 0017 class QStandardItemModel; 0018 0019 namespace KDevelop { 0020 class ITestSuite; 0021 } 0022 0023 class TestView : public QWidget 0024 { 0025 Q_OBJECT 0026 public: 0027 explicit TestView(TestViewPlugin* plugin, QWidget* parent = nullptr); 0028 ~TestView() override; 0029 0030 public Q_SLOTS: 0031 void runSelectedTests(); 0032 void showSource(); 0033 0034 void addTestSuite(KDevelop::ITestSuite* suite); 0035 void removeTestSuite(KDevelop::ITestSuite* suite); 0036 void updateTestSuite(KDevelop::ITestSuite* suite, const KDevelop::TestResult& result); 0037 void notifyTestCaseStarted(KDevelop::ITestSuite* suite, const QStringList& test_cases); 0038 QStandardItem* addProject(KDevelop::IProject* project); 0039 void removeProject(KDevelop::IProject* project); 0040 void doubleClicked(const QModelIndex& index); 0041 0042 QList<QAction*> contextMenuActions(); 0043 0044 private: 0045 void changeFilter(const QString &newFilter); 0046 0047 TestViewPlugin* m_plugin; 0048 QStandardItemModel* m_model; 0049 QTreeView* m_tree; 0050 QSortFilterProxyModel* m_filter; 0051 QList<QAction*> m_contextMenuActions; 0052 0053 QIcon iconForTestResult(KDevelop::TestResult::TestCaseResult result); 0054 QStandardItem* itemForSuite(KDevelop::ITestSuite* suite); 0055 QStandardItem* itemForProject(KDevelop::IProject* project); 0056 }; 0057 0058 #endif // KDEVPLATFORM_PLUGIN_TESTVIEW_H