diff --git a/resources/langs/nheko_de.ts b/resources/langs/nheko_de.ts index 41e518b0..5251742f 100644 --- a/resources/langs/nheko_de.ts +++ b/resources/langs/nheko_de.ts @@ -4,13 +4,13 @@ ChatPage - + Failed to invite user: %1 Nutzer konnte nicht eingeladen werden: %1 - + Invited user: %1 Eingeladener Benutzer: %1 @@ -50,12 +50,12 @@ - + Failed to upload media. Please try again. Medienupload fehlgeschlagen. Bitte versuche es erneut. - + Failed to restore OLM account. Please login again. Wiederherstellung des OLM Accounts fehlgeschlagen. Bitte logge dich erneut ein. @@ -479,7 +479,7 @@ TimelineModel - + -- Encrypted Event (No keys found for decryption) -- Placeholder, when the message was not decrypted yet or can't be decrypted -- Verschlüsseltes Event (keine Schlüssel zur Entschlüsselung gefunden) -- @@ -672,7 +672,7 @@ TimelineRow - + Reply Antworten @@ -685,7 +685,12 @@ TimelineView - + + Reply + Antworten + + + Read receipts Lesebestätigungen @@ -715,7 +720,7 @@ Kein Raum geöffnet - + Close Schließen @@ -777,7 +782,7 @@ UserSettingsPage - + Minimize to tray Ins Benachrichtigungsfeld minimieren @@ -798,6 +803,11 @@ + Show buttons in timeline + + + + Typing notifications Schreibbenachrichtigungen @@ -847,7 +857,7 @@ Gerätefingerabdruck - + Session Keys Sitzungsschlüssel @@ -867,22 +877,22 @@ VERSCHLÜSSELUNG - + GENERAL ALLGEMEINES - + INTERFACE - + Emoji Font Family - + Open Sessions File Öffne Sessions Datei diff --git a/resources/langs/nheko_el.ts b/resources/langs/nheko_el.ts index 0398f066..0f75ca9f 100644 --- a/resources/langs/nheko_el.ts +++ b/resources/langs/nheko_el.ts @@ -4,13 +4,13 @@ ChatPage - + Failed to invite user: %1 - + Invited user: %1 @@ -50,12 +50,12 @@ - + Failed to upload media. Please try again. - + Failed to restore OLM account. Please login again. @@ -479,7 +479,7 @@ TimelineModel - + -- Encrypted Event (No keys found for decryption) -- Placeholder, when the message was not decrypted yet or can't be decrypted @@ -672,7 +672,7 @@ TimelineRow - + Reply @@ -685,7 +685,12 @@ TimelineView - + + Reply + + + + Read receipts @@ -715,7 +720,7 @@ - + Close @@ -777,7 +782,7 @@ UserSettingsPage - + Minimize to tray Ελαχιστοποίηση @@ -798,6 +803,11 @@ + Show buttons in timeline + + + + Typing notifications @@ -847,7 +857,7 @@ - + Session Keys @@ -867,22 +877,22 @@ - + GENERAL ΓΕΝΙΚΑ - + INTERFACE - + Emoji Font Family - + Open Sessions File diff --git a/resources/langs/nheko_en.ts b/resources/langs/nheko_en.ts index 638e0a89..f01bd5d0 100644 --- a/resources/langs/nheko_en.ts +++ b/resources/langs/nheko_en.ts @@ -4,13 +4,13 @@ ChatPage - + Failed to invite user: %1 Failed to invite user: %1 - + Invited user: %1 Invited user: %1 @@ -50,12 +50,12 @@ Unbanned user: %1 - + Failed to upload media. Please try again. Failed to upload media. Please try again. - + Failed to restore OLM account. Please login again. Failed to restore OLM account. Please login again. @@ -479,7 +479,7 @@ TimelineModel - + -- Encrypted Event (No keys found for decryption) -- Placeholder, when the message was not decrypted yet or can't be decrypted -- Encrypted Event (No keys found for decryption) -- @@ -672,7 +672,7 @@ TimelineRow - + Reply Reply @@ -685,7 +685,12 @@ TimelineView - + + Reply + Reply + + + Read receipts Read receipts @@ -715,7 +720,7 @@ No room open - + Close Close @@ -777,7 +782,7 @@ UserSettingsPage - + Minimize to tray Minimize to tray @@ -798,6 +803,11 @@ + Show buttons in timeline + + + + Typing notifications Typing notifications @@ -847,7 +857,7 @@ Device Fingerprint - + Session Keys Session Keys @@ -867,22 +877,22 @@ ENCRYPTION - + GENERAL GENERAL - + INTERFACE - + Emoji Font Family - + Open Sessions File Open Sessions File diff --git a/resources/langs/nheko_fi.ts b/resources/langs/nheko_fi.ts index bf7dd6f0..5cc9b9fe 100644 --- a/resources/langs/nheko_fi.ts +++ b/resources/langs/nheko_fi.ts @@ -4,13 +4,13 @@ ChatPage - + Failed to invite user: %1 - + Invited user: %1 @@ -50,12 +50,12 @@ - + Failed to upload media. Please try again. - + Failed to restore OLM account. Please login again. OLM-tilin palauttaminen epäonnistui. Ole hyvä ja kirjaudu sisään uudelleen. @@ -479,7 +479,7 @@ TimelineModel - + -- Encrypted Event (No keys found for decryption) -- Placeholder, when the message was not decrypted yet or can't be decrypted -- Salattu viesti (salauksen purkuavaimia ei löydetty) -- @@ -672,7 +672,7 @@ TimelineRow - + Reply @@ -685,7 +685,12 @@ TimelineView - + + Reply + + + + Read receipts Lukukuittaukset @@ -715,7 +720,7 @@ - + Close Sulje @@ -777,7 +782,7 @@ UserSettingsPage - + Minimize to tray Pienennä ilmoitusalueelle @@ -798,6 +803,11 @@ + Show buttons in timeline + + + + Typing notifications Kirjoitusilmoitukset @@ -847,7 +857,7 @@ Laitteen sormenjälki - + Session Keys Istunnon avaimet @@ -867,22 +877,22 @@ SALAUS - + GENERAL YLEISET ASETUKSET - + INTERFACE - + Emoji Font Family - + Open Sessions File Avaa Istuntoavaintiedosto diff --git a/resources/langs/nheko_fr.ts b/resources/langs/nheko_fr.ts index 19236b11..7af4f89e 100644 --- a/resources/langs/nheko_fr.ts +++ b/resources/langs/nheko_fr.ts @@ -4,13 +4,13 @@ ChatPage - + Failed to invite user: %1 - + Invited user: %1 @@ -50,12 +50,12 @@ - + Failed to upload media. Please try again. - + Failed to restore OLM account. Please login again. @@ -480,7 +480,7 @@ TimelineModel - + -- Encrypted Event (No keys found for decryption) -- Placeholder, when the message was not decrypted yet or can't be decrypted @@ -673,7 +673,7 @@ TimelineRow - + Reply @@ -686,7 +686,12 @@ TimelineView - + + Reply + + + + Read receipts Accusés de lecture @@ -716,7 +721,7 @@ - + Close @@ -778,7 +783,7 @@ UserSettingsPage - + Minimize to tray Réduire à la barre des tâches @@ -799,6 +804,11 @@ + Show buttons in timeline + + + + Typing notifications Notifications d'écriture @@ -848,7 +858,7 @@ - + Session Keys @@ -868,22 +878,22 @@ - + GENERAL GÉNÉRAL - + INTERFACE - + Emoji Font Family - + Open Sessions File diff --git a/resources/langs/nheko_ja.ts b/resources/langs/nheko_ja.ts index c0891f1f..8ee5a053 100644 --- a/resources/langs/nheko_ja.ts +++ b/resources/langs/nheko_ja.ts @@ -4,13 +4,13 @@ ChatPage - + Failed to invite user: %1 ユーザーを招待できませんでした: %1 - + Invited user: %1 招待されたユーザー: %1 @@ -50,12 +50,12 @@ 永久追放を解除されたユーザー: %1 - + Failed to upload media. Please try again. メディアをアップロードできませんでした。やり直して下さい。 - + Failed to restore OLM account. Please login again. OLMアカウントを復元できませんでした。もう一度ログインして下さい。 @@ -479,7 +479,7 @@ TimelineModel - + -- Encrypted Event (No keys found for decryption) -- Placeholder, when the message was not decrypted yet or can't be decrypted -- 暗号化イベント (復号鍵が見つかりません) -- @@ -671,7 +671,7 @@ TimelineRow - + Reply 返信 @@ -684,7 +684,12 @@ TimelineView - + + Reply + 返信 + + + Read receipts 開封確認 @@ -714,7 +719,7 @@ 部屋が開いていません - + Close 閉じる @@ -776,7 +781,7 @@ UserSettingsPage - + Minimize to tray トレイへ最小化 @@ -797,6 +802,11 @@ + Show buttons in timeline + + + + Typing notifications 入力状態の通知 @@ -846,7 +856,7 @@ デバイスの指紋 - + Session Keys セッション鍵 @@ -866,22 +876,22 @@ 暗号化 - + GENERAL 全般 - + INTERFACE - + Emoji Font Family - + Open Sessions File セッションファイルを開く diff --git a/resources/langs/nheko_nl.ts b/resources/langs/nheko_nl.ts index 3cb64e6c..b07971bc 100644 --- a/resources/langs/nheko_nl.ts +++ b/resources/langs/nheko_nl.ts @@ -4,13 +4,13 @@ ChatPage - + Failed to invite user: %1 - + Invited user: %1 @@ -50,12 +50,12 @@ - + Failed to upload media. Please try again. - + Failed to restore OLM account. Please login again. @@ -479,7 +479,7 @@ TimelineModel - + -- Encrypted Event (No keys found for decryption) -- Placeholder, when the message was not decrypted yet or can't be decrypted @@ -672,7 +672,7 @@ TimelineRow - + Reply @@ -685,7 +685,12 @@ TimelineView - + + Reply + + + + Read receipts Leesbevestigingen @@ -715,7 +720,7 @@ - + Close @@ -777,7 +782,7 @@ UserSettingsPage - + Minimize to tray Minimaliseren naar systeemvak @@ -798,6 +803,11 @@ + Show buttons in timeline + + + + Typing notifications Meldingen bij typen van berichten @@ -847,7 +857,7 @@ - + Session Keys @@ -867,22 +877,22 @@ - + GENERAL ALGEMEEN - + INTERFACE - + Emoji Font Family - + Open Sessions File diff --git a/resources/langs/nheko_pl.ts b/resources/langs/nheko_pl.ts index f6764e82..f28164dc 100644 --- a/resources/langs/nheko_pl.ts +++ b/resources/langs/nheko_pl.ts @@ -4,13 +4,13 @@ ChatPage - + Failed to invite user: %1 - + Invited user: %1 @@ -50,12 +50,12 @@ - + Failed to upload media. Please try again. - + Failed to restore OLM account. Please login again. Nie udało się przywrócić konta OLM. Spróbuj zalogować się ponownie. @@ -479,7 +479,7 @@ TimelineModel - + -- Encrypted Event (No keys found for decryption) -- Placeholder, when the message was not decrypted yet or can't be decrypted @@ -673,7 +673,7 @@ TimelineRow - + Reply @@ -686,7 +686,12 @@ TimelineView - + + Reply + + + + Read receipts Potwierdzenia przeczytania @@ -716,7 +721,7 @@ - + Close @@ -778,7 +783,7 @@ UserSettingsPage - + Minimize to tray Zminimalizuj do paska zadań @@ -799,6 +804,11 @@ + Show buttons in timeline + + + + Typing notifications Powiadomienia o pisaniu @@ -848,7 +858,7 @@ Odcisk palca urządzenia - + Session Keys @@ -868,22 +878,22 @@ SZYFROWANIE - + GENERAL OGÓLNE - + INTERFACE - + Emoji Font Family - + Open Sessions File diff --git a/resources/langs/nheko_ru.ts b/resources/langs/nheko_ru.ts index a2c8c951..8dde197e 100644 --- a/resources/langs/nheko_ru.ts +++ b/resources/langs/nheko_ru.ts @@ -4,13 +4,13 @@ ChatPage - + Failed to invite user: %1 - + Invited user: %1 @@ -50,12 +50,12 @@ - + Failed to upload media. Please try again. - + Failed to restore OLM account. Please login again. Не удалось восстановить учетную запись OLM. Пожалуйста, войдите снова. @@ -479,7 +479,7 @@ TimelineModel - + -- Encrypted Event (No keys found for decryption) -- Placeholder, when the message was not decrypted yet or can't be decrypted @@ -673,7 +673,7 @@ TimelineRow - + Reply @@ -686,7 +686,12 @@ TimelineView - + + Reply + + + + Read receipts Подтверждать прочтение @@ -716,7 +721,7 @@ - + Close Закрыть @@ -778,7 +783,7 @@ UserSettingsPage - + Minimize to tray Сворачивать в системную панель @@ -799,6 +804,11 @@ + Show buttons in timeline + + + + Typing notifications Сообщать о наборе сообщения @@ -848,7 +858,7 @@ Отпечаток устройства - + Session Keys Ключи сеанса @@ -868,22 +878,22 @@ ШИФРОВАНИЕ - + GENERAL ГЛАВНОЕ - + INTERFACE - + Emoji Font Family - + Open Sessions File Открыть файл сеансов diff --git a/resources/langs/nheko_zh_CN.ts b/resources/langs/nheko_zh_CN.ts index 0ed3153e..3b7138bb 100644 --- a/resources/langs/nheko_zh_CN.ts +++ b/resources/langs/nheko_zh_CN.ts @@ -4,13 +4,13 @@ ChatPage - + Failed to invite user: %1 - + Invited user: %1 @@ -50,12 +50,12 @@ - + Failed to upload media. Please try again. - + Failed to restore OLM account. Please login again. 恢复 OLM 账户失败。请重新登录。 @@ -479,7 +479,7 @@ TimelineModel - + -- Encrypted Event (No keys found for decryption) -- Placeholder, when the message was not decrypted yet or can't be decrypted @@ -671,7 +671,7 @@ TimelineRow - + Reply @@ -684,7 +684,12 @@ TimelineView - + + Reply + + + + Read receipts 阅读回执 @@ -714,7 +719,7 @@ - + Close @@ -776,7 +781,7 @@ UserSettingsPage - + Minimize to tray 最小化至托盘 @@ -797,6 +802,11 @@ + Show buttons in timeline + + + + Typing notifications 打字通知 @@ -846,7 +856,7 @@ 设备指纹 - + Session Keys 会话密钥 @@ -866,22 +876,22 @@ 加密 - + GENERAL 通用 - + INTERFACE - + Emoji Font Family - + Open Sessions File 打开会话文件 diff --git a/resources/qml/Avatar.qml b/resources/qml/Avatar.qml index 0a53eac9..54875f9f 100644 --- a/resources/qml/Avatar.qml +++ b/resources/qml/Avatar.qml @@ -1,6 +1,5 @@ import QtQuick 2.6 import QtGraphicalEffects 1.0 -import Qt.labs.settings 1.0 Rectangle { id: avatar @@ -8,12 +7,6 @@ Rectangle { height: 48 radius: settings.avatar_circles ? height/2 : 3 - Settings { - id: settings - category: "user" - property bool avatar_circles: true - } - property alias url: img.source property string displayName diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml index 2984844f..a9ae5f5c 100644 --- a/resources/qml/TimelineRow.qml +++ b/resources/qml/TimelineRow.qml @@ -8,36 +8,21 @@ import im.nheko 1.0 import "./delegates" MouseArea { - id: rowArea - anchors.left: parent.left anchors.right: parent.right height: row.height - - hoverEnabled: true - preventStealing: true propagateComposedEvents: true - acceptedButtons: Qt.NoButton + preventStealing: true - property bool showButtons: false - - Timer { - running: rowArea.containsMouse - interval: 150 - onTriggered: rowArea.state = "showButtons" + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + if (mouse.button === Qt.RightButton) + messageContextMenu.show(model.id, model.type, row) + } + onPressAndHold: { + if (mouse.source === Qt.MouseEventNotSynthesized) + messageContextMenu.show(model.id, model.type, row) } - - states: [ - State { - name: "hideButtons" - when: !rowArea.containsMouse - PropertyChanges { target: rowArea; showButtons: false; } - }, - State { - name: "showButtons" - PropertyChanges { target: rowArea; showButtons: true; } - } - ] RowLayout { id: row @@ -70,7 +55,7 @@ MouseArea { } ImageButton { - visible: rowArea.showButtons + visible: timelineSettings.buttons Layout.alignment: Qt.AlignRight | Qt.AlignTop Layout.preferredHeight: 16 width: 16 @@ -86,7 +71,7 @@ MouseArea { onClicked: chat.model.replyAction(model.id) } ImageButton { - visible: rowArea.showButtons + visible: timelineSettings.buttons Layout.alignment: Qt.AlignRight | Qt.AlignTop Layout.preferredHeight: 16 width: 16 @@ -125,6 +110,7 @@ MouseArea { id: ma anchors.fill: parent hoverEnabled: true + propagateComposedEvents: true } ToolTip.visible: ma.containsMouse diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 46cf484b..5612b04c 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -3,6 +3,7 @@ import QtQuick.Controls 2.3 import QtQuick.Layouts 1.2 import QtGraphicalEffects 1.0 import QtQuick.Window 2.2 +import Qt.labs.settings 1.0 import im.nheko 1.0 @@ -14,6 +15,18 @@ Item { property var inactiveColors: currentInactivePalette ? currentInactivePalette : systemInactive property int avatarSize: 40 + Settings { + id: settings + category: "user" + property bool avatar_circles: true + } + + Settings { + id: timelineSettings + category: "user/timeline" + property bool buttons: true + } + Menu { id: messageContextMenu palette: colors @@ -28,6 +41,10 @@ Item { property string eventId property int eventType + MenuItem { + text: qsTr("Reply") + onClicked: chat.model.replyAction(messageContextMenu.eventId) + } MenuItem { text: qsTr("Read receipts") onTriggered: chat.model.readReceiptsAction(messageContextMenu.eventId) @@ -212,6 +229,7 @@ Item { anchors.fill: parent onClicked: chat.model.openUserProfile(modelData.userId) cursorShape: Qt.PointingHandCursor + propagateComposedEvents: true } } @@ -225,6 +243,7 @@ Item { anchors.fill: parent onClicked: chat.model.openUserProfile(section.split(" ")[0]) cursorShape: Qt.PointingHandCursor + propagateComposedEvents: true } } } diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index 2cac783c..930b1b7b 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -55,6 +55,7 @@ UserSettings::load() hasDesktopNotifications_ = settings.value("user/desktop_notifications", true).toBool(); isStartInTrayEnabled_ = settings.value("user/window/start_in_tray", false).toBool(); isGroupViewEnabled_ = settings.value("user/group_view", true).toBool(); + isButtonsInTimelineEnabled_ = settings.value("user/timeline/buttons", true).toBool(); isMarkdownEnabled_ = settings.value("user/markdown_enabled", true).toBool(); isTypingNotificationsEnabled_ = settings.value("user/typing_notifications", true).toBool(); isReadReceiptsEnabled_ = settings.value("user/read_receipts", true).toBool(); @@ -126,6 +127,10 @@ UserSettings::save() settings.setValue("start_in_tray", isStartInTrayEnabled_); settings.endGroup(); + settings.beginGroup("timeline"); + settings.setValue("buttons", isButtonsInTimelineEnabled_); + settings.endGroup(); + settings.setValue("avatar_circles", avatarCircles_); settings.setValue("font_size", baseFontSize_); @@ -190,6 +195,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge startInTrayToggle_ = new Toggle{this}; avatarCircles_ = new Toggle{this}; groupViewToggle_ = new Toggle{this}; + timelineButtonsToggle_ = new Toggle{this}; typingNotifications_ = new Toggle{this}; readReceipts_ = new Toggle{this}; markdownEnabled_ = new Toggle{this}; @@ -292,6 +298,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge formLayout_->addRow(new HorizontalLine{this}); boxWrap(tr("Circular Avatars"), avatarCircles_); boxWrap(tr("Group's sidebar"), groupViewToggle_); + boxWrap(tr("Show buttons in timeline"), timelineButtonsToggle_); boxWrap(tr("Typing notifications"), typingNotifications_); formLayout_->addRow(new HorizontalLine{this}); boxWrap(tr("Read receipts"), readReceipts_); @@ -394,6 +401,10 @@ UserSettingsPage::UserSettingsPage(QSharedPointer settings, QWidge settings_->setTypingNotifications(!isDisabled); }); + connect(timelineButtonsToggle_, &Toggle::toggled, this, [this](bool isDisabled) { + settings_->setButtonsInTimeline(!isDisabled); + }); + connect(readReceipts_, &Toggle::toggled, this, [this](bool isDisabled) { settings_->setReadReceipts(!isDisabled); }); @@ -428,6 +439,7 @@ UserSettingsPage::showEvent(QShowEvent *) groupViewToggle_->setState(!settings_->isGroupViewEnabled()); avatarCircles_->setState(!settings_->isAvatarCirclesEnabled()); typingNotifications_->setState(!settings_->isTypingNotificationsEnabled()); + timelineButtonsToggle_->setState(!settings_->isButtonsInTimelineEnabled()); readReceipts_->setState(!settings_->isReadReceiptsEnabled()); markdownEnabled_->setState(!settings_->isMarkdownEnabled()); desktopNotifications_->setState(!settings_->hasDesktopNotifications()); diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h index a1b7b084..ca5a213c 100644 --- a/src/UserSettingsPage.h +++ b/src/UserSettingsPage.h @@ -87,6 +87,12 @@ public: save(); } + void setButtonsInTimeline(bool state) + { + isButtonsInTimelineEnabled_ = state; + save(); + } + void setDesktopNotifications(bool state) { hasDesktopNotifications_ = state; @@ -106,6 +112,7 @@ public: bool isAvatarCirclesEnabled() const { return avatarCircles_; } bool isMarkdownEnabled() const { return isMarkdownEnabled_; } bool isTypingNotificationsEnabled() const { return isTypingNotificationsEnabled_; } + bool isButtonsInTimelineEnabled() const { return isButtonsInTimelineEnabled_; } bool isReadReceiptsEnabled() const { return isReadReceiptsEnabled_; } bool hasDesktopNotifications() const { return hasDesktopNotifications_; } double fontSize() const { return baseFontSize_; } @@ -127,6 +134,7 @@ private: bool isGroupViewEnabled_; bool isMarkdownEnabled_; bool isTypingNotificationsEnabled_; + bool isButtonsInTimelineEnabled_; bool isReadReceiptsEnabled_; bool hasDesktopNotifications_; bool avatarCircles_; @@ -175,6 +183,7 @@ private: Toggle *trayToggle_; Toggle *startInTrayToggle_; Toggle *groupViewToggle_; + Toggle *timelineButtonsToggle_; Toggle *typingNotifications_; Toggle *readReceipts_; Toggle *markdownEnabled_;