summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2021-02-09 16:25:37 +0100
committerGitHub <noreply@github.com>2021-02-09 16:25:37 +0100
commit23a9306383a93a89cb859193bad6d8711c215b61 (patch)
tree6533ce41dc1a6b766519d3756f1cfe9e2dbe3462 /src
parentMerge pull request #450 from kallisti5/haiku-fixes (diff)
parentlinting fix (diff)
downloadnheko-23a9306383a93a89cb859193bad6d8711c215b61.tar.xz
Merge pull request #459 from Jedi18/minor_fixes
Fix emoji related issues
Diffstat (limited to 'src')
-rw-r--r--src/UserSettingsPage.cpp21
-rw-r--r--src/UserSettingsPage.h9
-rw-r--r--src/timeline/TimelineViewManager.cpp6
-rw-r--r--src/timeline/TimelineViewManager.h2
4 files changed, 33 insertions, 5 deletions
diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp
index d4e56b4d..820669a6 100644
--- a/src/UserSettingsPage.cpp
+++ b/src/UserSettingsPage.cpp
@@ -93,7 +93,7 @@ UserSettings::load(std::optional<QString> 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", "").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<QString> 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", "Default").toString();
         baseFontSize_      = settings.value("user/font_size", QFont().pointSizeF()).toDouble();
         auto tempPresence  = settings.value("user/presence", "").toString().toStdString();
         auto presenceValue = QMetaEnum::fromType<Presence>().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();
 }
@@ -725,11 +731,18 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> 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(tr("Default"));
         for (const auto &family : emojiFamilies) {
                 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..49de94b3 100644
--- a/src/UserSettingsPage.h
+++ b/src/UserSettingsPage.h
@@ -177,7 +177,14 @@ 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_; }
diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp
index dab735db..9e045e83 100644
--- a/src/timeline/TimelineViewManager.cpp
+++ b/src/timeline/TimelineViewManager.cpp
@@ -541,3 +541,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<QString> &event_ids);