blob: 7a41becf0e6f9ea993b19b8a70a8e506fcb155e9 (
plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#pragma once
#include <utils/theme/theme.h>
#include <QStandardItemModel>
#include <QWidget>
QT_BEGIN_NAMESPACE
class QItemSelectionModel;
class QListView;
class QSortFilterProxyModel;
QT_END_NAMESPACE
namespace ExtensionSystem
{
class PluginSpec;
}
namespace Core {
class SearchBox;
class WelcomePageButton;
}
namespace ExtensionManager::Internal {
using PluginSpecList = QList<const ExtensionSystem::PluginSpec *>;
using Tags = QStringList;
enum ItemType {
ItemTypePack,
ItemTypeExtension,
};
struct ItemData {
const QString name;
const ItemType type = ItemTypeExtension;
const Tags tags;
const PluginSpecList plugins;
};
ItemData itemData(const QModelIndex &index);
void setBackgroundColor(QWidget *widget, Utils::Theme::Color colorRole);
class ExtensionsBrowser final : public QWidget
{
Q_OBJECT
public:
ExtensionsBrowser();
void adjustToWidth(const int width);
QSize sizeHint() const override;
signals:
void itemSelected(const QModelIndex ¤t, const QModelIndex &previous);
private:
int extraListViewWidth() const; // Space for scrollbar, etc.
QScopedPointer<QStandardItemModel> m_model;
Core::SearchBox *m_searchBox;
Core::WelcomePageButton *m_updateButton;
QListView *m_extensionsView;
QItemSelectionModel *m_selectionModel = nullptr;
QSortFilterProxyModel *m_filterProxyModel;
int m_columnsCount = 2;
};
} // ExtensionManager::Internal
|