From a19ede5b6faaf8bf5299ae02da92e8d604e39468 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Thu, 31 Dec 2020 13:25:42 +0100 Subject: Move filter list to ModListView. --- src/modlistview.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/modlistview.h') diff --git a/src/modlistview.h b/src/modlistview.h index c7f4e5f0..87d8eac5 100644 --- a/src/modlistview.h +++ b/src/modlistview.h @@ -3,6 +3,7 @@ #include +#include #include #include #include @@ -39,7 +40,12 @@ public: explicit ModListView(QWidget* parent = 0); void setModel(QAbstractItemModel* model) override; - void setup(OrganizerCore& core, CategoryFactory& factory, FilterList& filters, MainWindow* mw, Ui::MainWindow* mwui); + void setup(OrganizerCore& core, CategoryFactory& factory, MainWindow* mw, Ui::MainWindow* mwui); + + // restore/save the state between session + // + void restoreState(const Settings& s); + void saveState(Settings& s) const; // set the current profile // @@ -97,6 +103,10 @@ public slots: // void updateModCount(); + // refresh the filters + // + void refreshFilters(); + // map from/to the view indexes to the model // QModelIndex indexModelToView(const QModelIndex& index) const; @@ -142,6 +152,7 @@ protected slots: void onCustomContextMenuRequested(const QPoint& pos); void onDoubleClicked(const QModelIndex& index); void onSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected); + void onFiltersCriteria(const std::vector& filters); private: @@ -149,6 +160,12 @@ private: void onModInstalled(const QString& modName); void onModFilterActive(bool filterActive); + // get/set the selected items on the view, this method return/take indices + // from the mod list model, not the view, so it's safe to restore + // + std::pair selected() const; + void setSelected(const QModelIndex& current, const QModelIndexList& selected); + // call expand() after fixing the index if it comes from the source // of the proxy // @@ -175,12 +192,14 @@ private: // the mod counter QLCDNumber* counter; - // the text filter and clear filter button + // filters related QLineEdit* filter; + QLabel* currentCategory; QPushButton* clearFilters; }; OrganizerCore* m_core; + std::unique_ptr m_filters; CategoryFactory* m_categories; ModListViewUi ui; ModListViewActions* m_actions; -- cgit v1.3.1