diff options
author | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-02-14 22:00:05 +0100 |
---|---|---|
committer | Nicolas Werner <nicolas.werner@hotmail.de> | 2023-02-14 22:01:00 +0100 |
commit | 58f5ba502364014bc7a1d7736b69e73cb5660308 (patch) | |
tree | 1f14b47d60296f56f70b9e366825e324eb681583 /src/UserSettingsPage.cpp | |
parent | ac19c6c92b676f5544dc9094b26afec29768c056 (diff) |
Make scrollbars optional and disabled by default
Also add them to the communities sidebar
Diffstat (limited to 'src/UserSettingsPage.cpp')
-rw-r--r-- | src/UserSettingsPage.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index ec873e92..09e3282e 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -65,6 +65,8 @@ UserSettings::load(std::optional<QString> profile) hasAlertOnNotification_ = settings.value(QStringLiteral("user/alert_on_notification"), false).toBool(); groupView_ = settings.value(QStringLiteral("user/group_view"), true).toBool(); + scrollbarsInRoomlist_ = + settings.value(QStringLiteral("user/scrollbars_in_roomlist"), false).toBool(); buttonsInTimeline_ = settings.value(QStringLiteral("user/timeline/buttons"), true).toBool(); timelineMaxWidth_ = settings.value(QStringLiteral("user/timeline/max_width"), 0).toInt(); messageHoverHighlight_ = @@ -228,6 +230,17 @@ UserSettings::setGroupView(bool state) } void +UserSettings::setScrollbarsInRoomlist(bool state) +{ + if (scrollbarsInRoomlist_ == state) + return; + + scrollbarsInRoomlist_ = state; + emit scrollbarsInRoomlistChanged(state); + save(); +} + +void UserSettings::setHiddenTags(const QStringList &hiddenTags) { hiddenTags_ = hiddenTags; @@ -862,6 +875,7 @@ UserSettings::save() settings.setValue(QStringLiteral("minor_events"), sortByImportance_); settings.setValue(QStringLiteral("read_receipts"), readReceipts_); settings.setValue(QStringLiteral("group_view"), groupView_); + settings.setValue(QStringLiteral("scrollbars_in_roomlist"), scrollbarsInRoomlist_); settings.setValue(QStringLiteral("markdown_enabled"), markdown_); settings.setValue(QStringLiteral("invert_enter_key"), invertEnterKey_); settings.setValue(QStringLiteral("bubbles_enabled"), bubbles_); @@ -969,6 +983,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const return tr("Start in tray"); case GroupView: return tr("Communities sidebar"); + case ScrollbarsInRoomlist: + return tr("Scrollbars in room list"); case Markdown: return tr("Send messages as Markdown"); case InvertEnterKey: @@ -1111,6 +1127,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const return i->startInTray(); case GroupView: return i->groupView(); + case ScrollbarsInRoomlist: + return i->scrollbarsInRoomlist(); case Markdown: return i->markdown(); case InvertEnterKey: @@ -1255,6 +1273,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const return tr("Start the application in the background without showing the client window."); case GroupView: return tr("Show a column containing communities and tags next to the room list."); + case ScrollbarsInRoomlist: + return tr("Shows scrollbars in the room list and communities list."); case Markdown: return tr( "Allow using markdown in messages.\nWhen disabled, all messages are sent as a plain " @@ -1411,6 +1431,7 @@ UserSettingsModel::data(const QModelIndex &index, int role) const case Tray: case StartInTray: case GroupView: + case ScrollbarsInRoomlist: case Markdown: case InvertEnterKey: case Bubbles: @@ -1634,6 +1655,13 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int } else return false; } + case ScrollbarsInRoomlist: { + if (value.userType() == QMetaType::Bool) { + i->setScrollbarsInRoomlist(value.toBool()); + return true; + } else + return false; + } case Markdown: { if (value.userType() == QMetaType::Bool) { i->setMarkdown(value.toBool()); @@ -2090,6 +2118,9 @@ UserSettingsModel::UserSettingsModel(QObject *p) connect(s.get(), &UserSettings::groupViewStateChanged, this, [this]() { emit dataChanged(index(GroupView), index(GroupView), {Value}); }); + connect(s.get(), &UserSettings::scrollbarsInRoomlistChanged, this, [this]() { + emit dataChanged(index(ScrollbarsInRoomlist), index(ScrollbarsInRoomlist), {Value}); + }); connect(s.get(), &UserSettings::roomSortingChanged, this, [this]() { emit dataChanged(index(SortByImportance), index(SortByImportance), {Value}); }); |