|
|
@ -37,6 +37,7 @@ UserSettings::load() |
|
|
|
{ |
|
|
|
{ |
|
|
|
QSettings settings; |
|
|
|
QSettings settings; |
|
|
|
isTrayEnabled_ = settings.value("user/window/tray", true).toBool(); |
|
|
|
isTrayEnabled_ = settings.value("user/window/tray", true).toBool(); |
|
|
|
|
|
|
|
isStartInTrayEnabled_ = settings.value("user/window/start_in_tray", false).toBool(); |
|
|
|
isOrderingEnabled_ = settings.value("user/room_ordering", true).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(); |
|
|
@ -85,6 +86,7 @@ UserSettings::save() |
|
|
|
|
|
|
|
|
|
|
|
settings.beginGroup("window"); |
|
|
|
settings.beginGroup("window"); |
|
|
|
settings.setValue("tray", isTrayEnabled_); |
|
|
|
settings.setValue("tray", isTrayEnabled_); |
|
|
|
|
|
|
|
settings.setValue("start_in_tray", isStartInTrayEnabled_); |
|
|
|
settings.endGroup(); |
|
|
|
settings.endGroup(); |
|
|
|
|
|
|
|
|
|
|
|
settings.setValue("room_ordering", isOrderingEnabled_); |
|
|
|
settings.setValue("room_ordering", isOrderingEnabled_); |
|
|
@ -140,6 +142,20 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge |
|
|
|
trayOptionLayout_->addWidget(trayLabel); |
|
|
|
trayOptionLayout_->addWidget(trayLabel); |
|
|
|
trayOptionLayout_->addWidget(trayToggle_, 0, Qt::AlignBottom | Qt::AlignRight); |
|
|
|
trayOptionLayout_->addWidget(trayToggle_, 0, Qt::AlignBottom | Qt::AlignRight); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto startInTrayOptionLayout_ = new QHBoxLayout; |
|
|
|
|
|
|
|
startInTrayOptionLayout_->setContentsMargins(0, OptionMargin, 0, OptionMargin); |
|
|
|
|
|
|
|
auto startInTrayLabel = new QLabel(tr("Start in tray"), this); |
|
|
|
|
|
|
|
startInTrayToggle_ = new Toggle(this); |
|
|
|
|
|
|
|
startInTrayToggle_->setActiveColor(QColor("#38A3D8")); |
|
|
|
|
|
|
|
startInTrayToggle_->setInactiveColor(QColor("gray")); |
|
|
|
|
|
|
|
if (!settings_->isTrayEnabled()) |
|
|
|
|
|
|
|
startInTrayToggle_->setDisabled(true); |
|
|
|
|
|
|
|
startInTrayLabel->setStyleSheet("font-size: 15px;"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
startInTrayOptionLayout_->addWidget(startInTrayLabel); |
|
|
|
|
|
|
|
startInTrayOptionLayout_->addWidget( |
|
|
|
|
|
|
|
startInTrayToggle_, 0, Qt::AlignBottom | Qt::AlignRight); |
|
|
|
|
|
|
|
|
|
|
|
auto orderRoomLayout = new QHBoxLayout; |
|
|
|
auto orderRoomLayout = new QHBoxLayout; |
|
|
|
orderRoomLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin); |
|
|
|
orderRoomLayout->setContentsMargins(0, OptionMargin, 0, OptionMargin); |
|
|
|
auto orderLabel = new QLabel(tr("Re-order rooms based on activity"), this); |
|
|
|
auto orderLabel = new QLabel(tr("Re-order rooms based on activity"), this); |
|
|
@ -207,6 +223,8 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge |
|
|
|
mainLayout_->addWidget(new HorizontalLine(this)); |
|
|
|
mainLayout_->addWidget(new HorizontalLine(this)); |
|
|
|
mainLayout_->addLayout(trayOptionLayout_); |
|
|
|
mainLayout_->addLayout(trayOptionLayout_); |
|
|
|
mainLayout_->addWidget(new HorizontalLine(this)); |
|
|
|
mainLayout_->addWidget(new HorizontalLine(this)); |
|
|
|
|
|
|
|
mainLayout_->addLayout(startInTrayOptionLayout_); |
|
|
|
|
|
|
|
mainLayout_->addWidget(new HorizontalLine(this)); |
|
|
|
mainLayout_->addLayout(orderRoomLayout); |
|
|
|
mainLayout_->addLayout(orderRoomLayout); |
|
|
|
mainLayout_->addWidget(new HorizontalLine(this)); |
|
|
|
mainLayout_->addWidget(new HorizontalLine(this)); |
|
|
|
mainLayout_->addLayout(groupViewLayout); |
|
|
|
mainLayout_->addLayout(groupViewLayout); |
|
|
@ -228,9 +246,18 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge |
|
|
|
|
|
|
|
|
|
|
|
connect(trayToggle_, &Toggle::toggled, this, [this](bool isDisabled) { |
|
|
|
connect(trayToggle_, &Toggle::toggled, this, [this](bool isDisabled) { |
|
|
|
settings_->setTray(!isDisabled); |
|
|
|
settings_->setTray(!isDisabled); |
|
|
|
|
|
|
|
if (isDisabled) { |
|
|
|
|
|
|
|
startInTrayToggle_->setDisabled(true); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
startInTrayToggle_->setEnabled(true); |
|
|
|
|
|
|
|
} |
|
|
|
emit trayOptionChanged(!isDisabled); |
|
|
|
emit trayOptionChanged(!isDisabled); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect(startInTrayToggle_, &Toggle::toggled, this, [this](bool isDisabled) { |
|
|
|
|
|
|
|
settings_->setStartInTray(!isDisabled); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
connect(roomOrderToggle_, &Toggle::toggled, this, [this](bool isDisabled) { |
|
|
|
connect(roomOrderToggle_, &Toggle::toggled, this, [this](bool isDisabled) { |
|
|
|
settings_->setRoomOrdering(!isDisabled); |
|
|
|
settings_->setRoomOrdering(!isDisabled); |
|
|
|
}); |
|
|
|
}); |
|
|
@ -260,6 +287,7 @@ 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()); |
|
|
|
roomOrderToggle_->setState(!settings_->isOrderingEnabled()); |
|
|
|
roomOrderToggle_->setState(!settings_->isOrderingEnabled()); |
|
|
|
groupViewToggle_->setState(!settings_->isGroupViewEnabled()); |
|
|
|
groupViewToggle_->setState(!settings_->isGroupViewEnabled()); |
|
|
|
typingNotifications_->setState(!settings_->isTypingNotificationsEnabled()); |
|
|
|
typingNotifications_->setState(!settings_->isTypingNotificationsEnabled()); |
|
|
|