Make group's sidebar visible through an option
2 files changed, 20 insertions, 1 deletions
diff --git a/include/ChatPage.h b/include/ChatPage.h
index 754ee0f4..01fb4c50 100644
--- a/include/ChatPage.h
+++ b/include/ChatPage.h
@@ -119,6 +119,8 @@ private:
void loadStateFromCache();
void deleteConfigs();
void resetUI();
+ //! Decides whether or not to hide the group's sidebar.
+ void setGroupViewState(bool isEnabled);
template<class Collection>
Memberships getMemberships(const std::vector<Collection> &events) const;
diff --git a/include/UserSettingsPage.h b/include/UserSettingsPage.h
index adaa3956..6c825a83 100644
--- a/include/UserSettingsPage.h
+++ b/include/UserSettingsPage.h
@@ -29,8 +29,10 @@ constexpr int OptionMargin = 6;
constexpr int LayoutTopMargin = 50;
constexpr int LayoutBottomMargin = LayoutTopMargin;
-class UserSettings
+class UserSettings : public QObject
{
+ Q_OBJECT
+
public:
UserSettings();
@@ -50,14 +52,28 @@ public:
save();
};
+ void setGroupView(bool state)
+ {
+ if (isGroupViewEnabled_ != state)
+ emit groupViewStateChanged(state);
+
+ isGroupViewEnabled_ = state;
+ save();
+ };
+
QString theme() const { return !theme_.isEmpty() ? theme_ : "light"; }
bool isTrayEnabled() const { return isTrayEnabled_; }
bool isOrderingEnabled() const { return isOrderingEnabled_; }
+ bool isGroupViewEnabled() const { return isGroupViewEnabled_; }
+
+signals:
+ void groupViewStateChanged(bool state);
private:
QString theme_;
bool isTrayEnabled_;
bool isOrderingEnabled_;
+ bool isGroupViewEnabled_;
};
class HorizontalLine : public QFrame
@@ -97,6 +113,7 @@ private:
Toggle *trayToggle_;
Toggle *roomOrderToggle_;
+ Toggle *groupViewToggle_;
QComboBox *themeCombo_;
|