summary refs log tree commit diff
path: root/src/timeline/CommunitiesModel.h
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-12-01 00:46:02 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-12-01 00:46:02 +0100
commitaa5d2098d02076f3268d9cba27e6d27f822b975c (patch)
tree760640a2ed8464da2ed669af5a9b24d5bc81ff5c /src/timeline/CommunitiesModel.h
parentDon't pad, just fill (diff)
downloadnheko-aa5d2098d02076f3268d9cba27e6d27f822b975c.tar.xz
Don't waste space for non existing subspaces
Diffstat (limited to 'src/timeline/CommunitiesModel.h')
-rw-r--r--src/timeline/CommunitiesModel.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/timeline/CommunitiesModel.h b/src/timeline/CommunitiesModel.h
index 21d24829..5191b239 100644
--- a/src/timeline/CommunitiesModel.h
+++ b/src/timeline/CommunitiesModel.h
@@ -33,6 +33,7 @@ class CommunitiesModel : public QAbstractListModel
                  currentTagIdChanged RESET resetCurrentTagId)
     Q_PROPERTY(QStringList tags READ tags NOTIFY tagsChanged)
     Q_PROPERTY(QStringList tagsWithDefault READ tagsWithDefault NOTIFY tagsChanged)
+    Q_PROPERTY(bool containsSubspaces READ containsSubspaces NOTIFY containsSubspacesChanged)
 
 public:
     enum Roles
@@ -103,6 +104,14 @@ public:
     QVariant data(const QModelIndex &index, int role) const override;
     bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
 
+    bool containsSubspaces() const
+    {
+        for (const auto &e : spaceOrder_.tree)
+            if (e.depth > 0)
+                return true;
+        return false;
+    }
+
 public slots:
     void initializeSidebar();
     void sync(const mtx::responses::Sync &sync_);
@@ -131,6 +140,7 @@ signals:
     void currentTagIdChanged(QString tagId);
     void hiddenTagsChanged();
     void tagsChanged();
+    void containsSubspacesChanged();
 
 private:
     QStringList tags_;