From 4865f852d8b0069137db529fd40d63b9e19a133e Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Sat, 6 Oct 2018 18:43:53 +0300 Subject: [PATCH] Remove room re-ordering option --- src/ChatPage.cpp | 2 +- src/RoomList.cpp | 6 +----- src/RoomList.h | 5 +---- src/UserSettingsPage.cpp | 18 ------------------ src/UserSettingsPage.h | 9 --------- 5 files changed, 3 insertions(+), 37 deletions(-) diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp index 6a7e7d81..a1125d2a 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp @@ -89,7 +89,7 @@ ChatPage::ChatPage(QSharedPointer userSettings, QWidget *parent) connect(sidebarActions_, &SideBarActions::createRoom, this, &ChatPage::createRoom); user_info_widget_ = new UserInfoWidget(sideBar_); - room_list_ = new RoomList(userSettings_, sideBar_); + room_list_ = new RoomList(sideBar_); connect(room_list_, &RoomList::joinRoom, this, &ChatPage::joinRoom); sideBarLayout_->addWidget(user_info_widget_); diff --git a/src/RoomList.cpp b/src/RoomList.cpp index a262dc21..a2d28c13 100644 --- a/src/RoomList.cpp +++ b/src/RoomList.cpp @@ -30,9 +30,8 @@ #include "Utils.h" #include "ui/OverlayModal.h" -RoomList::RoomList(QSharedPointer userSettings, QWidget *parent) +RoomList::RoomList(QWidget *parent) : QWidget(parent) - , userSettings_{userSettings} { topLayout_ = new QVBoxLayout(this); topLayout_->setSpacing(0); @@ -293,9 +292,6 @@ RoomList::updateRoomDescription(const QString &roomid, const DescInfo &info) void RoomList::sortRoomsByLastMessage() { - if (!userSettings_->isOrderingEnabled()) - return; - isSortPending_ = false; std::multimap> times; diff --git a/src/RoomList.h b/src/RoomList.h index dc90d614..88e6d1ad 100644 --- a/src/RoomList.h +++ b/src/RoomList.h @@ -30,7 +30,6 @@ class LeaveRoomDialog; class OverlayModal; class RoomInfoListItem; class Sync; -class UserSettings; struct DescInfo; struct RoomInfo; @@ -39,7 +38,7 @@ class RoomList : public QWidget Q_OBJECT public: - RoomList(QSharedPointer userSettings, QWidget *parent = 0); + explicit RoomList(QWidget *parent = 0); void initialize(const QMap &info); void sync(const std::map &info); @@ -101,7 +100,5 @@ private: std::map> rooms_; QString selectedRoom_; - QSharedPointer userSettings_; - bool isSortPending_ = false; }; diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index 9c42f3c7..cd49e62b 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -45,7 +45,6 @@ UserSettings::load() isTrayEnabled_ = settings.value("user/window/tray", false).toBool(); hasDesktopNotifications_ = settings.value("user/desktop_notifications", true).toBool(); isStartInTrayEnabled_ = settings.value("user/window/start_in_tray", false).toBool(); - isOrderingEnabled_ = settings.value("user/room_ordering", true).toBool(); isGroupViewEnabled_ = settings.value("user/group_view", true).toBool(); isTypingNotificationsEnabled_ = settings.value("user/typing_notifications", true).toBool(); isReadReceiptsEnabled_ = settings.value("user/read_receipts", true).toBool(); @@ -102,7 +101,6 @@ UserSettings::save() settings.endGroup(); settings.setValue("font_size", baseFontSize_); - settings.setValue("room_ordering", isOrderingEnabled_); settings.setValue("typing_notifications", isTypingNotificationsEnabled_); settings.setValue("read_receipts", isReadReceiptsEnabled_); settings.setValue("group_view", isGroupViewEnabled_); @@ -164,15 +162,6 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge startInTrayOptionLayout_->addWidget(startInTrayLabel); startInTrayOptionLayout_->addWidget(startInTrayToggle_, 0, Qt::AlignRight); - auto orderRoomLayout = new QHBoxLayout; - orderRoomLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin); - auto orderLabel = new QLabel(tr("Re-order rooms based on activity"), this); - orderLabel->setFont(font); - roomOrderToggle_ = new Toggle(this); - - orderRoomLayout->addWidget(orderLabel); - orderRoomLayout->addWidget(roomOrderToggle_, 0, Qt::AlignRight); - auto groupViewLayout = new QHBoxLayout; groupViewLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin); auto groupViewLabel = new QLabel(tr("Group's sidebar"), this); @@ -320,8 +309,6 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge mainLayout_->addLayout(trayOptionLayout_); mainLayout_->addLayout(startInTrayOptionLayout_); mainLayout_->addWidget(new HorizontalLine(this)); - mainLayout_->addLayout(orderRoomLayout); - mainLayout_->addWidget(new HorizontalLine(this)); mainLayout_->addLayout(groupViewLayout); mainLayout_->addWidget(new HorizontalLine(this)); mainLayout_->addLayout(typingLayout); @@ -388,10 +375,6 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge settings_->setStartInTray(!isDisabled); }); - connect(roomOrderToggle_, &Toggle::toggled, this, [this](bool isDisabled) { - settings_->setRoomOrdering(!isDisabled); - }); - connect(groupViewToggle_, &Toggle::toggled, this, [this](bool isDisabled) { settings_->setGroupView(!isDisabled); }); @@ -425,7 +408,6 @@ UserSettingsPage::showEvent(QShowEvent *) // FIXME: Toggle treats true as "off" trayToggle_->setState(!settings_->isTrayEnabled()); startInTrayToggle_->setState(!settings_->isStartInTrayEnabled()); - roomOrderToggle_->setState(!settings_->isOrderingEnabled()); groupViewToggle_->setState(!settings_->isGroupViewEnabled()); typingNotifications_->setState(!settings_->isTypingNotificationsEnabled()); readReceipts_->setState(!settings_->isReadReceiptsEnabled()); diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h index d099a121..373126ae 100644 --- a/src/UserSettingsPage.h +++ b/src/UserSettingsPage.h @@ -55,12 +55,6 @@ public: void setFontSize(double size); - void setRoomOrdering(bool state) - { - isOrderingEnabled_ = state; - save(); - } - void setGroupView(bool state) { if (isGroupViewEnabled_ != state) @@ -91,7 +85,6 @@ public: QString theme() const { return !theme_.isEmpty() ? theme_ : "light"; } bool isTrayEnabled() const { return isTrayEnabled_; } bool isStartInTrayEnabled() const { return isStartInTrayEnabled_; } - bool isOrderingEnabled() const { return isOrderingEnabled_; } bool isGroupViewEnabled() const { return isGroupViewEnabled_; } bool isTypingNotificationsEnabled() const { return isTypingNotificationsEnabled_; } bool isReadReceiptsEnabled() const { return isReadReceiptsEnabled_; } @@ -105,7 +98,6 @@ private: QString theme_; bool isTrayEnabled_; bool isStartInTrayEnabled_; - bool isOrderingEnabled_; bool isGroupViewEnabled_; bool isTypingNotificationsEnabled_; bool isReadReceiptsEnabled_; @@ -152,7 +144,6 @@ private: Toggle *trayToggle_; Toggle *startInTrayToggle_; - Toggle *roomOrderToggle_; Toggle *groupViewToggle_; Toggle *typingNotifications_; Toggle *readReceipts_;