diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-01 14:32:40 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-02 15:38:19 +0100 |
| commit | 3bb189a42724ad028402ee8d4418703350ff1a2c (patch) | |
| tree | 46121f332b03b10110b7b72a641c154165109ca5 /src | |
| parent | 3560093f1b37fcf2386e81aaac2fa78005a173ad (diff) | |
Add method to retrieve the grouping mode.
Diffstat (limited to 'src')
| -rw-r--r-- | src/modlistview.cpp | 21 | ||||
| -rw-r--r-- | src/modlistview.h | 14 |
2 files changed, 34 insertions, 1 deletions
diff --git a/src/modlistview.cpp b/src/modlistview.cpp index f6a564ac..9f94354e 100644 --- a/src/modlistview.cpp +++ b/src/modlistview.cpp @@ -103,7 +103,7 @@ void ModListView::setProfile(Profile* profile) bool ModListView::hasCollapsibleSeparators() const
{
- return m_sortProxy != nullptr && m_sortProxy->sourceModel() == m_byPriorityProxy;
+ return groupByMode() == GroupByMode::SEPARATOR;
}
int ModListView::sortColumn() const
@@ -111,6 +111,25 @@ int ModListView::sortColumn() const return m_sortProxy ? m_sortProxy->sortColumn() : -1;
}
+ModListView::GroupByMode ModListView::groupByMode() const
+{
+ if (m_sortProxy == nullptr) {
+ return GroupByMode::NONE;
+ }
+ else if (m_sortProxy->sourceModel() == m_byPriorityProxy) {
+ return GroupByMode::SEPARATOR;
+ }
+ else if (m_sortProxy->sourceModel() == m_byCategoryProxy) {
+ return GroupByMode::CATEGORY;
+ }
+ else if (m_sortProxy->sourceModel() == m_byNexusIdProxy) {
+ return GroupByMode::NEXUS_ID;
+ }
+ else {
+ return GroupByMode::NONE;
+ }
+}
+
ModListViewActions& ModListView::actions() const
{
return *m_actions;
diff --git a/src/modlistview.h b/src/modlistview.h index dac96822..84e55e2b 100644 --- a/src/modlistview.h +++ b/src/modlistview.h @@ -36,6 +36,14 @@ public: OnViewport = DropIndicatorPosition::OnViewport
};
+ // indiucate the groupby mode
+ enum class GroupByMode {
+ NONE,
+ SEPARATOR,
+ CATEGORY,
+ NEXUS_ID
+ };
+
public:
explicit ModListView(QWidget* parent = 0);
@@ -58,6 +66,10 @@ public: //
int sortColumn() const;
+ // the current group mode
+ //
+ GroupByMode groupByMode() const;
+
// retrieve the actions from the view
//
ModListViewActions& actions() const;
@@ -173,6 +185,8 @@ private: //
void updateGroupByProxy(int groupIndex);
+ // index in the groupby combo
+ //
enum GroupBy {
NONE = 0,
CATEGORY = 1,
|
