aboutsummaryrefslogtreecommitdiff
path: root/libs/installer_bsplugins/src/BSPluginList/PluginListView.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/installer_bsplugins/src/BSPluginList/PluginListView.h')
-rw-r--r--libs/installer_bsplugins/src/BSPluginList/PluginListView.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/libs/installer_bsplugins/src/BSPluginList/PluginListView.h b/libs/installer_bsplugins/src/BSPluginList/PluginListView.h
new file mode 100644
index 0000000..5302b86
--- /dev/null
+++ b/libs/installer_bsplugins/src/BSPluginList/PluginListView.h
@@ -0,0 +1,76 @@
+#ifndef BSPLUGINLIST_PLUGINLISTVIEW_H
+#define BSPLUGINLIST_PLUGINLISTVIEW_H
+
+#include <QSet>
+#include <QTreeView>
+
+namespace BSPluginList
+{
+
+struct MarkerInfos
+{
+ QSet<uint> overriding;
+ QSet<uint> overridden;
+ QSet<uint> overwritingAux;
+ QSet<uint> overwrittenAux;
+ QSet<uint> highlight;
+};
+
+class PluginListModel;
+class PluginSortFilterProxyModel;
+
+class PluginListView final : public QTreeView
+{
+ Q_OBJECT
+
+public:
+ explicit PluginListView(QWidget* parent = nullptr);
+
+ void setup();
+
+ void setModel(QAbstractItemModel* model) override;
+ QRect visualRect(const QModelIndex& index) const override;
+
+ [[nodiscard]] QColor markerColor(const QModelIndex& index) const;
+ [[nodiscard]] uint fileFlags(const QModelIndex& index) const;
+ [[nodiscard]] uint conflictFlags(const QModelIndex& index) const;
+
+public slots:
+ void setHighlightedOrigins(const QStringList& origins);
+ void clearOverwriteMarkers();
+ void updateOverwriteMarkers();
+
+signals:
+ void openOriginExplorer(const QModelIndex& index);
+
+protected:
+ bool event(QEvent* event) override;
+ void dragMoveEvent(QDragMoveEvent* event) override;
+ void paintEvent(QPaintEvent* event) override;
+
+ bool moveSelection(int key);
+ bool toggleSelectionState();
+
+private:
+ friend class PluginListContextMenu;
+
+ QModelIndex indexViewToModel(const QModelIndex& index,
+ const QAbstractItemModel* model) const;
+
+ QModelIndexList indexViewToModel(const QModelIndexList& indices,
+ const QAbstractItemModel* model,
+ bool includeChildren = true) const;
+
+private slots:
+ void onGroupRenameRequested(const QModelIndex& index, const QString& name);
+
+private:
+ bool m_FirstPaint = true;
+ MarkerInfos m_Markers;
+ PluginListModel* m_PluginModel;
+ PluginSortFilterProxyModel* m_SortProxy;
+};
+
+} // namespace BSPluginList
+
+#endif // BSPLUGINLIST_PLUGINLISTVIEW_H