-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpluginview.h
59 lines (42 loc) · 1.49 KB
/
pluginview.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include "extensionsystem_global.h"
#include <gui/treemodel.h>
#include <QWidget>
#include <unordered_map>
namespace GUI {
class CategorySortFilterModel;
class TreeView;
} // namespace GUI
namespace ExtensionSystem {
class PluginSpec;
namespace Internal {
class CollectionItem;
class PluginItem;
} // Internal
class EXTENSIONSYSTEM_EXPORT PluginView : public QWidget
{
Q_OBJECT
public:
explicit PluginView(QWidget *parent = nullptr);
~PluginView() override;
[[nodiscard]] auto currentPlugin() const -> PluginSpec *;
void setFilter(const QString &filter);
void cancelChanges();
signals:
void currentPluginChanged(ExtensionSystem::PluginSpec *spec);
void pluginActivated(ExtensionSystem::PluginSpec *spec);
void pluginSettingsChanged(ExtensionSystem::PluginSpec *spec);
private:
[[nodiscard]] auto pluginForIndex(const QModelIndex &index) const -> PluginSpec *;
void updatePlugins();
auto setPluginsEnabled(const QSet<PluginSpec *> &plugins, bool enable) -> bool;
GUI::TreeView *m_categoryView;
GUI::TreeModel<GUI::TreeItem, Internal::CollectionItem, Internal::PluginItem> *m_model;
GUI::CategorySortFilterModel *m_sortModel;
std::unordered_map<PluginSpec *, bool> m_affectedPlugins;
friend class Internal::CollectionItem;
friend class Internal::PluginItem;
};
} // namespae ExtensionSystem