diff options
author | Miquel Lionel <lionel@les-miquelots.net> | 2021-11-04 05:38:46 +0100 |
---|---|---|
committer | Miquel Lionel <lionel@les-miquelots.net> | 2021-11-04 05:38:46 +0100 |
commit | b759e3578047b96968c9b9a817389d374850de59 (patch) | |
tree | e50ee76e23f72c6c850ec6ff3bdd67fd827e0586 | |
parent | a414601fcab42c883c1c5e391b76e91a92446f91 (diff) | |
download | kdeltachat-b759e3578047b96968c9b9a817389d374850de59.tar.gz kdeltachat-b759e3578047b96968c9b9a817389d374850de59.zip |
Implement sending Videochat invitations
- layers popping function was hard to
read in main.qml, add a line
- add editable videochat instance setting
-rw-r--r-- | context.cpp | 6 | ||||
-rw-r--r-- | context.h | 1 | ||||
-rw-r--r-- | qml/ComposePane.qml | 19 | ||||
-rw-r--r-- | qml/SettingsPage.qml | 7 | ||||
-rw-r--r-- | qml/main.qml | 3 |
5 files changed, 30 insertions, 6 deletions
diff --git a/context.cpp b/context.cpp index 802a555..59d8211 100644 --- a/context.cpp +++ b/context.cpp @@ -272,6 +272,12 @@ Context::sendMessage(uint32_t chatId, DcMessage *message) return dc_send_msg(m_context, chatId, message->m_message); } +uint32_t +Context::sendVChatInv(uint32_t chatId) +{ + return dc_send_videochat_invitation(m_context, chatId); +} + void Context::importBackup(QString tarfile) { @@ -54,6 +54,7 @@ public: Q_INVOKABLE QString getMessageHtml(uint32_t msgId); Q_INVOKABLE DcMessage *newMessage(int viewtype); Q_INVOKABLE uint32_t sendMessage(uint32_t chatId, DcMessage *message); + Q_INVOKABLE uint32_t sendVChatInv(uint32_t chatId); Q_INVOKABLE void importBackup(QString tarfile); private: diff --git a/qml/ComposePane.qml b/qml/ComposePane.qml index 976b4f1..1af4033 100644 --- a/qml/ComposePane.qml +++ b/qml/ComposePane.qml @@ -13,6 +13,7 @@ Pane { property var attachFileUrl: "" property bool canSend: root.chat && root.chat.canSend property bool isContactRequest: root.chat && root.chat.isContactRequest + readonly property string vChatUrl: root.context.getConfig("webrtc_instance") function createMessage() { let DC_MSG_TEXT = 10; @@ -100,24 +101,32 @@ Pane { Button { id: sendVChatUrl + enabled: vChatUrl.length > 0 ? true : false hoverEnabled: true ToolTip.visible: hovered ToolTip.text: "Send videochat invitation" text: "📞" + Layout.preferredWidth: attachButton.width / 2 + Layout.alignment: Qt.AlignBottom font.pixelSize: 20 + onClicked: { + if(vChatUrl.length > 0) + root.context.sendVChatInv(chatId); + } } Button { id: sendButton - action: Action { + action: Kirigami.Action { + checked: false shortcut: "Ctrl+S" onTriggered:{ if (sendButton.enabled) { root.focus = true; - focus = true; - down = true; - clicked(); - down = false; + sendButton.focus = true; + sendButton.down = true; + sendButton.clicked(); + sendButton.down = false; } } } diff --git a/qml/SettingsPage.qml b/qml/SettingsPage.qml index 1e28917..c963162 100644 --- a/qml/SettingsPage.qml +++ b/qml/SettingsPage.qml @@ -61,6 +61,13 @@ Kirigami.ScrollablePage { selectByMouse: true } + TextArea { + Kirigami.FormData.label: "Videochat instance: " + text: root.context.getConfig("webrtc_instance") + onEditingFinished: root.context.setConfig("webrtc_instance", text) + selectByMouse: true + } + Switch { text: "Prefer end-to-end encryption" checked: root.context.getConfig("e2ee_enabled") == "1" diff --git a/qml/main.qml b/qml/main.qml index f0798fd..34e94e8 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -162,7 +162,8 @@ Kirigami.ApplicationWindow { tooltip: "Alt+Tab" iconName: "system-users" onTriggered: { - while (pageStack.layers.depth > 1)pageStack.layers.pop() + while (pageStack.layers.depth > 1) + pageStack.layers.pop(); pageStack.layers.push(accountsPage); } }, |