mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Rename settings to be more consistent
This commit is contained in:
parent
f452bdf2b0
commit
6b60ff7713
7 changed files with 142 additions and 148 deletions
|
@ -25,7 +25,7 @@ MouseArea {
|
||||||
messageContextMenu.show(model.id, model.type, model.isEncrypted, row)
|
messageContextMenu.show(model.id, model.type, model.isEncrypted, row)
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
color: (settings.isMessageHoverHighlightEnabled && parent.containsMouse) ? colors.base : "transparent"
|
color: (settings.messageHoverHighlight && parent.containsMouse) ? colors.base : "transparent"
|
||||||
anchors.fill: row
|
anchors.fill: row
|
||||||
}
|
}
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
|
|
@ -255,7 +255,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
|
||||||
text_input_, &TextInputWidget::startedTyping, this, &ChatPage::sendTypingNotifications);
|
text_input_, &TextInputWidget::startedTyping, this, &ChatPage::sendTypingNotifications);
|
||||||
connect(typingRefresher_, &QTimer::timeout, this, &ChatPage::sendTypingNotifications);
|
connect(typingRefresher_, &QTimer::timeout, this, &ChatPage::sendTypingNotifications);
|
||||||
connect(text_input_, &TextInputWidget::stoppedTyping, this, [this]() {
|
connect(text_input_, &TextInputWidget::stoppedTyping, this, [this]() {
|
||||||
if (!userSettings_->isTypingNotificationsEnabled())
|
if (!userSettings_->typingNotifications())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
typingRefresher_->stop();
|
typingRefresher_->stop();
|
||||||
|
@ -482,7 +482,7 @@ ChatPage::ChatPage(QSharedPointer<UserSettings> userSettings, QWidget *parent)
|
||||||
activateWindow();
|
activateWindow();
|
||||||
});
|
});
|
||||||
|
|
||||||
setGroupViewState(userSettings_->isGroupViewEnabled());
|
setGroupViewState(userSettings_->groupView());
|
||||||
|
|
||||||
connect(userSettings_.data(),
|
connect(userSettings_.data(),
|
||||||
&UserSettings::groupViewStateChanged,
|
&UserSettings::groupViewStateChanged,
|
||||||
|
@ -1207,7 +1207,7 @@ ChatPage::unbanUser(QString userid, QString reason)
|
||||||
void
|
void
|
||||||
ChatPage::sendTypingNotifications()
|
ChatPage::sendTypingNotifications()
|
||||||
{
|
{
|
||||||
if (!userSettings_->isTypingNotificationsEnabled())
|
if (!userSettings_->typingNotifications())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
http::client()->start_typing(
|
http::client()->start_typing(
|
||||||
|
@ -1343,7 +1343,7 @@ ChatPage::hideSideBars()
|
||||||
void
|
void
|
||||||
ChatPage::showSideBars()
|
ChatPage::showSideBars()
|
||||||
{
|
{
|
||||||
if (userSettings_->isGroupViewEnabled())
|
if (userSettings_->groupView())
|
||||||
communitiesList_->show();
|
communitiesList_->show();
|
||||||
|
|
||||||
sideBar_->show();
|
sideBar_->show();
|
||||||
|
|
|
@ -148,7 +148,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
trayIcon_->setVisible(userSettings_->isTrayEnabled());
|
trayIcon_->setVisible(userSettings_->tray());
|
||||||
|
|
||||||
if (hasActiveUser()) {
|
if (hasActiveUser()) {
|
||||||
QString token = settings.value("auth/access_token").toString();
|
QString token = settings.value("auth/access_token").toString();
|
||||||
|
@ -286,7 +286,7 @@ void
|
||||||
MainWindow::closeEvent(QCloseEvent *event)
|
MainWindow::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
if (!qApp->isSavingSession() && isVisible() && pageSupportsTray() &&
|
if (!qApp->isSavingSession() && isVisible() && pageSupportsTray() &&
|
||||||
userSettings_->isTrayEnabled()) {
|
userSettings_->tray()) {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
|
@ -451,7 +451,7 @@ RoomInfoListItem::calculateImportance() const
|
||||||
// returns ImportanceDisabled or Invite
|
// returns ImportanceDisabled or Invite
|
||||||
if (isInvite()) {
|
if (isInvite()) {
|
||||||
return Invite;
|
return Invite;
|
||||||
} else if (!settings->isSortByImportanceEnabled()) {
|
} else if (!settings->sortByImportance()) {
|
||||||
return ImportanceDisabled;
|
return ImportanceDisabled;
|
||||||
} else if (unreadHighlightedMsgCount_) {
|
} else if (unreadHighlightedMsgCount_) {
|
||||||
return NewMentions;
|
return NewMentions;
|
||||||
|
|
|
@ -52,53 +52,53 @@ void
|
||||||
UserSettings::load()
|
UserSettings::load()
|
||||||
{
|
{
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
isTrayEnabled_ = settings.value("user/window/tray", false).toBool();
|
tray_ = 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();
|
startInTray_ = settings.value("user/window/start_in_tray", false).toBool();
|
||||||
isGroupViewEnabled_ = settings.value("user/group_view", true).toBool();
|
groupView_ = settings.value("user/group_view", true).toBool();
|
||||||
isButtonsInTimelineEnabled_ = settings.value("user/timeline/buttons", true).toBool();
|
buttonsInTimeline_ = settings.value("user/timeline/buttons", true).toBool();
|
||||||
timelineMaxWidth_ = settings.value("user/timeline/max_width", 0).toInt();
|
timelineMaxWidth_ = settings.value("user/timeline/max_width", 0).toInt();
|
||||||
isMessageHoverHighlightEnabled_ =
|
messageHoverHighlight_ =
|
||||||
settings.value("user/timeline/message_hover_highlight", false).toBool();
|
settings.value("user/timeline/message_hover_highlight", false).toBool();
|
||||||
isEnlargeEmojiOnlyMessagesEnabled_ =
|
enlargeEmojiOnlyMessages_ =
|
||||||
settings.value("user/timeline/enlarge_emoji_only_msg", false).toBool();
|
settings.value("user/timeline/enlarge_emoji_only_msg", false).toBool();
|
||||||
isMarkdownEnabled_ = settings.value("user/markdown_enabled", true).toBool();
|
markdown_ = settings.value("user/markdown_enabled", true).toBool();
|
||||||
isTypingNotificationsEnabled_ = settings.value("user/typing_notifications", true).toBool();
|
typingNotifications_ = settings.value("user/typing_notifications", true).toBool();
|
||||||
sortByImportance_ = settings.value("user/sort_by_unread", true).toBool();
|
sortByImportance_ = settings.value("user/sort_by_unread", true).toBool();
|
||||||
isReadReceiptsEnabled_ = settings.value("user/read_receipts", true).toBool();
|
readReceipts_ = settings.value("user/read_receipts", true).toBool();
|
||||||
theme_ = settings.value("user/theme", defaultTheme_).toString();
|
theme_ = settings.value("user/theme", defaultTheme_).toString();
|
||||||
font_ = settings.value("user/font_family", "default").toString();
|
font_ = settings.value("user/font_family", "default").toString();
|
||||||
avatarCircles_ = settings.value("user/avatar_circles", true).toBool();
|
avatarCircles_ = settings.value("user/avatar_circles", true).toBool();
|
||||||
decryptSidebar_ = settings.value("user/decrypt_sidebar", true).toBool();
|
decryptSidebar_ = settings.value("user/decrypt_sidebar", true).toBool();
|
||||||
emojiFont_ = settings.value("user/emoji_font_family", "default").toString();
|
emojiFont_ = settings.value("user/emoji_font_family", "default").toString();
|
||||||
baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble();
|
baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble();
|
||||||
|
|
||||||
applyTheme();
|
applyTheme();
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
UserSettings::setMessageHoverHighlight(bool state)
|
UserSettings::setMessageHoverHighlight(bool state)
|
||||||
{
|
{
|
||||||
if (state == isMessageHoverHighlightEnabled_)
|
if (state == messageHoverHighlight_)
|
||||||
return;
|
return;
|
||||||
isMessageHoverHighlightEnabled_ = state;
|
messageHoverHighlight_ = state;
|
||||||
emit messageHoverHighlightChanged(state);
|
emit messageHoverHighlightChanged(state);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
UserSettings::setEnlargeEmojiOnlyMessages(bool state)
|
UserSettings::setEnlargeEmojiOnlyMessages(bool state)
|
||||||
{
|
{
|
||||||
if (state == isEnlargeEmojiOnlyMessagesEnabled_)
|
if (state == enlargeEmojiOnlyMessages_)
|
||||||
return;
|
return;
|
||||||
isEnlargeEmojiOnlyMessagesEnabled_ = state;
|
enlargeEmojiOnlyMessages_ = state;
|
||||||
emit enlargeEmojiOnlyMessagesChanged(state);
|
emit enlargeEmojiOnlyMessagesChanged(state);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
UserSettings::setTray(bool state)
|
UserSettings::setTray(bool state)
|
||||||
{
|
{
|
||||||
if (state == isTrayEnabled_)
|
if (state == tray_)
|
||||||
return;
|
return;
|
||||||
isTrayEnabled_ = state;
|
tray_ = state;
|
||||||
emit trayChanged(state);
|
emit trayChanged(state);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
@ -106,9 +106,9 @@ UserSettings::setTray(bool state)
|
||||||
void
|
void
|
||||||
UserSettings::setStartInTray(bool state)
|
UserSettings::setStartInTray(bool state)
|
||||||
{
|
{
|
||||||
if (state == isStartInTrayEnabled_)
|
if (state == startInTray_)
|
||||||
return;
|
return;
|
||||||
isStartInTrayEnabled_ = state;
|
startInTray_ = state;
|
||||||
emit startInTrayChanged(state);
|
emit startInTrayChanged(state);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
@ -116,19 +116,19 @@ UserSettings::setStartInTray(bool state)
|
||||||
void
|
void
|
||||||
UserSettings::setGroupView(bool state)
|
UserSettings::setGroupView(bool state)
|
||||||
{
|
{
|
||||||
if (isGroupViewEnabled_ != state)
|
if (groupView_ != state)
|
||||||
emit groupViewStateChanged(state);
|
emit groupViewStateChanged(state);
|
||||||
|
|
||||||
isGroupViewEnabled_ = state;
|
groupView_ = state;
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UserSettings::setMarkdownEnabled(bool state)
|
UserSettings::setMarkdown(bool state)
|
||||||
{
|
{
|
||||||
if (state == isMarkdownEnabled_)
|
if (state == markdown_)
|
||||||
return;
|
return;
|
||||||
isMarkdownEnabled_ = state;
|
markdown_ = state;
|
||||||
emit markdownChanged(state);
|
emit markdownChanged(state);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
@ -136,9 +136,9 @@ UserSettings::setMarkdownEnabled(bool state)
|
||||||
void
|
void
|
||||||
UserSettings::setReadReceipts(bool state)
|
UserSettings::setReadReceipts(bool state)
|
||||||
{
|
{
|
||||||
if (state == isReadReceiptsEnabled_)
|
if (state == readReceipts_)
|
||||||
return;
|
return;
|
||||||
isReadReceiptsEnabled_ = state;
|
readReceipts_ = state;
|
||||||
emit readReceiptsChanged(state);
|
emit readReceiptsChanged(state);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
@ -146,9 +146,9 @@ UserSettings::setReadReceipts(bool state)
|
||||||
void
|
void
|
||||||
UserSettings::setTypingNotifications(bool state)
|
UserSettings::setTypingNotifications(bool state)
|
||||||
{
|
{
|
||||||
if (state == isTypingNotificationsEnabled_)
|
if (state == typingNotifications_)
|
||||||
return;
|
return;
|
||||||
isTypingNotificationsEnabled_ = state;
|
typingNotifications_ = state;
|
||||||
emit typingNotificationsChanged(state);
|
emit typingNotificationsChanged(state);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
@ -166,9 +166,9 @@ UserSettings::setSortByImportance(bool state)
|
||||||
void
|
void
|
||||||
UserSettings::setButtonsInTimeline(bool state)
|
UserSettings::setButtonsInTimeline(bool state)
|
||||||
{
|
{
|
||||||
if (state == isButtonsInTimelineEnabled_)
|
if (state == buttonsInTimeline_)
|
||||||
return;
|
return;
|
||||||
isButtonsInTimelineEnabled_ = state;
|
buttonsInTimeline_ = state;
|
||||||
emit buttonInTimelineChanged(state);
|
emit buttonInTimelineChanged(state);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
@ -314,25 +314,25 @@ UserSettings::save()
|
||||||
settings.beginGroup("user");
|
settings.beginGroup("user");
|
||||||
|
|
||||||
settings.beginGroup("window");
|
settings.beginGroup("window");
|
||||||
settings.setValue("tray", isTrayEnabled_);
|
settings.setValue("tray", tray_);
|
||||||
settings.setValue("start_in_tray", isStartInTrayEnabled_);
|
settings.setValue("start_in_tray", startInTray_);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.beginGroup("timeline");
|
settings.beginGroup("timeline");
|
||||||
settings.setValue("buttons", isButtonsInTimelineEnabled_);
|
settings.setValue("buttons", buttonsInTimeline_);
|
||||||
settings.setValue("message_hover_highlight", isMessageHoverHighlightEnabled_);
|
settings.setValue("message_hover_highlight", messageHoverHighlight_);
|
||||||
settings.setValue("enlarge_emoji_only_msg", isEnlargeEmojiOnlyMessagesEnabled_);
|
settings.setValue("enlarge_emoji_only_msg", enlargeEmojiOnlyMessages_);
|
||||||
settings.setValue("max_width", timelineMaxWidth_);
|
settings.setValue("max_width", timelineMaxWidth_);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.setValue("avatar_circles", avatarCircles_);
|
settings.setValue("avatar_circles", avatarCircles_);
|
||||||
settings.setValue("decrypt_sidebar", decryptSidebar_);
|
settings.setValue("decrypt_sidebar", decryptSidebar_);
|
||||||
settings.setValue("font_size", baseFontSize_);
|
settings.setValue("font_size", baseFontSize_);
|
||||||
settings.setValue("typing_notifications", isTypingNotificationsEnabled_);
|
settings.setValue("typing_notifications", typingNotifications_);
|
||||||
settings.setValue("minor_events", sortByImportance_);
|
settings.setValue("minor_events", sortByImportance_);
|
||||||
settings.setValue("read_receipts", isReadReceiptsEnabled_);
|
settings.setValue("read_receipts", readReceipts_);
|
||||||
settings.setValue("group_view", isGroupViewEnabled_);
|
settings.setValue("group_view", groupView_);
|
||||||
settings.setValue("markdown_enabled", isMarkdownEnabled_);
|
settings.setValue("markdown_enabled", markdown_);
|
||||||
settings.setValue("desktop_notifications", hasDesktopNotifications_);
|
settings.setValue("desktop_notifications", hasDesktopNotifications_);
|
||||||
settings.setValue("theme", theme());
|
settings.setValue("theme", theme());
|
||||||
settings.setValue("font_family", font_);
|
settings.setValue("font_family", font_);
|
||||||
|
@ -399,7 +399,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
enlargeEmojiOnlyMessages_ = new Toggle{this};
|
enlargeEmojiOnlyMessages_ = new Toggle{this};
|
||||||
sortByImportance_ = new Toggle{this};
|
sortByImportance_ = new Toggle{this};
|
||||||
readReceipts_ = new Toggle{this};
|
readReceipts_ = new Toggle{this};
|
||||||
markdownEnabled_ = new Toggle{this};
|
markdown_ = new Toggle{this};
|
||||||
desktopNotifications_ = new Toggle{this};
|
desktopNotifications_ = new Toggle{this};
|
||||||
scaleFactorCombo_ = new QComboBox{this};
|
scaleFactorCombo_ = new QComboBox{this};
|
||||||
fontSizeCombo_ = new QComboBox{this};
|
fontSizeCombo_ = new QComboBox{this};
|
||||||
|
@ -407,7 +407,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
emojiFontSelectionCombo_ = new QComboBox{this};
|
emojiFontSelectionCombo_ = new QComboBox{this};
|
||||||
timelineMaxWidthSpin_ = new QSpinBox{this};
|
timelineMaxWidthSpin_ = new QSpinBox{this};
|
||||||
|
|
||||||
if (!settings_->isTrayEnabled())
|
if (!settings_->tray())
|
||||||
startInTrayToggle_->setDisabled(true);
|
startInTrayToggle_->setDisabled(true);
|
||||||
|
|
||||||
avatarCircles_->setFixedSize(64, 48);
|
avatarCircles_->setFixedSize(64, 48);
|
||||||
|
@ -548,7 +548,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
tr("Show if your message was read.\nStatus is displayed next to timestamps."));
|
tr("Show if your message was read.\nStatus is displayed next to timestamps."));
|
||||||
boxWrap(
|
boxWrap(
|
||||||
tr("Send messages as Markdown"),
|
tr("Send messages as Markdown"),
|
||||||
markdownEnabled_,
|
markdown_,
|
||||||
tr("Allow using markdown in messages.\nWhen disabled, all messages are sent as a plain "
|
tr("Allow using markdown in messages.\nWhen disabled, all messages are sent as a plain "
|
||||||
"text."));
|
"text."));
|
||||||
boxWrap(tr("Desktop notifications"),
|
boxWrap(tr("Desktop notifications"),
|
||||||
|
@ -629,63 +629,63 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
connect(emojiFontSelectionCombo_,
|
connect(emojiFontSelectionCombo_,
|
||||||
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
|
static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated),
|
||||||
[this](const QString &family) { settings_->setEmojiFontFamily(family.trimmed()); });
|
[this](const QString &family) { settings_->setEmojiFontFamily(family.trimmed()); });
|
||||||
connect(trayToggle_, &Toggle::toggled, this, [this](bool isDisabled) {
|
connect(trayToggle_, &Toggle::toggled, this, [this](bool disabled) {
|
||||||
settings_->setTray(!isDisabled);
|
settings_->setTray(!disabled);
|
||||||
if (isDisabled) {
|
if (disabled) {
|
||||||
startInTrayToggle_->setDisabled(true);
|
startInTrayToggle_->setDisabled(true);
|
||||||
} else {
|
} else {
|
||||||
startInTrayToggle_->setEnabled(true);
|
startInTrayToggle_->setEnabled(true);
|
||||||
}
|
}
|
||||||
emit trayOptionChanged(!isDisabled);
|
emit trayOptionChanged(!disabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(startInTrayToggle_, &Toggle::toggled, this, [this](bool isDisabled) {
|
connect(startInTrayToggle_, &Toggle::toggled, this, [this](bool disabled) {
|
||||||
settings_->setStartInTray(!isDisabled);
|
settings_->setStartInTray(!disabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(groupViewToggle_, &Toggle::toggled, this, [this](bool isDisabled) {
|
connect(groupViewToggle_, &Toggle::toggled, this, [this](bool disabled) {
|
||||||
settings_->setGroupView(!isDisabled);
|
settings_->setGroupView(!disabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(decryptSidebar_, &Toggle::toggled, this, [this](bool isDisabled) {
|
connect(decryptSidebar_, &Toggle::toggled, this, [this](bool disabled) {
|
||||||
settings_->setDecryptSidebar(!isDisabled);
|
settings_->setDecryptSidebar(!disabled);
|
||||||
emit decryptSidebarChanged();
|
emit decryptSidebarChanged();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(avatarCircles_, &Toggle::toggled, this, [this](bool isDisabled) {
|
connect(avatarCircles_, &Toggle::toggled, this, [this](bool disabled) {
|
||||||
settings_->setAvatarCircles(!isDisabled);
|
settings_->setAvatarCircles(!disabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(markdownEnabled_, &Toggle::toggled, this, [this](bool isDisabled) {
|
connect(markdown_, &Toggle::toggled, this, [this](bool disabled) {
|
||||||
settings_->setMarkdownEnabled(!isDisabled);
|
settings_->setMarkdown(!disabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(typingNotifications_, &Toggle::toggled, this, [this](bool isDisabled) {
|
connect(typingNotifications_, &Toggle::toggled, this, [this](bool disabled) {
|
||||||
settings_->setTypingNotifications(!isDisabled);
|
settings_->setTypingNotifications(!disabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(sortByImportance_, &Toggle::toggled, this, [this](bool isDisabled) {
|
connect(sortByImportance_, &Toggle::toggled, this, [this](bool disabled) {
|
||||||
settings_->setSortByImportance(!isDisabled);
|
settings_->setSortByImportance(!disabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(timelineButtonsToggle_, &Toggle::toggled, this, [this](bool isDisabled) {
|
connect(timelineButtonsToggle_, &Toggle::toggled, this, [this](bool disabled) {
|
||||||
settings_->setButtonsInTimeline(!isDisabled);
|
settings_->setButtonsInTimeline(!disabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(readReceipts_, &Toggle::toggled, this, [this](bool isDisabled) {
|
connect(readReceipts_, &Toggle::toggled, this, [this](bool disabled) {
|
||||||
settings_->setReadReceipts(!isDisabled);
|
settings_->setReadReceipts(!disabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(desktopNotifications_, &Toggle::toggled, this, [this](bool isDisabled) {
|
connect(desktopNotifications_, &Toggle::toggled, this, [this](bool disabled) {
|
||||||
settings_->setDesktopNotifications(!isDisabled);
|
settings_->setDesktopNotifications(!disabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(messageHoverHighlight_, &Toggle::toggled, this, [this](bool isDisabled) {
|
connect(messageHoverHighlight_, &Toggle::toggled, this, [this](bool disabled) {
|
||||||
settings_->setMessageHoverHighlight(!isDisabled);
|
settings_->setMessageHoverHighlight(!disabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(enlargeEmojiOnlyMessages_, &Toggle::toggled, this, [this](bool isDisabled) {
|
connect(enlargeEmojiOnlyMessages_, &Toggle::toggled, this, [this](bool disabled) {
|
||||||
settings_->setEnlargeEmojiOnlyMessages(!isDisabled);
|
settings_->setEnlargeEmojiOnlyMessages(!disabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(timelineMaxWidthSpin_,
|
connect(timelineMaxWidthSpin_,
|
||||||
|
@ -714,19 +714,19 @@ UserSettingsPage::showEvent(QShowEvent *)
|
||||||
utils::restoreCombobox(themeCombo_, settings_->theme());
|
utils::restoreCombobox(themeCombo_, settings_->theme());
|
||||||
|
|
||||||
// FIXME: Toggle treats true as "off"
|
// FIXME: Toggle treats true as "off"
|
||||||
trayToggle_->setState(!settings_->isTrayEnabled());
|
trayToggle_->setState(!settings_->tray());
|
||||||
startInTrayToggle_->setState(!settings_->isStartInTrayEnabled());
|
startInTrayToggle_->setState(!settings_->startInTray());
|
||||||
groupViewToggle_->setState(!settings_->isGroupViewEnabled());
|
groupViewToggle_->setState(!settings_->groupView());
|
||||||
decryptSidebar_->setState(!settings_->isDecryptSidebarEnabled());
|
decryptSidebar_->setState(!settings_->decryptSidebar());
|
||||||
avatarCircles_->setState(!settings_->isAvatarCirclesEnabled());
|
avatarCircles_->setState(!settings_->avatarCircles());
|
||||||
typingNotifications_->setState(!settings_->isTypingNotificationsEnabled());
|
typingNotifications_->setState(!settings_->typingNotifications());
|
||||||
sortByImportance_->setState(!settings_->isSortByImportanceEnabled());
|
sortByImportance_->setState(!settings_->sortByImportance());
|
||||||
timelineButtonsToggle_->setState(!settings_->isButtonsInTimelineEnabled());
|
timelineButtonsToggle_->setState(!settings_->buttonsInTimeline());
|
||||||
readReceipts_->setState(!settings_->isReadReceiptsEnabled());
|
readReceipts_->setState(!settings_->readReceipts());
|
||||||
markdownEnabled_->setState(!settings_->isMarkdownEnabled());
|
markdown_->setState(!settings_->markdown());
|
||||||
desktopNotifications_->setState(!settings_->hasDesktopNotifications());
|
desktopNotifications_->setState(!settings_->hasDesktopNotifications());
|
||||||
messageHoverHighlight_->setState(!settings_->isMessageHoverHighlightEnabled());
|
messageHoverHighlight_->setState(!settings_->messageHoverHighlight());
|
||||||
enlargeEmojiOnlyMessages_->setState(!settings_->isEnlargeEmojiOnlyMessagesEnabled());
|
enlargeEmojiOnlyMessages_->setState(!settings_->enlargeEmojiOnlyMessages());
|
||||||
deviceIdValue_->setText(QString::fromStdString(http::client()->device_id()));
|
deviceIdValue_->setText(QString::fromStdString(http::client()->device_id()));
|
||||||
timelineMaxWidthSpin_->setValue(settings_->timelineMaxWidth());
|
timelineMaxWidthSpin_->setValue(settings_->timelineMaxWidth());
|
||||||
|
|
||||||
|
|
|
@ -40,30 +40,27 @@ class UserSettings : public QObject
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PROPERTY(QString theme READ theme WRITE setTheme NOTIFY themeChanged)
|
Q_PROPERTY(QString theme READ theme WRITE setTheme NOTIFY themeChanged)
|
||||||
Q_PROPERTY(bool isMessageHoverHighlightEnabled READ isMessageHoverHighlightEnabled WRITE
|
Q_PROPERTY(bool messageHoverHighlight READ messageHoverHighlight WRITE
|
||||||
setMessageHoverHighlight NOTIFY messageHoverHighlightChanged)
|
setMessageHoverHighlight NOTIFY messageHoverHighlightChanged)
|
||||||
Q_PROPERTY(bool enlargeEmojiOnlyMessages READ isEnlargeEmojiOnlyMessagesEnabled WRITE
|
Q_PROPERTY(bool enlargeEmojiOnlyMessages READ enlargeEmojiOnlyMessages WRITE
|
||||||
setEnlargeEmojiOnlyMessages NOTIFY enlargeEmojiOnlyMessagesChanged)
|
setEnlargeEmojiOnlyMessages NOTIFY enlargeEmojiOnlyMessagesChanged)
|
||||||
Q_PROPERTY(bool trayEnabled READ isTrayEnabled WRITE setTray NOTIFY trayChanged)
|
Q_PROPERTY(bool tray READ tray WRITE setTray NOTIFY trayChanged)
|
||||||
Q_PROPERTY(bool startInTrayEnabled READ isStartInTrayEnabled WRITE setStartInTray NOTIFY
|
Q_PROPERTY(bool startInTray READ startInTray WRITE setStartInTray NOTIFY startInTrayChanged)
|
||||||
startInTrayChanged)
|
Q_PROPERTY(bool groupView READ groupView WRITE setGroupView NOTIFY groupViewStateChanged)
|
||||||
Q_PROPERTY(bool groupViewEnabled READ isGroupViewEnabled WRITE setGroupView NOTIFY
|
Q_PROPERTY(bool markdown READ markdown WRITE setMarkdown NOTIFY markdownChanged)
|
||||||
groupViewStateChanged)
|
Q_PROPERTY(bool typingNotifications READ typingNotifications WRITE setTypingNotifications
|
||||||
|
NOTIFY typingNotificationsChanged)
|
||||||
|
Q_PROPERTY(bool sortByImportance READ sortByImportance WRITE setSortByImportance NOTIFY
|
||||||
|
roomSortingChanged)
|
||||||
|
Q_PROPERTY(bool buttonsInTimeline READ buttonsInTimeline WRITE setButtonsInTimeline NOTIFY
|
||||||
|
buttonInTimelineChanged)
|
||||||
Q_PROPERTY(
|
Q_PROPERTY(
|
||||||
bool markdown READ isMarkdownEnabled WRITE setMarkdownEnabled NOTIFY markdownChanged)
|
bool readReceipts READ readReceipts WRITE setReadReceipts NOTIFY readReceiptsChanged)
|
||||||
Q_PROPERTY(bool typingNotifications READ isTypingNotificationsEnabled WRITE
|
|
||||||
setTypingNotifications NOTIFY typingNotificationsChanged)
|
|
||||||
Q_PROPERTY(bool sortByImportance READ isSortByImportanceEnabled WRITE setSortByImportance
|
|
||||||
NOTIFY roomSortingChanged)
|
|
||||||
Q_PROPERTY(bool buttonsInTimeline READ isButtonsInTimelineEnabled WRITE setButtonsInTimeline
|
|
||||||
NOTIFY buttonInTimelineChanged)
|
|
||||||
Q_PROPERTY(bool readReceipts READ isReadReceiptsEnabled WRITE setReadReceipts NOTIFY
|
|
||||||
readReceiptsChanged)
|
|
||||||
Q_PROPERTY(bool desktopNotifications READ hasDesktopNotifications WRITE
|
Q_PROPERTY(bool desktopNotifications READ hasDesktopNotifications WRITE
|
||||||
setDesktopNotifications NOTIFY desktopNotificationsChanged)
|
setDesktopNotifications NOTIFY desktopNotificationsChanged)
|
||||||
Q_PROPERTY(bool avatarCircles READ isAvatarCirclesEnabled WRITE setAvatarCircles NOTIFY
|
Q_PROPERTY(
|
||||||
avatarCirclesChanged)
|
bool avatarCircles READ avatarCircles WRITE setAvatarCircles NOTIFY avatarCirclesChanged)
|
||||||
Q_PROPERTY(bool decryptSidebar READ isDecryptSidebarEnabled WRITE setDecryptSidebar NOTIFY
|
Q_PROPERTY(bool decryptSidebar READ decryptSidebar WRITE setDecryptSidebar NOTIFY
|
||||||
decryptSidebarChanged)
|
decryptSidebarChanged)
|
||||||
Q_PROPERTY(int timelineMaxWidth READ timelineMaxWidth WRITE setTimelineMaxWidth NOTIFY
|
Q_PROPERTY(int timelineMaxWidth READ timelineMaxWidth WRITE setTimelineMaxWidth NOTIFY
|
||||||
timelineMaxWidthChanged)
|
timelineMaxWidthChanged)
|
||||||
|
@ -87,7 +84,7 @@ public:
|
||||||
void setFontFamily(QString family);
|
void setFontFamily(QString family);
|
||||||
void setEmojiFontFamily(QString family);
|
void setEmojiFontFamily(QString family);
|
||||||
void setGroupView(bool state);
|
void setGroupView(bool state);
|
||||||
void setMarkdownEnabled(bool state);
|
void setMarkdown(bool state);
|
||||||
void setReadReceipts(bool state);
|
void setReadReceipts(bool state);
|
||||||
void setTypingNotifications(bool state);
|
void setTypingNotifications(bool state);
|
||||||
void setSortByImportance(bool state);
|
void setSortByImportance(bool state);
|
||||||
|
@ -98,21 +95,18 @@ public:
|
||||||
void setDecryptSidebar(bool state);
|
void setDecryptSidebar(bool state);
|
||||||
|
|
||||||
QString theme() const { return !theme_.isEmpty() ? theme_ : defaultTheme_; }
|
QString theme() const { return !theme_.isEmpty() ? theme_ : defaultTheme_; }
|
||||||
bool isMessageHoverHighlightEnabled() const { return isMessageHoverHighlightEnabled_; }
|
bool messageHoverHighlight() const { return messageHoverHighlight_; }
|
||||||
bool isEnlargeEmojiOnlyMessagesEnabled() const
|
bool enlargeEmojiOnlyMessages() const { return enlargeEmojiOnlyMessages_; }
|
||||||
{
|
bool tray() const { return tray_; }
|
||||||
return isEnlargeEmojiOnlyMessagesEnabled_;
|
bool startInTray() const { return startInTray_; }
|
||||||
}
|
bool groupView() const { return groupView_; }
|
||||||
bool isTrayEnabled() const { return isTrayEnabled_; }
|
bool avatarCircles() const { return avatarCircles_; }
|
||||||
bool isStartInTrayEnabled() const { return isStartInTrayEnabled_; }
|
bool decryptSidebar() const { return decryptSidebar_; }
|
||||||
bool isGroupViewEnabled() const { return isGroupViewEnabled_; }
|
bool markdown() const { return markdown_; }
|
||||||
bool isAvatarCirclesEnabled() const { return avatarCircles_; }
|
bool typingNotifications() const { return typingNotifications_; }
|
||||||
bool isDecryptSidebarEnabled() const { return decryptSidebar_; }
|
bool sortByImportance() const { return sortByImportance_; }
|
||||||
bool isMarkdownEnabled() const { return isMarkdownEnabled_; }
|
bool buttonsInTimeline() const { return buttonsInTimeline_; }
|
||||||
bool isTypingNotificationsEnabled() const { return isTypingNotificationsEnabled_; }
|
bool readReceipts() const { return readReceipts_; }
|
||||||
bool isSortByImportanceEnabled() const { return sortByImportance_; }
|
|
||||||
bool isButtonsInTimelineEnabled() const { return isButtonsInTimelineEnabled_; }
|
|
||||||
bool isReadReceiptsEnabled() const { return isReadReceiptsEnabled_; }
|
|
||||||
bool hasDesktopNotifications() const { return hasDesktopNotifications_; }
|
bool hasDesktopNotifications() const { return hasDesktopNotifications_; }
|
||||||
int timelineMaxWidth() const { return timelineMaxWidth_; }
|
int timelineMaxWidth() const { return timelineMaxWidth_; }
|
||||||
double fontSize() const { return baseFontSize_; }
|
double fontSize() const { return baseFontSize_; }
|
||||||
|
@ -146,16 +140,16 @@ private:
|
||||||
? "light"
|
? "light"
|
||||||
: "system";
|
: "system";
|
||||||
QString theme_;
|
QString theme_;
|
||||||
bool isMessageHoverHighlightEnabled_;
|
bool messageHoverHighlight_;
|
||||||
bool isEnlargeEmojiOnlyMessagesEnabled_;
|
bool enlargeEmojiOnlyMessages_;
|
||||||
bool isTrayEnabled_;
|
bool tray_;
|
||||||
bool isStartInTrayEnabled_;
|
bool startInTray_;
|
||||||
bool isGroupViewEnabled_;
|
bool groupView_;
|
||||||
bool isMarkdownEnabled_;
|
bool markdown_;
|
||||||
bool isTypingNotificationsEnabled_;
|
bool typingNotifications_;
|
||||||
bool sortByImportance_;
|
bool sortByImportance_;
|
||||||
bool isButtonsInTimelineEnabled_;
|
bool buttonsInTimeline_;
|
||||||
bool isReadReceiptsEnabled_;
|
bool readReceipts_;
|
||||||
bool hasDesktopNotifications_;
|
bool hasDesktopNotifications_;
|
||||||
bool avatarCircles_;
|
bool avatarCircles_;
|
||||||
bool decryptSidebar_;
|
bool decryptSidebar_;
|
||||||
|
@ -212,7 +206,7 @@ private:
|
||||||
Toggle *enlargeEmojiOnlyMessages_;
|
Toggle *enlargeEmojiOnlyMessages_;
|
||||||
Toggle *sortByImportance_;
|
Toggle *sortByImportance_;
|
||||||
Toggle *readReceipts_;
|
Toggle *readReceipts_;
|
||||||
Toggle *markdownEnabled_;
|
Toggle *markdown_;
|
||||||
Toggle *desktopNotifications_;
|
Toggle *desktopNotifications_;
|
||||||
Toggle *avatarCircles_;
|
Toggle *avatarCircles_;
|
||||||
Toggle *decryptSidebar_;
|
Toggle *decryptSidebar_;
|
||||||
|
|
|
@ -19,7 +19,7 @@ Q_DECLARE_METATYPE(mtx::events::collections::TimelineEvents)
|
||||||
void
|
void
|
||||||
TimelineViewManager::updateEncryptedDescriptions()
|
TimelineViewManager::updateEncryptedDescriptions()
|
||||||
{
|
{
|
||||||
auto decrypt = settings->isDecryptSidebarEnabled();
|
auto decrypt = settings->decryptSidebar();
|
||||||
QHash<QString, QSharedPointer<TimelineModel>>::iterator i;
|
QHash<QString, QSharedPointer<TimelineModel>>::iterator i;
|
||||||
for (i = models.begin(); i != models.end(); ++i) {
|
for (i = models.begin(); i != models.end(); ++i) {
|
||||||
auto ptr = i.value();
|
auto ptr = i.value();
|
||||||
|
@ -114,7 +114,7 @@ TimelineViewManager::sync(const mtx::responses::Rooms &rooms)
|
||||||
const auto &room_model = models.value(QString::fromStdString(room_id));
|
const auto &room_model = models.value(QString::fromStdString(room_id));
|
||||||
room_model->addEvents(room.timeline);
|
room_model->addEvents(room.timeline);
|
||||||
|
|
||||||
if (ChatPage::instance()->userSettings()->isTypingNotificationsEnabled()) {
|
if (ChatPage::instance()->userSettings()->typingNotifications()) {
|
||||||
std::vector<QString> typing;
|
std::vector<QString> typing;
|
||||||
typing.reserve(room.ephemeral.typing.size());
|
typing.reserve(room.ephemeral.typing.size());
|
||||||
for (const auto &user : room.ephemeral.typing) {
|
for (const auto &user : room.ephemeral.typing) {
|
||||||
|
@ -134,7 +134,7 @@ TimelineViewManager::addRoom(const QString &room_id)
|
||||||
{
|
{
|
||||||
if (!models.contains(room_id)) {
|
if (!models.contains(room_id)) {
|
||||||
QSharedPointer<TimelineModel> newRoom(new TimelineModel(this, room_id));
|
QSharedPointer<TimelineModel> newRoom(new TimelineModel(this, room_id));
|
||||||
newRoom->setDecryptDescription(settings->isDecryptSidebarEnabled());
|
newRoom->setDecryptDescription(settings->decryptSidebar());
|
||||||
|
|
||||||
connect(newRoom.data(),
|
connect(newRoom.data(),
|
||||||
&TimelineModel::newEncryptedImage,
|
&TimelineModel::newEncryptedImage,
|
||||||
|
@ -218,7 +218,7 @@ TimelineViewManager::queueTextMessage(const QString &msg)
|
||||||
mtx::events::msg::Text text = {};
|
mtx::events::msg::Text text = {};
|
||||||
text.body = msg.trimmed().toStdString();
|
text.body = msg.trimmed().toStdString();
|
||||||
|
|
||||||
if (settings->isMarkdownEnabled()) {
|
if (settings->markdown()) {
|
||||||
text.formatted_body = utils::markdownToHtml(msg).toStdString();
|
text.formatted_body = utils::markdownToHtml(msg).toStdString();
|
||||||
|
|
||||||
// Don't send formatted_body, when we don't need to
|
// Don't send formatted_body, when we don't need to
|
||||||
|
@ -246,7 +246,7 @@ TimelineViewManager::queueTextMessage(const QString &msg)
|
||||||
|
|
||||||
// NOTE(Nico): rich replies always need a formatted_body!
|
// NOTE(Nico): rich replies always need a formatted_body!
|
||||||
text.format = "org.matrix.custom.html";
|
text.format = "org.matrix.custom.html";
|
||||||
if (settings->isMarkdownEnabled())
|
if (settings->markdown())
|
||||||
text.formatted_body =
|
text.formatted_body =
|
||||||
utils::getFormattedQuoteBody(related, utils::markdownToHtml(msg))
|
utils::getFormattedQuoteBody(related, utils::markdownToHtml(msg))
|
||||||
.toStdString();
|
.toStdString();
|
||||||
|
@ -269,7 +269,7 @@ TimelineViewManager::queueEmoteMessage(const QString &msg)
|
||||||
mtx::events::msg::Emote emote;
|
mtx::events::msg::Emote emote;
|
||||||
emote.body = msg.trimmed().toStdString();
|
emote.body = msg.trimmed().toStdString();
|
||||||
|
|
||||||
if (html != msg.trimmed().toHtmlEscaped() && settings->isMarkdownEnabled()) {
|
if (html != msg.trimmed().toHtmlEscaped() && settings->markdown()) {
|
||||||
emote.formatted_body = html.toStdString();
|
emote.formatted_body = html.toStdString();
|
||||||
emote.format = "org.matrix.custom.html";
|
emote.format = "org.matrix.custom.html";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue