From f02342fe227c6ab05e94d6ac72d05dd0b6f127a2 Mon Sep 17 00:00:00 2001 From: Jedi18 Date: Fri, 5 Feb 2021 21:52:49 +0530 Subject: close emoji autocompleter if space typed after : issue #433 and adds default option for emoji font family settings --- src/UserSettingsPage.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index 96c07d7c..5bff1323 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -725,6 +725,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge // TODO: Is there a way to limit to just emojis, rather than // all emoji fonts? auto emojiFamilies = fontDb.families(QFontDatabase::Symbol); + emojiFontSelectionCombo_->addItem(QString("default")); for (const auto &family : emojiFamilies) { emojiFontSelectionCombo_->addItem(family); } -- cgit 1.4.1 From 4aefac08a4b57e6fb344cd8cffb0b6e32698e0ba Mon Sep 17 00:00:00 2001 From: Jedi18 Date: Fri, 5 Feb 2021 22:42:08 +0530 Subject: focus message input on adding emoji/reacting to a message --- resources/qml/MessageInput.qml | 6 ++++++ resources/qml/emoji/EmojiButton.qml | 1 + src/timeline/TimelineViewManager.cpp | 6 ++++++ src/timeline/TimelineViewManager.h | 2 ++ 4 files changed, 15 insertions(+) (limited to 'src') diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml index 5a9cfd33..9a83b52b 100644 --- a/resources/qml/MessageInput.qml +++ b/resources/qml/MessageInput.qml @@ -270,6 +270,11 @@ Rectangle { target: TimelineManager.timeline } + Connections { + target: TimelineManager + onFocusInput: messageInput.forceActiveFocus() + } + MouseArea { // workaround for wrong cursor shape on some platforms anchors.fill: parent @@ -297,6 +302,7 @@ Rectangle { ToolTip.text: qsTr("Emoji") onClicked: emojiPopup.visible ? emojiPopup.close() : emojiPopup.show(emojiButton, function(emoji) { messageInput.insert(messageInput.cursorPosition, emoji); + TimelineManager.focusMessageInput() }) } diff --git a/resources/qml/emoji/EmojiButton.qml b/resources/qml/emoji/EmojiButton.qml index 928d6226..622f8aa2 100644 --- a/resources/qml/emoji/EmojiButton.qml +++ b/resources/qml/emoji/EmojiButton.qml @@ -14,5 +14,6 @@ ImageButton { image: ":/icons/icons/ui/smile.png" onClicked: emojiPicker.visible ? emojiPicker.close() : emojiPicker.show(emojiButton, function(emoji) { TimelineManager.queueReactionMessage(event_id, emoji); + TimelineManager.focusMessageInput() }) } diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index 93451976..9ca08e06 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -545,3 +545,9 @@ TimelineViewManager::queueCallMessage(const QString &roomid, { models.value(roomid)->sendMessageEvent(callHangUp, mtx::events::EventType::CallHangUp); } + +void +TimelineViewManager::focusMessageInput() +{ + emit focusInput(); +} \ No newline at end of file diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h index 74128865..7c994a14 100644 --- a/src/timeline/TimelineViewManager.h +++ b/src/timeline/TimelineViewManager.h @@ -66,6 +66,7 @@ public: Q_INVOKABLE void openLink(QString link) const; + Q_INVOKABLE void focusMessageInput(); Q_INVOKABLE void openInviteUsersDialog(); Q_INVOKABLE void openMemberListDialog() const; Q_INVOKABLE void openLeaveRoomDialog() const; @@ -87,6 +88,7 @@ signals: void showRoomList(); void narrowViewChanged(); void focusChanged(); + void focusInput(); public slots: void updateReadReceipts(const QString &room_id, const std::vector &event_ids); -- cgit 1.4.1 From 8d195a4d11d6dc0584a626e72581782b494bfc8e Mon Sep 17 00:00:00 2001 From: Jedi18 Date: Sat, 6 Feb 2021 10:24:41 +0530 Subject: translation fix for default text in emoji combo --- src/UserSettingsPage.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index 5bff1323..f9885abd 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -93,7 +93,7 @@ UserSettings::load(std::optional profile) sortByImportance_ = settings.value("user/sort_by_unread", true).toBool(); readReceipts_ = settings.value("user/read_receipts", true).toBool(); theme_ = settings.value("user/theme", defaultTheme_).toString(); - font_ = settings.value("user/font_family", "default").toString(); + font_ = settings.value("user/font_family", tr("Default")).toString(); avatarCircles_ = settings.value("user/avatar_circles", true).toBool(); decryptSidebar_ = settings.value("user/decrypt_sidebar", true).toBool(); privacyScreen_ = settings.value("user/privacy_screen", false).toBool(); @@ -101,7 +101,7 @@ UserSettings::load(std::optional profile) shareKeysWithTrustedUsers_ = settings.value("user/share_keys_with_trusted_users", true).toBool(); mobileMode_ = settings.value("user/mobile_mode", false).toBool(); - emojiFont_ = settings.value("user/emoji_font_family", "default").toString(); + emojiFont_ = settings.value("user/emoji_font_family", tr("Default")).toString(); baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble(); auto tempPresence = settings.value("user/presence", "").toString().toStdString(); auto presenceValue = QMetaEnum::fromType().keyToValue(tempPresence.c_str()); @@ -725,7 +725,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge // TODO: Is there a way to limit to just emojis, rather than // all emoji fonts? auto emojiFamilies = fontDb.families(QFontDatabase::Symbol); - emojiFontSelectionCombo_->addItem(QString("default")); + emojiFontSelectionCombo_->addItem(tr("Default")); for (const auto &family : emojiFamilies) { emojiFontSelectionCombo_->addItem(family); } -- cgit 1.4.1 From c2a56fc23301967927ac019db0ac8c2ad99618ac Mon Sep 17 00:00:00 2001 From: Jedi18 Date: Sun, 7 Feb 2021 22:15:06 +0530 Subject: emoji default translation fix --- src/UserSettingsPage.cpp | 21 +++++++++++++++++---- src/UserSettingsPage.h | 8 +++++++- 2 files changed, 24 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index f9885abd..bf1bdb86 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -93,7 +93,7 @@ UserSettings::load(std::optional profile) sortByImportance_ = settings.value("user/sort_by_unread", true).toBool(); readReceipts_ = settings.value("user/read_receipts", true).toBool(); theme_ = settings.value("user/theme", defaultTheme_).toString(); - font_ = settings.value("user/font_family", tr("Default")).toString(); + font_ = settings.value("user/font_family", "").toString(); avatarCircles_ = settings.value("user/avatar_circles", true).toBool(); decryptSidebar_ = settings.value("user/decrypt_sidebar", true).toBool(); privacyScreen_ = settings.value("user/privacy_screen", false).toBool(); @@ -101,7 +101,7 @@ UserSettings::load(std::optional profile) shareKeysWithTrustedUsers_ = settings.value("user/share_keys_with_trusted_users", true).toBool(); mobileMode_ = settings.value("user/mobile_mode", false).toBool(); - emojiFont_ = settings.value("user/emoji_font_family", tr("Default")).toString(); + emojiFont_ = settings.value("user/emoji_font_family", "Default").toString(); baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble(); auto tempPresence = settings.value("user/presence", "").toString().toStdString(); auto presenceValue = QMetaEnum::fromType().keyToValue(tempPresence.c_str()); @@ -341,7 +341,13 @@ UserSettings::setEmojiFontFamily(QString family) { if (family == emojiFont_) return; - emojiFont_ = family; + + if (family == tr("Default")) { + emojiFont_ = "Default"; + } else { + emojiFont_ = family; + } + emit emojiFontChanged(family); save(); } @@ -730,7 +736,14 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge emojiFontSelectionCombo_->addItem(family); } - fontSelectionCombo_->setCurrentIndex(fontSelectionCombo_->findText(settings_->font())); + QString currentFont = settings_->font(); + if (currentFont == "Default") { + fontSelectionCombo_->setCurrentIndex( + fontSelectionCombo_->findText(tr(currentFont.toStdString().c_str()))); + } else { + fontSelectionCombo_->setCurrentIndex( + fontSelectionCombo_->findText(currentFont)); + } emojiFontSelectionCombo_->setCurrentIndex( emojiFontSelectionCombo_->findText(settings_->emojiFont())); diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h index b65e1efc..ab82c282 100644 --- a/src/UserSettingsPage.h +++ b/src/UserSettingsPage.h @@ -177,7 +177,13 @@ public: int timelineMaxWidth() const { return timelineMaxWidth_; } double fontSize() const { return baseFontSize_; } QString font() const { return font_; } - QString emojiFont() const { return emojiFont_; } + QString emojiFont() const { + if (emojiFont_ == "Default") { + return tr("Default"); + } + + return emojiFont_; + } Presence presence() const { return presence_; } QString ringtone() const { return ringtone_; } QString microphone() const { return microphone_; } -- cgit 1.4.1 From 04b920fbee4547b65a21af03ba709281250e5960 Mon Sep 17 00:00:00 2001 From: Jedi18 Date: Sun, 7 Feb 2021 22:18:04 +0530 Subject: linting fix --- src/UserSettingsPage.cpp | 3 +-- src/UserSettingsPage.h | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index bf1bdb86..f0d35aa6 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -741,8 +741,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge fontSelectionCombo_->setCurrentIndex( fontSelectionCombo_->findText(tr(currentFont.toStdString().c_str()))); } else { - fontSelectionCombo_->setCurrentIndex( - fontSelectionCombo_->findText(currentFont)); + fontSelectionCombo_->setCurrentIndex(fontSelectionCombo_->findText(currentFont)); } emojiFontSelectionCombo_->setCurrentIndex( diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h index ab82c282..49de94b3 100644 --- a/src/UserSettingsPage.h +++ b/src/UserSettingsPage.h @@ -177,12 +177,13 @@ public: int timelineMaxWidth() const { return timelineMaxWidth_; } double fontSize() const { return baseFontSize_; } QString font() const { return font_; } - QString emojiFont() const { + QString emojiFont() const + { if (emojiFont_ == "Default") { return tr("Default"); } - return emojiFont_; + return emojiFont_; } Presence presence() const { return presence_; } QString ringtone() const { return ringtone_; } -- cgit 1.4.1