mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 04:28:49 +03:00
Move invert enter key setting
This commit is contained in:
parent
80270e1f01
commit
9a15b0ea20
2 changed files with 39 additions and 39 deletions
|
@ -71,9 +71,9 @@ UserSettings::load(std::optional<QString> profile)
|
||||||
enlargeEmojiOnlyMessages_ =
|
enlargeEmojiOnlyMessages_ =
|
||||||
settings.value(QStringLiteral("user/timeline/enlarge_emoji_only_msg"), false).toBool();
|
settings.value(QStringLiteral("user/timeline/enlarge_emoji_only_msg"), false).toBool();
|
||||||
markdown_ = settings.value(QStringLiteral("user/markdown_enabled"), true).toBool();
|
markdown_ = settings.value(QStringLiteral("user/markdown_enabled"), true).toBool();
|
||||||
|
invertEnterKey_ = settings.value(QStringLiteral("user/invert_enter_key"), false).toBool();
|
||||||
bubbles_ = settings.value(QStringLiteral("user/bubbles_enabled"), false).toBool();
|
bubbles_ = settings.value(QStringLiteral("user/bubbles_enabled"), false).toBool();
|
||||||
smallAvatars_ = settings.value(QStringLiteral("user/small_avatars_enabled"), false).toBool();
|
smallAvatars_ = settings.value(QStringLiteral("user/small_avatars_enabled"), false).toBool();
|
||||||
invertEnterKey_ = settings.value(QStringLiteral("user/invert_enter_key"), false).toBool();
|
|
||||||
animateImagesOnHover_ =
|
animateImagesOnHover_ =
|
||||||
settings.value(QStringLiteral("user/animate_images_on_hover"), false).toBool();
|
settings.value(QStringLiteral("user/animate_images_on_hover"), false).toBool();
|
||||||
typingNotifications_ =
|
typingNotifications_ =
|
||||||
|
@ -290,6 +290,17 @@ UserSettings::setMarkdown(bool state)
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UserSettings::setInvertEnterKey(bool state)
|
||||||
|
{
|
||||||
|
if (state == invertEnterKey_)
|
||||||
|
return;
|
||||||
|
|
||||||
|
invertEnterKey_ = state;
|
||||||
|
emit invertEnterKeyChanged(state);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UserSettings::setBubbles(bool state)
|
UserSettings::setBubbles(bool state)
|
||||||
{
|
{
|
||||||
|
@ -310,17 +321,6 @@ UserSettings::setSmallAvatars(bool state)
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
UserSettings::setInvertEnterKey(bool state)
|
|
||||||
{
|
|
||||||
if (state == invertEnterKey_)
|
|
||||||
return;
|
|
||||||
|
|
||||||
invertEnterKey_ = state;
|
|
||||||
emit invertEnterKeyChanged(state);
|
|
||||||
save();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
UserSettings::setAnimateImagesOnHover(bool state)
|
UserSettings::setAnimateImagesOnHover(bool state)
|
||||||
{
|
{
|
||||||
|
@ -832,9 +832,9 @@ UserSettings::save()
|
||||||
settings.setValue(QStringLiteral("read_receipts"), readReceipts_);
|
settings.setValue(QStringLiteral("read_receipts"), readReceipts_);
|
||||||
settings.setValue(QStringLiteral("group_view"), groupView_);
|
settings.setValue(QStringLiteral("group_view"), groupView_);
|
||||||
settings.setValue(QStringLiteral("markdown_enabled"), markdown_);
|
settings.setValue(QStringLiteral("markdown_enabled"), markdown_);
|
||||||
|
settings.setValue(QStringLiteral("invert_enter_key"), invertEnterKey_);
|
||||||
settings.setValue(QStringLiteral("bubbles_enabled"), bubbles_);
|
settings.setValue(QStringLiteral("bubbles_enabled"), bubbles_);
|
||||||
settings.setValue(QStringLiteral("small_avatars_enabled"), smallAvatars_);
|
settings.setValue(QStringLiteral("small_avatars_enabled"), smallAvatars_);
|
||||||
settings.setValue(QStringLiteral("invert_enter_key"), invertEnterKey_);
|
|
||||||
settings.setValue(QStringLiteral("animate_images_on_hover"), animateImagesOnHover_);
|
settings.setValue(QStringLiteral("animate_images_on_hover"), animateImagesOnHover_);
|
||||||
settings.setValue(QStringLiteral("desktop_notifications"), hasDesktopNotifications_);
|
settings.setValue(QStringLiteral("desktop_notifications"), hasDesktopNotifications_);
|
||||||
settings.setValue(QStringLiteral("alert_on_notification"), hasAlertOnNotification_);
|
settings.setValue(QStringLiteral("alert_on_notification"), hasAlertOnNotification_);
|
||||||
|
@ -940,12 +940,12 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
return tr("Communities sidebar");
|
return tr("Communities sidebar");
|
||||||
case Markdown:
|
case Markdown:
|
||||||
return tr("Send messages as Markdown");
|
return tr("Send messages as Markdown");
|
||||||
|
case InvertEnterKey:
|
||||||
|
return tr("Use shift+enter to send and enter to start a new line");
|
||||||
case Bubbles:
|
case Bubbles:
|
||||||
return tr("Enable message bubbles");
|
return tr("Enable message bubbles");
|
||||||
case SmallAvatars:
|
case SmallAvatars:
|
||||||
return tr("Enable small Avatars");
|
return tr("Enable small Avatars");
|
||||||
case InvertEnterKey:
|
|
||||||
return tr("Use shift+enter to send and enter to start a new line");
|
|
||||||
case AnimateImagesOnHover:
|
case AnimateImagesOnHover:
|
||||||
return tr("Play animated images only on hover");
|
return tr("Play animated images only on hover");
|
||||||
case TypingNotifications:
|
case TypingNotifications:
|
||||||
|
@ -1076,12 +1076,12 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
return i->groupView();
|
return i->groupView();
|
||||||
case Markdown:
|
case Markdown:
|
||||||
return i->markdown();
|
return i->markdown();
|
||||||
|
case InvertEnterKey:
|
||||||
|
return i->invertEnterKey();
|
||||||
case Bubbles:
|
case Bubbles:
|
||||||
return i->bubbles();
|
return i->bubbles();
|
||||||
case SmallAvatars:
|
case SmallAvatars:
|
||||||
return i->smallAvatars();
|
return i->smallAvatars();
|
||||||
case InvertEnterKey:
|
|
||||||
return i->invertEnterKey();
|
|
||||||
case AnimateImagesOnHover:
|
case AnimateImagesOnHover:
|
||||||
return i->animateImagesOnHover();
|
return i->animateImagesOnHover();
|
||||||
case TypingNotifications:
|
case TypingNotifications:
|
||||||
|
@ -1218,15 +1218,15 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
return tr(
|
return tr(
|
||||||
"Allow using markdown in messages.\nWhen disabled, all messages are sent as a plain "
|
"Allow using markdown in messages.\nWhen disabled, all messages are sent as a plain "
|
||||||
"text.");
|
"text.");
|
||||||
|
case InvertEnterKey:
|
||||||
|
return tr(
|
||||||
|
"Invert the behavior of the enter key in the text input, making it send the message "
|
||||||
|
"when shift+enter is pressed and starting a new line when enter is pressed.");
|
||||||
case Bubbles:
|
case Bubbles:
|
||||||
return tr(
|
return tr(
|
||||||
"Messages get a bubble background. This also triggers some layout changes (WIP).");
|
"Messages get a bubble background. This also triggers some layout changes (WIP).");
|
||||||
case SmallAvatars:
|
case SmallAvatars:
|
||||||
return tr("Avatars are resized to fit above the message.");
|
return tr("Avatars are resized to fit above the message.");
|
||||||
case InvertEnterKey:
|
|
||||||
return tr(
|
|
||||||
"Invert the behavior of the enter key in the text input, making it send the message "
|
|
||||||
"when shift+enter is pressed and starting a new line when enter is pressed.");
|
|
||||||
case AnimateImagesOnHover:
|
case AnimateImagesOnHover:
|
||||||
return tr("Plays media like GIFs or WEBPs only when explicitly hovering over them.");
|
return tr("Plays media like GIFs or WEBPs only when explicitly hovering over them.");
|
||||||
case TypingNotifications:
|
case TypingNotifications:
|
||||||
|
@ -1364,9 +1364,9 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
case StartInTray:
|
case StartInTray:
|
||||||
case GroupView:
|
case GroupView:
|
||||||
case Markdown:
|
case Markdown:
|
||||||
|
case InvertEnterKey:
|
||||||
case Bubbles:
|
case Bubbles:
|
||||||
case SmallAvatars:
|
case SmallAvatars:
|
||||||
case InvertEnterKey:
|
|
||||||
case AnimateImagesOnHover:
|
case AnimateImagesOnHover:
|
||||||
case TypingNotifications:
|
case TypingNotifications:
|
||||||
case SortByImportance:
|
case SortByImportance:
|
||||||
|
@ -1590,6 +1590,13 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
case InvertEnterKey: {
|
||||||
|
if (value.userType() == QMetaType::Bool) {
|
||||||
|
i->setInvertEnterKey(value.toBool());
|
||||||
|
return true;
|
||||||
|
} else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
case Bubbles: {
|
case Bubbles: {
|
||||||
if (value.userType() == QMetaType::Bool) {
|
if (value.userType() == QMetaType::Bool) {
|
||||||
i->setBubbles(value.toBool());
|
i->setBubbles(value.toBool());
|
||||||
|
@ -1604,13 +1611,6 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case InvertEnterKey: {
|
|
||||||
if (value.userType() == QMetaType::Bool) {
|
|
||||||
i->setInvertEnterKey(value.toBool());
|
|
||||||
return true;
|
|
||||||
} else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
case AnimateImagesOnHover: {
|
case AnimateImagesOnHover: {
|
||||||
if (value.userType() == QMetaType::Bool) {
|
if (value.userType() == QMetaType::Bool) {
|
||||||
i->setAnimateImagesOnHover(value.toBool());
|
i->setAnimateImagesOnHover(value.toBool());
|
||||||
|
@ -2013,15 +2013,15 @@ UserSettingsModel::UserSettingsModel(QObject *p)
|
||||||
connect(s.get(), &UserSettings::markdownChanged, this, [this]() {
|
connect(s.get(), &UserSettings::markdownChanged, this, [this]() {
|
||||||
emit dataChanged(index(Markdown), index(Markdown), {Value});
|
emit dataChanged(index(Markdown), index(Markdown), {Value});
|
||||||
});
|
});
|
||||||
|
connect(s.get(), &UserSettings::invertEnterKeyChanged, this, [this]() {
|
||||||
|
emit dataChanged(index(InvertEnterKey), index(InvertEnterKey), {Value});
|
||||||
|
});
|
||||||
connect(s.get(), &UserSettings::bubblesChanged, this, [this]() {
|
connect(s.get(), &UserSettings::bubblesChanged, this, [this]() {
|
||||||
emit dataChanged(index(Bubbles), index(Bubbles), {Value});
|
emit dataChanged(index(Bubbles), index(Bubbles), {Value});
|
||||||
});
|
});
|
||||||
connect(s.get(), &UserSettings::smallAvatarsChanged, this, [this]() {
|
connect(s.get(), &UserSettings::smallAvatarsChanged, this, [this]() {
|
||||||
emit dataChanged(index(SmallAvatars), index(SmallAvatars), {Value});
|
emit dataChanged(index(SmallAvatars), index(SmallAvatars), {Value});
|
||||||
});
|
});
|
||||||
connect(s.get(), &UserSettings::invertEnterKeyChanged, this, [this]() {
|
|
||||||
emit dataChanged(index(InvertEnterKey), index(InvertEnterKey), {Value});
|
|
||||||
});
|
|
||||||
connect(s.get(), &UserSettings::groupViewStateChanged, this, [this]() {
|
connect(s.get(), &UserSettings::groupViewStateChanged, this, [this]() {
|
||||||
emit dataChanged(index(GroupView), index(GroupView), {Value});
|
emit dataChanged(index(GroupView), index(GroupView), {Value});
|
||||||
});
|
});
|
||||||
|
|
|
@ -39,10 +39,10 @@ class UserSettings final : public QObject
|
||||||
Q_PROPERTY(bool startInTray READ startInTray WRITE setStartInTray NOTIFY startInTrayChanged)
|
Q_PROPERTY(bool startInTray READ startInTray WRITE setStartInTray NOTIFY startInTrayChanged)
|
||||||
Q_PROPERTY(bool groupView READ groupView WRITE setGroupView NOTIFY groupViewStateChanged)
|
Q_PROPERTY(bool groupView READ groupView WRITE setGroupView NOTIFY groupViewStateChanged)
|
||||||
Q_PROPERTY(bool markdown READ markdown WRITE setMarkdown NOTIFY markdownChanged)
|
Q_PROPERTY(bool markdown READ markdown WRITE setMarkdown NOTIFY markdownChanged)
|
||||||
Q_PROPERTY(bool bubbles READ bubbles WRITE setBubbles NOTIFY bubblesChanged)
|
|
||||||
Q_PROPERTY(bool smallAvatars READ smallAvatars WRITE setSmallAvatars NOTIFY smallAvatarsChanged)
|
|
||||||
Q_PROPERTY(
|
Q_PROPERTY(
|
||||||
bool invertEnterKey READ invertEnterKey WRITE setInvertEnterKey NOTIFY invertEnterKeyChanged)
|
bool invertEnterKey READ invertEnterKey WRITE setInvertEnterKey NOTIFY invertEnterKeyChanged)
|
||||||
|
Q_PROPERTY(bool bubbles READ bubbles WRITE setBubbles NOTIFY bubblesChanged)
|
||||||
|
Q_PROPERTY(bool smallAvatars READ smallAvatars WRITE setSmallAvatars NOTIFY smallAvatarsChanged)
|
||||||
Q_PROPERTY(bool animateImagesOnHover READ animateImagesOnHover WRITE setAnimateImagesOnHover
|
Q_PROPERTY(bool animateImagesOnHover READ animateImagesOnHover WRITE setAnimateImagesOnHover
|
||||||
NOTIFY animateImagesOnHoverChanged)
|
NOTIFY animateImagesOnHoverChanged)
|
||||||
Q_PROPERTY(bool typingNotifications READ typingNotifications WRITE setTypingNotifications NOTIFY
|
Q_PROPERTY(bool typingNotifications READ typingNotifications WRITE setTypingNotifications NOTIFY
|
||||||
|
@ -154,9 +154,9 @@ public:
|
||||||
void setEmojiFontFamily(QString family);
|
void setEmojiFontFamily(QString family);
|
||||||
void setGroupView(bool state);
|
void setGroupView(bool state);
|
||||||
void setMarkdown(bool state);
|
void setMarkdown(bool state);
|
||||||
|
void setInvertEnterKey(bool state);
|
||||||
void setBubbles(bool state);
|
void setBubbles(bool state);
|
||||||
void setSmallAvatars(bool state);
|
void setSmallAvatars(bool state);
|
||||||
void setInvertEnterKey(bool state);
|
|
||||||
void setAnimateImagesOnHover(bool state);
|
void setAnimateImagesOnHover(bool state);
|
||||||
void setReadReceipts(bool state);
|
void setReadReceipts(bool state);
|
||||||
void setTypingNotifications(bool state);
|
void setTypingNotifications(bool state);
|
||||||
|
@ -217,9 +217,9 @@ public:
|
||||||
bool privacyScreen() const { return privacyScreen_; }
|
bool privacyScreen() const { return privacyScreen_; }
|
||||||
int privacyScreenTimeout() const { return privacyScreenTimeout_; }
|
int privacyScreenTimeout() const { return privacyScreenTimeout_; }
|
||||||
bool markdown() const { return markdown_; }
|
bool markdown() const { return markdown_; }
|
||||||
|
bool invertEnterKey() const { return invertEnterKey_; }
|
||||||
bool bubbles() const { return bubbles_; }
|
bool bubbles() const { return bubbles_; }
|
||||||
bool smallAvatars() const { return smallAvatars_; }
|
bool smallAvatars() const { return smallAvatars_; }
|
||||||
bool invertEnterKey() const { return invertEnterKey_; }
|
|
||||||
bool animateImagesOnHover() const { return animateImagesOnHover_; }
|
bool animateImagesOnHover() const { return animateImagesOnHover_; }
|
||||||
bool typingNotifications() const { return typingNotifications_; }
|
bool typingNotifications() const { return typingNotifications_; }
|
||||||
bool sortByImportance() const { return sortByImportance_; }
|
bool sortByImportance() const { return sortByImportance_; }
|
||||||
|
@ -282,9 +282,9 @@ signals:
|
||||||
void trayChanged(bool state);
|
void trayChanged(bool state);
|
||||||
void startInTrayChanged(bool state);
|
void startInTrayChanged(bool state);
|
||||||
void markdownChanged(bool state);
|
void markdownChanged(bool state);
|
||||||
|
void invertEnterKeyChanged(bool state);
|
||||||
void bubblesChanged(bool state);
|
void bubblesChanged(bool state);
|
||||||
void smallAvatarsChanged(bool state);
|
void smallAvatarsChanged(bool state);
|
||||||
void invertEnterKeyChanged(bool state);
|
|
||||||
void animateImagesOnHoverChanged(bool state);
|
void animateImagesOnHoverChanged(bool state);
|
||||||
void typingNotificationsChanged(bool state);
|
void typingNotificationsChanged(bool state);
|
||||||
void buttonInTimelineChanged(bool state);
|
void buttonInTimelineChanged(bool state);
|
||||||
|
@ -346,9 +346,9 @@ private:
|
||||||
bool startInTray_;
|
bool startInTray_;
|
||||||
bool groupView_;
|
bool groupView_;
|
||||||
bool markdown_;
|
bool markdown_;
|
||||||
|
bool invertEnterKey_;
|
||||||
bool bubbles_;
|
bool bubbles_;
|
||||||
bool smallAvatars_;
|
bool smallAvatars_;
|
||||||
bool invertEnterKey_;
|
|
||||||
bool animateImagesOnHover_;
|
bool animateImagesOnHover_;
|
||||||
bool typingNotifications_;
|
bool typingNotifications_;
|
||||||
bool sortByImportance_;
|
bool sortByImportance_;
|
||||||
|
@ -439,9 +439,9 @@ class UserSettingsModel final : public QAbstractListModel
|
||||||
TypingNotifications,
|
TypingNotifications,
|
||||||
ReadReceipts,
|
ReadReceipts,
|
||||||
Markdown,
|
Markdown,
|
||||||
|
InvertEnterKey,
|
||||||
Bubbles,
|
Bubbles,
|
||||||
SmallAvatars,
|
SmallAvatars,
|
||||||
InvertEnterKey,
|
|
||||||
SidebarSection,
|
SidebarSection,
|
||||||
GroupView,
|
GroupView,
|
||||||
SortByImportance,
|
SortByImportance,
|
||||||
|
|
Loading…
Reference in a new issue