From ab820c1b0a5bb0f002ec5aba7954330acbdeb978 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Sun, 24 Jan 2021 11:09:12 +0100 Subject: Fix enable/disable all message. --- src/modlistview.h | 113 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 68 insertions(+), 45 deletions(-) (limited to 'src/modlistview.h') diff --git a/src/modlistview.h b/src/modlistview.h index adffd737..408bc900 100644 --- a/src/modlistview.h +++ b/src/modlistview.h @@ -131,9 +131,6 @@ public slots: protected: - friend class ModListContextMenu; - friend class ModListViewActions; - // map from/to the view indexes to the model // QModelIndex indexModelToView(const QModelIndex& index) const; @@ -183,14 +180,74 @@ protected slots: void commitData(QWidget* editor) override; -private: +private: // friend classes friend class ModConflictIconDelegate; - friend class ModFlagIconDelegate; friend class ModContentIconDelegate; + friend class ModFlagIconDelegate; + friend class ModListContextMenu; friend class ModListStyledItemDelegate; + friend class ModListViewActions; friend class ModListViewMarkingScrollBar; +private: // private structures + + struct ModListViewUi { + // the group by combo box + QComboBox* groupBy; + + // the mod counter + QLCDNumber* counter; + + // filters related + QLineEdit* filter; + QLabel* currentCategory; + QPushButton* clearFilters; + QComboBox* filterSeparators; + + // the plugin list (for highligths) + PluginListView* pluginList; + }; + + struct MarkerInfos { + // conflicts + std::set overwrite; + std::set overwritten; + std::set archiveOverwrite; + std::set archiveOverwritten; + std::set archiveLooseOverwrite; + std::set archiveLooseOverwritten; + + // selected plugins + std::set highlight; + }; + + struct ModCounters { + int active = 0; + int backup = 0; + int foreign = 0; + int separator = 0; + int regular = 0; + + struct { + int active = 0; + int backup = 0; + int foreign = 0; + int separator = 0; + int regular = 0; + } visible; + }; + + // index in the groupby combo + // + enum GroupBy { + NONE = 0, + CATEGORY = 1, + NEXUS_ID = 2 + }; + +private: // private functions + void onModPrioritiesChanged(const QModelIndexList& indices); void onModInstalled(const QString& modName); void onModFilterActive(bool filterActive); @@ -229,6 +286,10 @@ private: QList contentsIcons(const QModelIndex& index, bool* forceCompact = nullptr) const; QString contentsTooltip(const QModelIndex& index) const; + // compute the counters for mods according to the current filter + // + ModCounters counters() const; + // 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 // @@ -244,33 +305,7 @@ private: // void updateGroupByProxy(); - // index in the groupby combo - // - enum GroupBy { - NONE = 0, - CATEGORY = 1, - NEXUS_ID = 2 - }; - -private: - - struct ModListViewUi - { - // the group by combo box - QComboBox* groupBy; - - // the mod counter - QLCDNumber* counter; - - // filters related - QLineEdit* filter; - QLabel* currentCategory; - QPushButton* clearFilters; - QComboBox* filterSeparators; - - // the plugin list (for highligths) - PluginListView* pluginList; - }; +public: // member variables OrganizerCore* m_core; std::unique_ptr m_filters; @@ -291,19 +326,7 @@ private: // losing them on model reset std::map> m_collapsed; - struct MarkerInfos { - // conflicts - std::set overwrite; - std::set overwritten; - std::set archiveOverwrite; - std::set archiveOverwritten; - std::set archiveLooseOverwrite; - std::set archiveLooseOverwritten; - - // selected plugins - std::set highlight; - } m_markers; - + MarkerInfos m_markers; ViewMarkingScrollBar* m_scrollbar; bool m_inDragMoveEvent = false; -- cgit v1.3.1