mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Merge pull request #459 from Jedi18/minor_fixes
Fix emoji related issues
This commit is contained in:
commit
23a9306383
6 changed files with 44 additions and 5 deletions
|
@ -163,6 +163,10 @@ Rectangle {
|
||||||
TimelineManager.timeline.input.paste(false);
|
TimelineManager.timeline.input.paste(false);
|
||||||
event.accepted = true;
|
event.accepted = true;
|
||||||
} else if (event.key == Qt.Key_Space) {
|
} else if (event.key == Qt.Key_Space) {
|
||||||
|
// close popup if user enters space after colon
|
||||||
|
if(cursorPosition == completerTriggeredAt + 1)
|
||||||
|
popup.close();
|
||||||
|
|
||||||
if (popup.opened && popup.count <= 0)
|
if (popup.opened && popup.count <= 0)
|
||||||
popup.close();
|
popup.close();
|
||||||
|
|
||||||
|
@ -266,6 +270,11 @@ Rectangle {
|
||||||
target: TimelineManager.timeline
|
target: TimelineManager.timeline
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: TimelineManager
|
||||||
|
onFocusInput: messageInput.forceActiveFocus()
|
||||||
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
// workaround for wrong cursor shape on some platforms
|
// workaround for wrong cursor shape on some platforms
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -293,6 +302,7 @@ Rectangle {
|
||||||
ToolTip.text: qsTr("Emoji")
|
ToolTip.text: qsTr("Emoji")
|
||||||
onClicked: emojiPopup.visible ? emojiPopup.close() : emojiPopup.show(emojiButton, function(emoji) {
|
onClicked: emojiPopup.visible ? emojiPopup.close() : emojiPopup.show(emojiButton, function(emoji) {
|
||||||
messageInput.insert(messageInput.cursorPosition, emoji);
|
messageInput.insert(messageInput.cursorPosition, emoji);
|
||||||
|
TimelineManager.focusMessageInput()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,5 +14,6 @@ ImageButton {
|
||||||
image: ":/icons/icons/ui/smile.png"
|
image: ":/icons/icons/ui/smile.png"
|
||||||
onClicked: emojiPicker.visible ? emojiPicker.close() : emojiPicker.show(emojiButton, function(emoji) {
|
onClicked: emojiPicker.visible ? emojiPicker.close() : emojiPicker.show(emojiButton, function(emoji) {
|
||||||
TimelineManager.queueReactionMessage(event_id, emoji);
|
TimelineManager.queueReactionMessage(event_id, emoji);
|
||||||
|
TimelineManager.focusMessageInput()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ UserSettings::load(std::optional<QString> profile)
|
||||||
sortByImportance_ = settings.value("user/sort_by_unread", true).toBool();
|
sortByImportance_ = settings.value("user/sort_by_unread", true).toBool();
|
||||||
readReceipts_ = 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", "").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();
|
||||||
privacyScreen_ = settings.value("user/privacy_screen", false).toBool();
|
privacyScreen_ = settings.value("user/privacy_screen", false).toBool();
|
||||||
|
@ -101,7 +101,7 @@ UserSettings::load(std::optional<QString> profile)
|
||||||
shareKeysWithTrustedUsers_ =
|
shareKeysWithTrustedUsers_ =
|
||||||
settings.value("user/share_keys_with_trusted_users", true).toBool();
|
settings.value("user/share_keys_with_trusted_users", true).toBool();
|
||||||
mobileMode_ = settings.value("user/mobile_mode", false).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", "Default").toString();
|
||||||
baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble();
|
baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble();
|
||||||
auto tempPresence = settings.value("user/presence", "").toString().toStdString();
|
auto tempPresence = settings.value("user/presence", "").toString().toStdString();
|
||||||
auto presenceValue = QMetaEnum::fromType<Presence>().keyToValue(tempPresence.c_str());
|
auto presenceValue = QMetaEnum::fromType<Presence>().keyToValue(tempPresence.c_str());
|
||||||
|
@ -341,7 +341,13 @@ UserSettings::setEmojiFontFamily(QString family)
|
||||||
{
|
{
|
||||||
if (family == emojiFont_)
|
if (family == emojiFont_)
|
||||||
return;
|
return;
|
||||||
emojiFont_ = family;
|
|
||||||
|
if (family == tr("Default")) {
|
||||||
|
emojiFont_ = "Default";
|
||||||
|
} else {
|
||||||
|
emojiFont_ = family;
|
||||||
|
}
|
||||||
|
|
||||||
emit emojiFontChanged(family);
|
emit emojiFontChanged(family);
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
@ -725,11 +731,18 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
// TODO: Is there a way to limit to just emojis, rather than
|
// TODO: Is there a way to limit to just emojis, rather than
|
||||||
// all emoji fonts?
|
// all emoji fonts?
|
||||||
auto emojiFamilies = fontDb.families(QFontDatabase::Symbol);
|
auto emojiFamilies = fontDb.families(QFontDatabase::Symbol);
|
||||||
|
emojiFontSelectionCombo_->addItem(tr("Default"));
|
||||||
for (const auto &family : emojiFamilies) {
|
for (const auto &family : emojiFamilies) {
|
||||||
emojiFontSelectionCombo_->addItem(family);
|
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_->setCurrentIndex(
|
||||||
emojiFontSelectionCombo_->findText(settings_->emojiFont()));
|
emojiFontSelectionCombo_->findText(settings_->emojiFont()));
|
||||||
|
|
|
@ -177,7 +177,14 @@ public:
|
||||||
int timelineMaxWidth() const { return timelineMaxWidth_; }
|
int timelineMaxWidth() const { return timelineMaxWidth_; }
|
||||||
double fontSize() const { return baseFontSize_; }
|
double fontSize() const { return baseFontSize_; }
|
||||||
QString font() const { return font_; }
|
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_; }
|
Presence presence() const { return presence_; }
|
||||||
QString ringtone() const { return ringtone_; }
|
QString ringtone() const { return ringtone_; }
|
||||||
QString microphone() const { return microphone_; }
|
QString microphone() const { return microphone_; }
|
||||||
|
|
|
@ -541,3 +541,9 @@ TimelineViewManager::queueCallMessage(const QString &roomid,
|
||||||
{
|
{
|
||||||
models.value(roomid)->sendMessageEvent(callHangUp, mtx::events::EventType::CallHangUp);
|
models.value(roomid)->sendMessageEvent(callHangUp, mtx::events::EventType::CallHangUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TimelineViewManager::focusMessageInput()
|
||||||
|
{
|
||||||
|
emit focusInput();
|
||||||
|
}
|
|
@ -66,6 +66,7 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void openLink(QString link) const;
|
Q_INVOKABLE void openLink(QString link) const;
|
||||||
|
|
||||||
|
Q_INVOKABLE void focusMessageInput();
|
||||||
Q_INVOKABLE void openInviteUsersDialog();
|
Q_INVOKABLE void openInviteUsersDialog();
|
||||||
Q_INVOKABLE void openMemberListDialog() const;
|
Q_INVOKABLE void openMemberListDialog() const;
|
||||||
Q_INVOKABLE void openLeaveRoomDialog() const;
|
Q_INVOKABLE void openLeaveRoomDialog() const;
|
||||||
|
@ -87,6 +88,7 @@ signals:
|
||||||
void showRoomList();
|
void showRoomList();
|
||||||
void narrowViewChanged();
|
void narrowViewChanged();
|
||||||
void focusChanged();
|
void focusChanged();
|
||||||
|
void focusInput();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateReadReceipts(const QString &room_id, const std::vector<QString> &event_ids);
|
void updateReadReceipts(const QString &room_id, const std::vector<QString> &event_ids);
|
||||||
|
|
Loading…
Reference in a new issue