diff --git a/resources/icons/ui/user-friends-solid.svg b/resources/icons/ui/user-friends-solid.svg new file mode 100644 index 00000000..1add45ec --- /dev/null +++ b/resources/icons/ui/user-friends-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/resources/qml/ChatPage.qml b/resources/qml/ChatPage.qml index 85ae81e8..1e03ef11 100644 --- a/resources/qml/ChatPage.qml +++ b/resources/qml/ChatPage.qml @@ -25,7 +25,7 @@ Rectangle { minimumWidth: communitiesList.avatarSize * 4 + Nheko.paddingMedium * 2 collapsedWidth: communitiesList.avatarSize + 2 * Nheko.paddingMedium - preferredWidth: collapsedWidth + preferredWidth: Settings.communityListWidth >= minimumWidth ? Settings.communityListWidth : collapsedWidth maximumWidth: communitiesList.avatarSize * 10 + 2 * Nheko.paddingMedium CommunitiesList { @@ -34,14 +34,22 @@ Rectangle { collapsed: parent.collapsed } + Binding { + target: Settings + property: 'communityListWidth' + value: communityListC.preferredWidth + when: !adaptiveView.singlePageMode + delayed: true + } + } AdaptiveLayoutElement { id: roomListC - minimumWidth: Nheko.avatarSize * 5 + Nheko.paddingSmall * 2 - preferredWidth: Nheko.avatarSize * 5 + Nheko.paddingSmall * 2 - maximumWidth: Nheko.avatarSize * 10 + Nheko.paddingSmall * 2 + minimumWidth: roomlist.avatarSize * 4 + Nheko.paddingSmall * 2 + preferredWidth: Settings.roomListWidth >= minimumWidth ? Settings.roomListWidth : roomlist.avatarSize * 5 + Nheko.paddingSmall * 2 + maximumWidth: roomlist.avatarSize * 10 + Nheko.paddingSmall * 2 collapsedWidth: roomlist.avatarSize + 2 * Nheko.paddingMedium RoomList { @@ -50,6 +58,14 @@ Rectangle { collapsed: parent.collapsed } + Binding { + target: Settings + property: 'roomListWidth' + value: roomListC.preferredWidth + when: !adaptiveView.singlePageMode + delayed: true + } + } AdaptiveLayoutElement { diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index 99560678..9b906555 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -64,10 +64,14 @@ void UserSettings::load(std::optional profile) { QSettings settings; - tray_ = settings.value("user/window/tray", false).toBool(); + tray_ = settings.value("user/window/tray", false).toBool(); + startInTray_ = settings.value("user/window/start_in_tray", false).toBool(); + + roomListWidth_ = settings.value("user/sidebar/room_list_width", -1).toInt(); + communityListWidth_ = settings.value("user/sidebar/community_list_width", -1).toInt(); + hasDesktopNotifications_ = settings.value("user/desktop_notifications", true).toBool(); hasAlertOnNotification_ = settings.value("user/alert_on_notification", false).toBool(); - startInTray_ = settings.value("user/window/start_in_tray", false).toBool(); groupView_ = settings.value("user/group_view", true).toBool(); hiddenTags_ = settings.value("user/hidden_tags", QStringList{}).toStringList(); buttonsInTimeline_ = settings.value("user/timeline/buttons", true).toBool(); @@ -248,6 +252,24 @@ UserSettings::setTimelineMaxWidth(int state) emit timelineMaxWidthChanged(state); save(); } +void +UserSettings::setCommunityListWidth(int state) +{ + if (state == communityListWidth_) + return; + communityListWidth_ = state; + emit communityListWidthChanged(state); + save(); +} +void +UserSettings::setRoomListWidth(int state) +{ + if (state == roomListWidth_) + return; + roomListWidth_ = state; + emit roomListWidthChanged(state); + save(); +} void UserSettings::setDesktopNotifications(bool state) @@ -571,6 +593,11 @@ UserSettings::save() settings.setValue("start_in_tray", startInTray_); settings.endGroup(); // window + settings.beginGroup("sidebar"); + settings.setValue("community_list_width", communityListWidth_); + settings.setValue("room_list_width", roomListWidth_); + settings.endGroup(); // window + settings.beginGroup("timeline"); settings.setValue("buttons", buttonsInTimeline_); settings.setValue("message_hover_highlight", messageHoverHighlight_); diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h index 3ad0293b..acb08569 100644 --- a/src/UserSettingsPage.h +++ b/src/UserSettingsPage.h @@ -61,6 +61,10 @@ class UserSettings : public QObject NOTIFY privacyScreenTimeoutChanged) Q_PROPERTY(int timelineMaxWidth READ timelineMaxWidth WRITE setTimelineMaxWidth NOTIFY timelineMaxWidthChanged) + Q_PROPERTY( + int roomListWidth READ roomListWidth WRITE setRoomListWidth NOTIFY roomListWidthChanged) + Q_PROPERTY(int communityListWidth READ communityListWidth WRITE setCommunityListWidth NOTIFY + communityListWidthChanged) Q_PROPERTY(bool mobileMode READ mobileMode WRITE setMobileMode NOTIFY mobileModeChanged) Q_PROPERTY(double fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged) Q_PROPERTY(QString font READ font WRITE setFontFamily NOTIFY fontChanged) @@ -129,6 +133,8 @@ public: void setSortByImportance(bool state); void setButtonsInTimeline(bool state); void setTimelineMaxWidth(int state); + void setCommunityListWidth(int state); + void setRoomListWidth(int state); void setDesktopNotifications(bool state); void setAlertOnNotification(bool state); void setAvatarCircles(bool state); @@ -178,6 +184,8 @@ public: return hasDesktopNotifications() || hasAlertOnNotification(); } int timelineMaxWidth() const { return timelineMaxWidth_; } + int communityListWidth() const { return communityListWidth_; } + int roomListWidth() const { return roomListWidth_; } double fontSize() const { return baseFontSize_; } QString font() const { return font_; } QString emojiFont() const @@ -227,6 +235,8 @@ signals: void privacyScreenChanged(bool state); void privacyScreenTimeoutChanged(int state); void timelineMaxWidthChanged(int state); + void roomListWidthChanged(int state); + void communityListWidthChanged(int state); void mobileModeChanged(bool mode); void fontSizeChanged(double state); void fontChanged(QString state); @@ -276,6 +286,8 @@ private: bool shareKeysWithTrustedUsers_; bool mobileMode_; int timelineMaxWidth_; + int roomListWidth_; + int communityListWidth_; double baseFontSize_; QString font_; QString emojiFont_;