#ifndef BSPLUGINLIST_PLUGINLISTVIEW_H #define BSPLUGINLIST_PLUGINLISTVIEW_H #include #include namespace BSPluginList { struct MarkerInfos { QSet overriding; QSet overridden; QSet overwritingAux; QSet overwrittenAux; QSet 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