|
|
|
@ -33,8 +33,9 @@ void |
|
|
|
|
UserSettings::load() |
|
|
|
|
{ |
|
|
|
|
QSettings settings; |
|
|
|
|
isTrayEnabled_ = settings.value("user/window/tray", true).toBool(); |
|
|
|
|
theme_ = settings.value("user/theme", "light").toString(); |
|
|
|
|
isTrayEnabled_ = settings.value("user/window/tray", true).toBool(); |
|
|
|
|
isOrderingEnabled_ = settings.value("user/room_ordering", true).toBool(); |
|
|
|
|
theme_ = settings.value("user/theme", "light").toString(); |
|
|
|
|
|
|
|
|
|
applyTheme(); |
|
|
|
|
} |
|
|
|
@ -47,12 +48,6 @@ UserSettings::setTheme(QString theme) |
|
|
|
|
applyTheme(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
UserSettings::setTray(bool state) |
|
|
|
|
{ |
|
|
|
|
isTrayEnabled_ = state; |
|
|
|
|
save(); |
|
|
|
|
} |
|
|
|
|
void |
|
|
|
|
UserSettings::applyTheme() |
|
|
|
|
{ |
|
|
|
@ -86,6 +81,7 @@ UserSettings::save() |
|
|
|
|
settings.setValue("tray", isTrayEnabled_); |
|
|
|
|
settings.endGroup(); |
|
|
|
|
|
|
|
|
|
settings.setValue("room_ordering", isOrderingEnabled_); |
|
|
|
|
settings.setValue("theme", theme()); |
|
|
|
|
settings.endGroup(); |
|
|
|
|
} |
|
|
|
@ -132,6 +128,17 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge |
|
|
|
|
trayOptionLayout_->addWidget(trayLabel); |
|
|
|
|
trayOptionLayout_->addWidget(trayToggle_, 0, Qt::AlignBottom | Qt::AlignRight); |
|
|
|
|
|
|
|
|
|
auto orderRoomLayout = new QHBoxLayout; |
|
|
|
|
orderRoomLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin); |
|
|
|
|
auto orderLabel = new QLabel(tr("Re-order rooms based on activity"), this); |
|
|
|
|
roomOrderToggle_ = new Toggle(this); |
|
|
|
|
roomOrderToggle_->setActiveColor(QColor("#38A3D8")); |
|
|
|
|
roomOrderToggle_->setInactiveColor(QColor("gray")); |
|
|
|
|
orderLabel->setStyleSheet("font-size: 15px;"); |
|
|
|
|
|
|
|
|
|
orderRoomLayout->addWidget(orderLabel); |
|
|
|
|
orderRoomLayout->addWidget(roomOrderToggle_, 0, Qt::AlignBottom | Qt::AlignRight); |
|
|
|
|
|
|
|
|
|
auto themeOptionLayout_ = new QHBoxLayout; |
|
|
|
|
themeOptionLayout_->setContentsMargins(0, OptionMargin, 0, OptionMargin); |
|
|
|
|
auto themeLabel_ = new QLabel(tr("App theme"), this); |
|
|
|
@ -155,6 +162,8 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge |
|
|
|
|
mainLayout_->addWidget(new HorizontalLine(this)); |
|
|
|
|
mainLayout_->addLayout(trayOptionLayout_); |
|
|
|
|
mainLayout_->addWidget(new HorizontalLine(this)); |
|
|
|
|
mainLayout_->addLayout(orderRoomLayout); |
|
|
|
|
mainLayout_->addWidget(new HorizontalLine(this)); |
|
|
|
|
mainLayout_->addLayout(themeOptionLayout_); |
|
|
|
|
mainLayout_->addWidget(new HorizontalLine(this)); |
|
|
|
|
|
|
|
|
@ -171,6 +180,10 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge |
|
|
|
|
emit trayOptionChanged(!isDisabled); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
connect(roomOrderToggle_, &Toggle::toggled, this, [=](bool isDisabled) { |
|
|
|
|
settings_->setRoomOrdering(!isDisabled); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
connect(backBtn_, &QPushButton::clicked, this, [=]() { |
|
|
|
|
settings_->save(); |
|
|
|
|
emit moveBack(); |
|
|
|
@ -181,7 +194,8 @@ void |
|
|
|
|
UserSettingsPage::showEvent(QShowEvent *) |
|
|
|
|
{ |
|
|
|
|
restoreThemeCombo(); |
|
|
|
|
trayToggle_->setState(!settings_->isTrayEnabled()); // Treats true as "off"
|
|
|
|
|
trayToggle_->setState(!settings_->isTrayEnabled()); // Treats true as "off"
|
|
|
|
|
roomOrderToggle_->setState(!settings_->isOrderingEnabled()); // Treats true as "off"
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|