mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Remove room re-ordering option
This commit is contained in:
parent
3fdfc9b69f
commit
4865f852d8
5 changed files with 3 additions and 37 deletions
|
@ -89,7 +89,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
|
||||||
connect(sidebarActions_, &SideBarActions::createRoom, this, &ChatPage::createRoom);
|
connect(sidebarActions_, &SideBarActions::createRoom, this, &ChatPage::createRoom);
|
||||||
|
|
||||||
user_info_widget_ = new UserInfoWidget(sideBar_);
|
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);
|
connect(room_list_, &RoomList::joinRoom, this, &ChatPage::joinRoom);
|
||||||
|
|
||||||
sideBarLayout_->addWidget(user_info_widget_);
|
sideBarLayout_->addWidget(user_info_widget_);
|
||||||
|
|
|
@ -30,9 +30,8 @@
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "ui/OverlayModal.h"
|
#include "ui/OverlayModal.h"
|
||||||
|
|
||||||
RoomList::RoomList(QSharedPointer<UserSettings> userSettings, QWidget *parent)
|
RoomList::RoomList(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, userSettings_{userSettings}
|
|
||||||
{
|
{
|
||||||
topLayout_ = new QVBoxLayout(this);
|
topLayout_ = new QVBoxLayout(this);
|
||||||
topLayout_->setSpacing(0);
|
topLayout_->setSpacing(0);
|
||||||
|
@ -293,9 +292,6 @@ RoomList::updateRoomDescription(const QString &roomid, const DescInfo &info)
|
||||||
void
|
void
|
||||||
RoomList::sortRoomsByLastMessage()
|
RoomList::sortRoomsByLastMessage()
|
||||||
{
|
{
|
||||||
if (!userSettings_->isOrderingEnabled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
isSortPending_ = false;
|
isSortPending_ = false;
|
||||||
|
|
||||||
std::multimap<uint64_t, RoomInfoListItem *, std::greater<uint64_t>> times;
|
std::multimap<uint64_t, RoomInfoListItem *, std::greater<uint64_t>> times;
|
||||||
|
|
|
@ -30,7 +30,6 @@ class LeaveRoomDialog;
|
||||||
class OverlayModal;
|
class OverlayModal;
|
||||||
class RoomInfoListItem;
|
class RoomInfoListItem;
|
||||||
class Sync;
|
class Sync;
|
||||||
class UserSettings;
|
|
||||||
struct DescInfo;
|
struct DescInfo;
|
||||||
struct RoomInfo;
|
struct RoomInfo;
|
||||||
|
|
||||||
|
@ -39,7 +38,7 @@ class RoomList : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RoomList(QSharedPointer<UserSettings> userSettings, QWidget *parent = 0);
|
explicit RoomList(QWidget *parent = 0);
|
||||||
|
|
||||||
void initialize(const QMap<QString, RoomInfo> &info);
|
void initialize(const QMap<QString, RoomInfo> &info);
|
||||||
void sync(const std::map<QString, RoomInfo> &info);
|
void sync(const std::map<QString, RoomInfo> &info);
|
||||||
|
@ -101,7 +100,5 @@ private:
|
||||||
std::map<QString, QSharedPointer<RoomInfoListItem>> rooms_;
|
std::map<QString, QSharedPointer<RoomInfoListItem>> rooms_;
|
||||||
QString selectedRoom_;
|
QString selectedRoom_;
|
||||||
|
|
||||||
QSharedPointer<UserSettings> userSettings_;
|
|
||||||
|
|
||||||
bool isSortPending_ = false;
|
bool isSortPending_ = false;
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,7 +45,6 @@ UserSettings::load()
|
||||||
isTrayEnabled_ = settings.value("user/window/tray", false).toBool();
|
isTrayEnabled_ = settings.value("user/window/tray", false).toBool();
|
||||||
hasDesktopNotifications_ = settings.value("user/desktop_notifications", true).toBool();
|
hasDesktopNotifications_ = settings.value("user/desktop_notifications", true).toBool();
|
||||||
isStartInTrayEnabled_ = settings.value("user/window/start_in_tray", false).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();
|
isGroupViewEnabled_ = settings.value("user/group_view", true).toBool();
|
||||||
isTypingNotificationsEnabled_ = settings.value("user/typing_notifications", true).toBool();
|
isTypingNotificationsEnabled_ = settings.value("user/typing_notifications", true).toBool();
|
||||||
isReadReceiptsEnabled_ = settings.value("user/read_receipts", true).toBool();
|
isReadReceiptsEnabled_ = settings.value("user/read_receipts", true).toBool();
|
||||||
|
@ -102,7 +101,6 @@ UserSettings::save()
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.setValue("font_size", baseFontSize_);
|
settings.setValue("font_size", baseFontSize_);
|
||||||
settings.setValue("room_ordering", isOrderingEnabled_);
|
|
||||||
settings.setValue("typing_notifications", isTypingNotificationsEnabled_);
|
settings.setValue("typing_notifications", isTypingNotificationsEnabled_);
|
||||||
settings.setValue("read_receipts", isReadReceiptsEnabled_);
|
settings.setValue("read_receipts", isReadReceiptsEnabled_);
|
||||||
settings.setValue("group_view", isGroupViewEnabled_);
|
settings.setValue("group_view", isGroupViewEnabled_);
|
||||||
|
@ -164,15 +162,6 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
startInTrayOptionLayout_->addWidget(startInTrayLabel);
|
startInTrayOptionLayout_->addWidget(startInTrayLabel);
|
||||||
startInTrayOptionLayout_->addWidget(startInTrayToggle_, 0, Qt::AlignRight);
|
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;
|
auto groupViewLayout = new QHBoxLayout;
|
||||||
groupViewLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
groupViewLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin);
|
||||||
auto groupViewLabel = new QLabel(tr("Group's sidebar"), this);
|
auto groupViewLabel = new QLabel(tr("Group's sidebar"), this);
|
||||||
|
@ -320,8 +309,6 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
mainLayout_->addLayout(trayOptionLayout_);
|
mainLayout_->addLayout(trayOptionLayout_);
|
||||||
mainLayout_->addLayout(startInTrayOptionLayout_);
|
mainLayout_->addLayout(startInTrayOptionLayout_);
|
||||||
mainLayout_->addWidget(new HorizontalLine(this));
|
mainLayout_->addWidget(new HorizontalLine(this));
|
||||||
mainLayout_->addLayout(orderRoomLayout);
|
|
||||||
mainLayout_->addWidget(new HorizontalLine(this));
|
|
||||||
mainLayout_->addLayout(groupViewLayout);
|
mainLayout_->addLayout(groupViewLayout);
|
||||||
mainLayout_->addWidget(new HorizontalLine(this));
|
mainLayout_->addWidget(new HorizontalLine(this));
|
||||||
mainLayout_->addLayout(typingLayout);
|
mainLayout_->addLayout(typingLayout);
|
||||||
|
@ -388,10 +375,6 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
settings_->setStartInTray(!isDisabled);
|
settings_->setStartInTray(!isDisabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(roomOrderToggle_, &Toggle::toggled, this, [this](bool isDisabled) {
|
|
||||||
settings_->setRoomOrdering(!isDisabled);
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(groupViewToggle_, &Toggle::toggled, this, [this](bool isDisabled) {
|
connect(groupViewToggle_, &Toggle::toggled, this, [this](bool isDisabled) {
|
||||||
settings_->setGroupView(!isDisabled);
|
settings_->setGroupView(!isDisabled);
|
||||||
});
|
});
|
||||||
|
@ -425,7 +408,6 @@ UserSettingsPage::showEvent(QShowEvent *)
|
||||||
// FIXME: Toggle treats true as "off"
|
// FIXME: Toggle treats true as "off"
|
||||||
trayToggle_->setState(!settings_->isTrayEnabled());
|
trayToggle_->setState(!settings_->isTrayEnabled());
|
||||||
startInTrayToggle_->setState(!settings_->isStartInTrayEnabled());
|
startInTrayToggle_->setState(!settings_->isStartInTrayEnabled());
|
||||||
roomOrderToggle_->setState(!settings_->isOrderingEnabled());
|
|
||||||
groupViewToggle_->setState(!settings_->isGroupViewEnabled());
|
groupViewToggle_->setState(!settings_->isGroupViewEnabled());
|
||||||
typingNotifications_->setState(!settings_->isTypingNotificationsEnabled());
|
typingNotifications_->setState(!settings_->isTypingNotificationsEnabled());
|
||||||
readReceipts_->setState(!settings_->isReadReceiptsEnabled());
|
readReceipts_->setState(!settings_->isReadReceiptsEnabled());
|
||||||
|
|
|
@ -55,12 +55,6 @@ public:
|
||||||
|
|
||||||
void setFontSize(double size);
|
void setFontSize(double size);
|
||||||
|
|
||||||
void setRoomOrdering(bool state)
|
|
||||||
{
|
|
||||||
isOrderingEnabled_ = state;
|
|
||||||
save();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setGroupView(bool state)
|
void setGroupView(bool state)
|
||||||
{
|
{
|
||||||
if (isGroupViewEnabled_ != state)
|
if (isGroupViewEnabled_ != state)
|
||||||
|
@ -91,7 +85,6 @@ public:
|
||||||
QString theme() const { return !theme_.isEmpty() ? theme_ : "light"; }
|
QString theme() const { return !theme_.isEmpty() ? theme_ : "light"; }
|
||||||
bool isTrayEnabled() const { return isTrayEnabled_; }
|
bool isTrayEnabled() const { return isTrayEnabled_; }
|
||||||
bool isStartInTrayEnabled() const { return isStartInTrayEnabled_; }
|
bool isStartInTrayEnabled() const { return isStartInTrayEnabled_; }
|
||||||
bool isOrderingEnabled() const { return isOrderingEnabled_; }
|
|
||||||
bool isGroupViewEnabled() const { return isGroupViewEnabled_; }
|
bool isGroupViewEnabled() const { return isGroupViewEnabled_; }
|
||||||
bool isTypingNotificationsEnabled() const { return isTypingNotificationsEnabled_; }
|
bool isTypingNotificationsEnabled() const { return isTypingNotificationsEnabled_; }
|
||||||
bool isReadReceiptsEnabled() const { return isReadReceiptsEnabled_; }
|
bool isReadReceiptsEnabled() const { return isReadReceiptsEnabled_; }
|
||||||
|
@ -105,7 +98,6 @@ private:
|
||||||
QString theme_;
|
QString theme_;
|
||||||
bool isTrayEnabled_;
|
bool isTrayEnabled_;
|
||||||
bool isStartInTrayEnabled_;
|
bool isStartInTrayEnabled_;
|
||||||
bool isOrderingEnabled_;
|
|
||||||
bool isGroupViewEnabled_;
|
bool isGroupViewEnabled_;
|
||||||
bool isTypingNotificationsEnabled_;
|
bool isTypingNotificationsEnabled_;
|
||||||
bool isReadReceiptsEnabled_;
|
bool isReadReceiptsEnabled_;
|
||||||
|
@ -152,7 +144,6 @@ private:
|
||||||
|
|
||||||
Toggle *trayToggle_;
|
Toggle *trayToggle_;
|
||||||
Toggle *startInTrayToggle_;
|
Toggle *startInTrayToggle_;
|
||||||
Toggle *roomOrderToggle_;
|
|
||||||
Toggle *groupViewToggle_;
|
Toggle *groupViewToggle_;
|
||||||
Toggle *typingNotifications_;
|
Toggle *typingNotifications_;
|
||||||
Toggle *readReceipts_;
|
Toggle *readReceipts_;
|
||||||
|
|
Loading…
Reference in a new issue