diff --git a/resources/qml/device-verification/DeviceVerification.qml b/resources/qml/device-verification/DeviceVerification.qml index 90dc9ac4..ead293d2 100644 --- a/resources/qml/device-verification/DeviceVerification.qml +++ b/resources/qml/device-verification/DeviceVerification.qml @@ -14,21 +14,29 @@ ApplicationWindow { property var flow onClosing: VerificationManager.removeVerificationFlow(flow) - title: stack.currentItem.title_ + title: stack.currentItem ? (stack.currentItem.title_ || "") : "" modality: Qt.NonModal palette: Nheko.colors color: Nheko.colors.window - minimumHeight: stack.implicitHeight - width: stack.implicitWidth + //height: stack.currentItem.implicitHeight + minimumHeight: stack.currentItem.implicitHeight + 2 * Nheko.paddingLarge + height: stack.currentItem.implicitHeight + 2 * Nheko.paddingMedium + minimumWidth: 400 flags: Qt.Dialog | Qt.WindowCloseButtonHint | Qt.WindowTitleHint + background: Rectangle { + color: Nheko.colors.window + } + + StackView { id: stack - anchors.fill: parent + anchors.centerIn: parent + initialItem: newVerificationRequest - implicitWidth: currentItem.implicitWidth - implicitHeight: currentItem.implicitHeight + implicitWidth: dialog.width - 2* Nheko.paddingMedium + implicitHeight: dialog.height - 2* Nheko.paddingMedium } Component { @@ -86,7 +94,7 @@ ApplicationWindow { name: "PromptStartVerification" StateChangeScript { - script: stack.replace(newVerificationRequest) + script: stack.replace(null, newVerificationRequest) } }, @@ -94,7 +102,7 @@ ApplicationWindow { name: "CompareEmoji" StateChangeScript { - script: stack.replace(emojiVerification) + script: stack.replace(null, emojiVerification) } }, @@ -102,7 +110,7 @@ ApplicationWindow { name: "CompareNumber" StateChangeScript { - script: stack.replace(digitVerification) + script: stack.replace(null, digitVerification) } }, @@ -110,7 +118,7 @@ ApplicationWindow { name: "WaitingForKeys" StateChangeScript { - script: stack.replace(waiting) + script: stack.replace(null, waiting) } }, @@ -118,7 +126,7 @@ ApplicationWindow { name: "WaitingForOtherToAccept" StateChangeScript { - script: stack.replace(waiting) + script: stack.replace(null, waiting) } }, @@ -126,7 +134,7 @@ ApplicationWindow { name: "WaitingForMac" StateChangeScript { - script: stack.replace(waiting) + script: stack.replace(null, waiting) } }, @@ -134,7 +142,7 @@ ApplicationWindow { name: "Success" StateChangeScript { - script: stack.replace(success) + script: stack.replace(null, success) } }, @@ -142,7 +150,7 @@ ApplicationWindow { name: "Failed" StateChangeScript { - script: stack.replace(failed) + script: stack.replace(null, failed) } } diff --git a/resources/qml/device-verification/DigitVerification.qml b/resources/qml/device-verification/DigitVerification.qml index 3a8b0df5..e1f8f6cf 100644 --- a/resources/qml/device-verification/DigitVerification.qml +++ b/resources/qml/device-verification/DigitVerification.qml @@ -8,70 +8,63 @@ import QtQuick.Controls 2.3 import QtQuick.Layouts 1.10 import im.nheko 1.0 -Pane { +ColumnLayout { property string title: qsTr("Verification Code") - background: Rectangle { - color: Nheko.colors.window + + spacing: 16 + + Label { + Layout.preferredWidth: 400 + Layout.fillWidth: true + wrapMode: Text.Wrap + text: qsTr("Please verify the following digits. You should see the same numbers on both sides. If they differ, please press 'They do not match!' to abort verification!") + color: Nheko.colors.text + verticalAlignment: Text.AlignVCenter } - ColumnLayout { - anchors.fill: parent - spacing: 16 + Item { Layout.fillHeight: true; } + RowLayout { + Layout.alignment: Qt.AlignHCenter Label { - Layout.preferredWidth: 400 - Layout.fillWidth: true - wrapMode: Text.Wrap - text: qsTr("Please verify the following digits. You should see the same numbers on both sides. If they differ, please press 'They do not match!' to abort verification!") + font.pixelSize: Qt.application.font.pixelSize * 2 + text: flow.sasList[0] color: Nheko.colors.text - verticalAlignment: Text.AlignVCenter } - Item { Layout.fillHeight: true; } - RowLayout { - Layout.alignment: Qt.AlignHCenter - - Label { - font.pixelSize: Qt.application.font.pixelSize * 2 - text: flow.sasList[0] - color: Nheko.colors.text - } - - Label { - font.pixelSize: Qt.application.font.pixelSize * 2 - text: flow.sasList[1] - color: Nheko.colors.text - } - - Label { - font.pixelSize: Qt.application.font.pixelSize * 2 - text: flow.sasList[2] - color: Nheko.colors.text - } - + Label { + font.pixelSize: Qt.application.font.pixelSize * 2 + text: flow.sasList[1] + color: Nheko.colors.text } - Item { Layout.fillHeight: true; } - RowLayout { - Button { - Layout.alignment: Qt.AlignLeft - text: qsTr("They do not match!") - onClicked: { - flow.cancel(); - dialog.close(); - } + Label { + font.pixelSize: Qt.application.font.pixelSize * 2 + text: flow.sasList[2] + color: Nheko.colors.text + } + + } + Item { Layout.fillHeight: true; } + + RowLayout { + Button { + Layout.alignment: Qt.AlignLeft + text: qsTr("They do not match!") + onClicked: { + flow.cancel(); + dialog.close(); } + } - Item { - Layout.fillWidth: true - } - - Button { - Layout.alignment: Qt.AlignRight - text: qsTr("They match!") - onClicked: flow.next() - } + Item { + Layout.fillWidth: true + } + Button { + Layout.alignment: Qt.AlignRight + text: qsTr("They match!") + onClicked: flow.next() } } diff --git a/resources/qml/device-verification/EmojiVerification.qml b/resources/qml/device-verification/EmojiVerification.qml index 4c5bfb1a..e97a18a2 100644 --- a/resources/qml/device-verification/EmojiVerification.qml +++ b/resources/qml/device-verification/EmojiVerification.qml @@ -8,386 +8,379 @@ import QtQuick.Controls 2.3 import QtQuick.Layouts 1.10 import im.nheko 1.0 -Pane { +ColumnLayout { property string title: qsTr("Verification Code") - background: Rectangle { - color: Nheko.colors.window + + spacing: 16 + + Label { + Layout.preferredWidth: 400 + Layout.fillWidth: true + wrapMode: Text.Wrap + text: qsTr("Please verify the following emoji. You should see the same emoji on both sides. If they differ, please press 'They do not match!' to abort verification!") + color: Nheko.colors.text + verticalAlignment: Text.AlignVCenter } - ColumnLayout { - anchors.fill: parent - spacing: 16 + Item { Layout.fillHeight: true; } + RowLayout { + id: emojis - Label { - Layout.preferredWidth: 400 - Layout.fillWidth: true - wrapMode: Text.Wrap - text: qsTr("Please verify the following emoji. You should see the same emoji on both sides. If they differ, please press 'They do not match!' to abort verification!") - color: Nheko.colors.text - verticalAlignment: Text.AlignVCenter - } + property var mapping: [{ + "number": 0, + "emoji": "🐢", + "description": "Dog", + "unicode": "U+1F436" + }, { + "number": 1, + "emoji": "🐱", + "description": "Cat", + "unicode": "U+1F431" + }, { + "number": 2, + "emoji": "🦁", + "description": "Lion", + "unicode": "U+1F981" + }, { + "number": 3, + "emoji": "🐎", + "description": "Horse", + "unicode": "U+1F40E" + }, { + "number": 4, + "emoji": "πŸ¦„", + "description": "Unicorn", + "unicode": "U+1F984" + }, { + "number": 5, + "emoji": "🐷", + "description": "Pig", + "unicode": "U+1F437" + }, { + "number": 6, + "emoji": "🐘", + "description": "Elephant", + "unicode": "U+1F418" + }, { + "number": 7, + "emoji": "🐰", + "description": "Rabbit", + "unicode": "U+1F430" + }, { + "number": 8, + "emoji": "🐼", + "description": "Panda", + "unicode": "U+1F43C" + }, { + "number": 9, + "emoji": "πŸ“", + "description": "Rooster", + "unicode": "U+1F413" + }, { + "number": 10, + "emoji": "🐧", + "description": "Penguin", + "unicode": "U+1F427" + }, { + "number": 11, + "emoji": "🐒", + "description": "Turtle", + "unicode": "U+1F422" + }, { + "number": 12, + "emoji": "🐟", + "description": "Fish", + "unicode": "U+1F41F" + }, { + "number": 13, + "emoji": "πŸ™", + "description": "Octopus", + "unicode": "U+1F419" + }, { + "number": 14, + "emoji": "πŸ¦‹", + "description": "Butterfly", + "unicode": "U+1F98B" + }, { + "number": 15, + "emoji": "🌷", + "description": "Flower", + "unicode": "U+1F337" + }, { + "number": 16, + "emoji": "🌳", + "description": "Tree", + "unicode": "U+1F333" + }, { + "number": 17, + "emoji": "🌡", + "description": "Cactus", + "unicode": "U+1F335" + }, { + "number": 18, + "emoji": "πŸ„", + "description": "Mushroom", + "unicode": "U+1F344" + }, { + "number": 19, + "emoji": "🌏", + "description": "Globe", + "unicode": "U+1F30F" + }, { + "number": 20, + "emoji": "πŸŒ™", + "description": "Moon", + "unicode": "U+1F319" + }, { + "number": 21, + "emoji": "☁️", + "description": "Cloud", + "unicode": "U+2601U+FE0F" + }, { + "number": 22, + "emoji": "πŸ”₯", + "description": "Fire", + "unicode": "U+1F525" + }, { + "number": 23, + "emoji": "🍌", + "description": "Banana", + "unicode": "U+1F34C" + }, { + "number": 24, + "emoji": "🍎", + "description": "Apple", + "unicode": "U+1F34E" + }, { + "number": 25, + "emoji": "πŸ“", + "description": "Strawberry", + "unicode": "U+1F353" + }, { + "number": 26, + "emoji": "🌽", + "description": "Corn", + "unicode": "U+1F33D" + }, { + "number": 27, + "emoji": "πŸ•", + "description": "Pizza", + "unicode": "U+1F355" + }, { + "number": 28, + "emoji": "πŸŽ‚", + "description": "Cake", + "unicode": "U+1F382" + }, { + "number": 29, + "emoji": "❀️", + "description": "Heart", + "unicode": "U+2764U+FE0F" + }, { + "number": 30, + "emoji": "πŸ˜€", + "description": "Smiley", + "unicode": "U+1F600" + }, { + "number": 31, + "emoji": "πŸ€–", + "description": "Robot", + "unicode": "U+1F916" + }, { + "number": 32, + "emoji": "🎩", + "description": "Hat", + "unicode": "U+1F3A9" + }, { + "number": 33, + "emoji": "πŸ‘“", + "description": "Glasses", + "unicode": "U+1F453" + }, { + "number": 34, + "emoji": "πŸ”§", + "description": "Spanner", + "unicode": "U+1F527" + }, { + "number": 35, + "emoji": "πŸŽ…", + "description": "Santa", + "unicode": "U+1F385" + }, { + "number": 36, + "emoji": "πŸ‘", + "description": "Thumbs Up", + "unicode": "U+1F44D" + }, { + "number": 37, + "emoji": "β˜‚οΈ", + "description": "Umbrella", + "unicode": "U+2602U+FE0F" + }, { + "number": 38, + "emoji": "βŒ›", + "description": "Hourglass", + "unicode": "U+231B" + }, { + "number": 39, + "emoji": "⏰", + "description": "Clock", + "unicode": "U+23F0" + }, { + "number": 40, + "emoji": "🎁", + "description": "Gift", + "unicode": "U+1F381" + }, { + "number": 41, + "emoji": "πŸ’‘", + "description": "Light Bulb", + "unicode": "U+1F4A1" + }, { + "number": 42, + "emoji": "πŸ“•", + "description": "Book", + "unicode": "U+1F4D5" + }, { + "number": 43, + "emoji": "✏️", + "description": "Pencil", + "unicode": "U+270FU+FE0F" + }, { + "number": 44, + "emoji": "πŸ“Ž", + "description": "Paperclip", + "unicode": "U+1F4CE" + }, { + "number": 45, + "emoji": "βœ‚οΈ", + "description": "Scissors", + "unicode": "U+2702U+FE0F" + }, { + "number": 46, + "emoji": "πŸ”’", + "description": "Lock", + "unicode": "U+1F512" + }, { + "number": 47, + "emoji": "πŸ”‘", + "description": "Key", + "unicode": "U+1F511" + }, { + "number": 48, + "emoji": "πŸ”¨", + "description": "Hammer", + "unicode": "U+1F528" + }, { + "number": 49, + "emoji": "☎️", + "description": "Telephone", + "unicode": "U+260EU+FE0F" + }, { + "number": 50, + "emoji": "🏁", + "description": "Flag", + "unicode": "U+1F3C1" + }, { + "number": 51, + "emoji": "πŸš‚", + "description": "Train", + "unicode": "U+1F682" + }, { + "number": 52, + "emoji": "🚲", + "description": "Bicycle", + "unicode": "U+1F6B2" + }, { + "number": 53, + "emoji": "✈️", + "description": "Aeroplane", + "unicode": "U+2708U+FE0F" + }, { + "number": 54, + "emoji": "πŸš€", + "description": "Rocket", + "unicode": "U+1F680" + }, { + "number": 55, + "emoji": "πŸ†", + "description": "Trophy", + "unicode": "U+1F3C6" + }, { + "number": 56, + "emoji": "⚽", + "description": "Ball", + "unicode": "U+26BD" + }, { + "number": 57, + "emoji": "🎸", + "description": "Guitar", + "unicode": "U+1F3B8" + }, { + "number": 58, + "emoji": "🎺", + "description": "Trumpet", + "unicode": "U+1F3BA" + }, { + "number": 59, + "emoji": "πŸ””", + "description": "Bell", + "unicode": "U+1F514" + }, { + "number": 60, + "emoji": "βš“", + "description": "Anchor", + "unicode": "U+2693" + }, { + "number": 61, + "emoji": "🎧", + "description": "Headphones", + "unicode": "U+1F3A7" + }, { + "number": 62, + "emoji": "πŸ“", + "description": "Folder", + "unicode": "U+1F4C1" + }, { + "number": 63, + "emoji": "πŸ“Œ", + "description": "Pin", + "unicode": "U+1F4CC" + }] - Item { Layout.fillHeight: true; } - RowLayout { - id: emojis + Layout.alignment: Qt.AlignHCenter - property var mapping: [{ - "number": 0, - "emoji": "🐢", - "description": "Dog", - "unicode": "U+1F436" - }, { - "number": 1, - "emoji": "🐱", - "description": "Cat", - "unicode": "U+1F431" - }, { - "number": 2, - "emoji": "🦁", - "description": "Lion", - "unicode": "U+1F981" - }, { - "number": 3, - "emoji": "🐎", - "description": "Horse", - "unicode": "U+1F40E" - }, { - "number": 4, - "emoji": "πŸ¦„", - "description": "Unicorn", - "unicode": "U+1F984" - }, { - "number": 5, - "emoji": "🐷", - "description": "Pig", - "unicode": "U+1F437" - }, { - "number": 6, - "emoji": "🐘", - "description": "Elephant", - "unicode": "U+1F418" - }, { - "number": 7, - "emoji": "🐰", - "description": "Rabbit", - "unicode": "U+1F430" - }, { - "number": 8, - "emoji": "🐼", - "description": "Panda", - "unicode": "U+1F43C" - }, { - "number": 9, - "emoji": "πŸ“", - "description": "Rooster", - "unicode": "U+1F413" - }, { - "number": 10, - "emoji": "🐧", - "description": "Penguin", - "unicode": "U+1F427" - }, { - "number": 11, - "emoji": "🐒", - "description": "Turtle", - "unicode": "U+1F422" - }, { - "number": 12, - "emoji": "🐟", - "description": "Fish", - "unicode": "U+1F41F" - }, { - "number": 13, - "emoji": "πŸ™", - "description": "Octopus", - "unicode": "U+1F419" - }, { - "number": 14, - "emoji": "πŸ¦‹", - "description": "Butterfly", - "unicode": "U+1F98B" - }, { - "number": 15, - "emoji": "🌷", - "description": "Flower", - "unicode": "U+1F337" - }, { - "number": 16, - "emoji": "🌳", - "description": "Tree", - "unicode": "U+1F333" - }, { - "number": 17, - "emoji": "🌡", - "description": "Cactus", - "unicode": "U+1F335" - }, { - "number": 18, - "emoji": "πŸ„", - "description": "Mushroom", - "unicode": "U+1F344" - }, { - "number": 19, - "emoji": "🌏", - "description": "Globe", - "unicode": "U+1F30F" - }, { - "number": 20, - "emoji": "πŸŒ™", - "description": "Moon", - "unicode": "U+1F319" - }, { - "number": 21, - "emoji": "☁️", - "description": "Cloud", - "unicode": "U+2601U+FE0F" - }, { - "number": 22, - "emoji": "πŸ”₯", - "description": "Fire", - "unicode": "U+1F525" - }, { - "number": 23, - "emoji": "🍌", - "description": "Banana", - "unicode": "U+1F34C" - }, { - "number": 24, - "emoji": "🍎", - "description": "Apple", - "unicode": "U+1F34E" - }, { - "number": 25, - "emoji": "πŸ“", - "description": "Strawberry", - "unicode": "U+1F353" - }, { - "number": 26, - "emoji": "🌽", - "description": "Corn", - "unicode": "U+1F33D" - }, { - "number": 27, - "emoji": "πŸ•", - "description": "Pizza", - "unicode": "U+1F355" - }, { - "number": 28, - "emoji": "πŸŽ‚", - "description": "Cake", - "unicode": "U+1F382" - }, { - "number": 29, - "emoji": "❀️", - "description": "Heart", - "unicode": "U+2764U+FE0F" - }, { - "number": 30, - "emoji": "πŸ˜€", - "description": "Smiley", - "unicode": "U+1F600" - }, { - "number": 31, - "emoji": "πŸ€–", - "description": "Robot", - "unicode": "U+1F916" - }, { - "number": 32, - "emoji": "🎩", - "description": "Hat", - "unicode": "U+1F3A9" - }, { - "number": 33, - "emoji": "πŸ‘“", - "description": "Glasses", - "unicode": "U+1F453" - }, { - "number": 34, - "emoji": "πŸ”§", - "description": "Spanner", - "unicode": "U+1F527" - }, { - "number": 35, - "emoji": "πŸŽ…", - "description": "Santa", - "unicode": "U+1F385" - }, { - "number": 36, - "emoji": "πŸ‘", - "description": "Thumbs Up", - "unicode": "U+1F44D" - }, { - "number": 37, - "emoji": "β˜‚οΈ", - "description": "Umbrella", - "unicode": "U+2602U+FE0F" - }, { - "number": 38, - "emoji": "βŒ›", - "description": "Hourglass", - "unicode": "U+231B" - }, { - "number": 39, - "emoji": "⏰", - "description": "Clock", - "unicode": "U+23F0" - }, { - "number": 40, - "emoji": "🎁", - "description": "Gift", - "unicode": "U+1F381" - }, { - "number": 41, - "emoji": "πŸ’‘", - "description": "Light Bulb", - "unicode": "U+1F4A1" - }, { - "number": 42, - "emoji": "πŸ“•", - "description": "Book", - "unicode": "U+1F4D5" - }, { - "number": 43, - "emoji": "✏️", - "description": "Pencil", - "unicode": "U+270FU+FE0F" - }, { - "number": 44, - "emoji": "πŸ“Ž", - "description": "Paperclip", - "unicode": "U+1F4CE" - }, { - "number": 45, - "emoji": "βœ‚οΈ", - "description": "Scissors", - "unicode": "U+2702U+FE0F" - }, { - "number": 46, - "emoji": "πŸ”’", - "description": "Lock", - "unicode": "U+1F512" - }, { - "number": 47, - "emoji": "πŸ”‘", - "description": "Key", - "unicode": "U+1F511" - }, { - "number": 48, - "emoji": "πŸ”¨", - "description": "Hammer", - "unicode": "U+1F528" - }, { - "number": 49, - "emoji": "☎️", - "description": "Telephone", - "unicode": "U+260EU+FE0F" - }, { - "number": 50, - "emoji": "🏁", - "description": "Flag", - "unicode": "U+1F3C1" - }, { - "number": 51, - "emoji": "πŸš‚", - "description": "Train", - "unicode": "U+1F682" - }, { - "number": 52, - "emoji": "🚲", - "description": "Bicycle", - "unicode": "U+1F6B2" - }, { - "number": 53, - "emoji": "✈️", - "description": "Aeroplane", - "unicode": "U+2708U+FE0F" - }, { - "number": 54, - "emoji": "πŸš€", - "description": "Rocket", - "unicode": "U+1F680" - }, { - "number": 55, - "emoji": "πŸ†", - "description": "Trophy", - "unicode": "U+1F3C6" - }, { - "number": 56, - "emoji": "⚽", - "description": "Ball", - "unicode": "U+26BD" - }, { - "number": 57, - "emoji": "🎸", - "description": "Guitar", - "unicode": "U+1F3B8" - }, { - "number": 58, - "emoji": "🎺", - "description": "Trumpet", - "unicode": "U+1F3BA" - }, { - "number": 59, - "emoji": "πŸ””", - "description": "Bell", - "unicode": "U+1F514" - }, { - "number": 60, - "emoji": "βš“", - "description": "Anchor", - "unicode": "U+2693" - }, { - "number": 61, - "emoji": "🎧", - "description": "Headphones", - "unicode": "U+1F3A7" - }, { - "number": 62, - "emoji": "πŸ“", - "description": "Folder", - "unicode": "U+1F4C1" - }, { - "number": 63, - "emoji": "πŸ“Œ", - "description": "Pin", - "unicode": "U+1F4CC" - }] + Repeater { + id: repeater - Layout.alignment: Qt.AlignHCenter + model: 7 - Repeater { - id: repeater + delegate: Rectangle { + color: "transparent" + implicitHeight: Qt.application.font.pixelSize * 8 + implicitWidth: col.width - model: 7 + ColumnLayout { + id: col - delegate: Rectangle { - color: "transparent" - implicitHeight: Qt.application.font.pixelSize * 8 - implicitWidth: col.width + property var emoji: emojis.mapping[flow.sasList[index]] - ColumnLayout { - id: col + Layout.fillWidth: true + anchors.bottom: parent.bottom - property var emoji: emojis.mapping[flow.sasList[index]] - - Layout.fillWidth: true - anchors.bottom: parent.bottom - - Label { - //height: font.pixelSize * 2 - Layout.alignment: Qt.AlignHCenter - text: col.emoji.emoji - font.pixelSize: Qt.application.font.pixelSize * 2 - font.family: Settings.emojiFont - color: Nheko.colors.text - } - - Label { - Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom - text: col.emoji.description - color: Nheko.colors.text - } + Label { + //height: font.pixelSize * 2 + Layout.alignment: Qt.AlignHCenter + text: col.emoji.emoji + font.pixelSize: Qt.application.font.pixelSize * 2 + font.family: Settings.emojiFont + color: Nheko.colors.text + } + Label { + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + text: col.emoji.description + color: Nheko.colors.text } } @@ -395,28 +388,28 @@ Pane { } } - Item { Layout.fillHeight: true; } - RowLayout { - Button { - Layout.alignment: Qt.AlignLeft - text: qsTr("They do not match!") - onClicked: { - flow.cancel(); - dialog.close(); - } + } + Item { Layout.fillHeight: true; } + + RowLayout { + Button { + Layout.alignment: Qt.AlignLeft + text: qsTr("They do not match!") + onClicked: { + flow.cancel(); + dialog.close(); } + } - Item { - Layout.fillWidth: true - } - - Button { - Layout.alignment: Qt.AlignRight - text: qsTr("They match!") - onClicked: flow.next() - } + Item { + Layout.fillWidth: true + } + Button { + Layout.alignment: Qt.AlignRight + text: qsTr("They match!") + onClicked: flow.next() } } diff --git a/resources/qml/device-verification/Failed.qml b/resources/qml/device-verification/Failed.qml index d070b5a6..77327a75 100644 --- a/resources/qml/device-verification/Failed.qml +++ b/resources/qml/device-verification/Failed.qml @@ -8,57 +8,49 @@ import QtQuick.Controls 2.3 import QtQuick.Layouts 1.10 import im.nheko 1.0 -Pane { +ColumnLayout { property string title: qsTr("Verification failed") - background: Rectangle { - color: Nheko.colors.window - } + spacing: 16 - ColumnLayout { - anchors.fill: parent - spacing: 16 + Text { + id: content - Text { - id: content - - Layout.preferredWidth: 400 - Layout.fillWidth: true - wrapMode: Text.Wrap - text: { - switch (flow.error) { + Layout.preferredWidth: 400 + Layout.fillWidth: true + wrapMode: Text.Wrap + text: { + switch (flow.error) { case DeviceVerificationFlow.UnknownMethod: - return qsTr("Other client does not support our verification protocol."); + return qsTr("Other client does not support our verification protocol."); case DeviceVerificationFlow.MismatchedCommitment: case DeviceVerificationFlow.MismatchedSAS: case DeviceVerificationFlow.KeyMismatch: - return qsTr("Key mismatch detected!"); + return qsTr("Key mismatch detected!"); case DeviceVerificationFlow.Timeout: - return qsTr("Device verification timed out."); + return qsTr("Device verification timed out."); case DeviceVerificationFlow.User: - return qsTr("Other party canceled the verification."); + return qsTr("Other party canceled the verification."); case DeviceVerificationFlow.OutOfOrder: - return qsTr("Verification messages received out of order!"); + return qsTr("Verification messages received out of order!"); default: - return qsTr("Unknown verification error."); - } + return qsTr("Unknown verification error."); } - color: Nheko.colors.text - verticalAlignment: Text.AlignVCenter + } + color: Nheko.colors.text + verticalAlignment: Text.AlignVCenter + } + + Item { Layout.fillHeight: true; } + + RowLayout { + Item { + Layout.fillWidth: true } - Item { Layout.fillHeight: true; } - - RowLayout { - Item { - Layout.fillWidth: true - } - - Button { - Layout.alignment: Qt.AlignRight - text: qsTr("Close") - onClicked: dialog.close() - } - + Button { + Layout.alignment: Qt.AlignRight + text: qsTr("Close") + onClicked: dialog.close() } } diff --git a/resources/qml/device-verification/NewVerificationRequest.qml b/resources/qml/device-verification/NewVerificationRequest.qml index b7ed9586..3367f181 100644 --- a/resources/qml/device-verification/NewVerificationRequest.qml +++ b/resources/qml/device-verification/NewVerificationRequest.qml @@ -8,66 +8,59 @@ import QtQuick.Controls 2.3 import QtQuick.Layouts 1.10 import im.nheko 1.0 -Pane { +ColumnLayout { property string title: flow.sender ? qsTr("Send Verification Request") : qsTr("Received Verification Request") - background: Rectangle { - color: Nheko.colors.window + + spacing: 16 + + Label { + // Self verification + + Layout.preferredWidth: 400 + Layout.fillWidth: true + wrapMode: Text.Wrap + text: { + if (flow.sender) { + if (flow.isSelfVerification) + if (flow.isMultiDeviceVerification) + return qsTr("To allow other users to see, which of your devices actually belong to you, you can verify them. This also allows key backup to work automatically. Verify an unverified device now? (Please make sure you have one of those devices available.)"); + else + return qsTr("To allow other users to see, which of your devices actually belong to you, you can verify them. This also allows key backup to work automatically. Verify %1 now?").arg(flow.deviceId); + else + return qsTr("To ensure that no malicious user can eavesdrop on your encrypted communications you can verify the other party."); + } else { + if (!flow.isSelfVerification && flow.isDeviceVerification) + return qsTr("%1 has requested to verify their device %2.").arg(flow.userId).arg(flow.deviceId); + else if (!flow.isSelfVerification && !flow.isDeviceVerification) + return qsTr("%1 using the device %2 has requested to be verified.").arg(flow.userId).arg(flow.deviceId); + else + return qsTr("Your device (%1) has requested to be verified.").arg(flow.deviceId); + } + } + color: Nheko.colors.text + verticalAlignment: Text.AlignVCenter } - ColumnLayout { - anchors.fill: parent - spacing: 16 + Item { Layout.fillHeight: true; } - Label { - // Self verification - - Layout.preferredWidth: 400 - Layout.fillWidth: true - wrapMode: Text.Wrap - text: { - if (flow.sender) { - if (flow.isSelfVerification) - if (flow.isMultiDeviceVerification) - return qsTr("To allow other users to see, which of your devices actually belong to you, you can verify them. This also allows key backup to work automatically. Verify an unverified device now? (Please make sure you have one of those devices available.)"); - else - return qsTr("To allow other users to see, which of your devices actually belong to you, you can verify them. This also allows key backup to work automatically. Verify %1 now?").arg(flow.deviceId); - else - return qsTr("To ensure that no malicious user can eavesdrop on your encrypted communications you can verify the other party."); - } else { - if (!flow.isSelfVerification && flow.isDeviceVerification) - return qsTr("%1 has requested to verify their device %2.").arg(flow.userId).arg(flow.deviceId); - else if (!flow.isSelfVerification && !flow.isDeviceVerification) - return qsTr("%1 using the device %2 has requested to be verified.").arg(flow.userId).arg(flow.deviceId); - else - return qsTr("Your device (%1) has requested to be verified.").arg(flow.deviceId); - } + RowLayout { + Button { + Layout.alignment: Qt.AlignLeft + text: flow.sender ? qsTr("Cancel") : qsTr("Deny") + onClicked: { + flow.cancel(); + dialog.close(); } - color: Nheko.colors.text - verticalAlignment: Text.AlignVCenter } - Item { Layout.fillHeight: true; } - - RowLayout { - Button { - Layout.alignment: Qt.AlignLeft - text: flow.sender ? qsTr("Cancel") : qsTr("Deny") - onClicked: { - flow.cancel(); - dialog.close(); - } - } - - Item { - Layout.fillWidth: true - } - - Button { - Layout.alignment: Qt.AlignRight - text: flow.sender ? qsTr("Start verification") : qsTr("Accept") - onClicked: flow.next() - } + Item { + Layout.fillWidth: true + } + Button { + Layout.alignment: Qt.AlignRight + text: flow.sender ? qsTr("Start verification") : qsTr("Accept") + onClicked: flow.next() } } diff --git a/resources/qml/device-verification/Success.qml b/resources/qml/device-verification/Success.qml index 8d7c8419..d9365194 100644 --- a/resources/qml/device-verification/Success.qml +++ b/resources/qml/device-verification/Success.qml @@ -8,40 +8,33 @@ import QtQuick.Controls 2.3 import QtQuick.Layouts 1.10 import im.nheko 1.0 -Pane { +ColumnLayout { property string title: qsTr("Successful Verification") - background: Rectangle { - color: Nheko.colors.window + + spacing: 16 + + Label { + id: content + + Layout.preferredWidth: 400 + Layout.fillWidth: true + wrapMode: Text.Wrap + text: qsTr("Verification successful! Both sides verified their devices!") + color: Nheko.colors.text + verticalAlignment: Text.AlignVCenter } - ColumnLayout { - anchors.fill: parent - spacing: 16 + Item { Layout.fillHeight: true; } - Label { - id: content - - Layout.preferredWidth: 400 + RowLayout { + Item { Layout.fillWidth: true - wrapMode: Text.Wrap - text: qsTr("Verification successful! Both sides verified their devices!") - color: Nheko.colors.text - verticalAlignment: Text.AlignVCenter } - Item { Layout.fillHeight: true; } - - RowLayout { - Item { - Layout.fillWidth: true - } - - Button { - Layout.alignment: Qt.AlignRight - text: qsTr("Close") - onClicked: dialog.close() - } - + Button { + Layout.alignment: Qt.AlignRight + text: qsTr("Close") + onClicked: dialog.close() } } diff --git a/resources/qml/device-verification/Waiting.qml b/resources/qml/device-verification/Waiting.qml index e75a97ce..3054b9c3 100644 --- a/resources/qml/device-verification/Waiting.qml +++ b/resources/qml/device-verification/Waiting.qml @@ -9,59 +9,54 @@ import QtQuick.Controls 2.3 import QtQuick.Layouts 1.10 import im.nheko 1.0 -Pane { +ColumnLayout { property string title: qsTr("Waiting for other party…") - background: Rectangle { - color: Nheko.colors.window - } + spacing: 16 - ColumnLayout { - anchors.fill: parent - spacing: 16 + Label { + id: content - Label { - id: content - - Layout.preferredWidth: 400 - Layout.fillWidth: true - wrapMode: Text.Wrap - text: { - switch (flow.state) { + Layout.preferredWidth: 400 + Layout.fillWidth: true + wrapMode: Text.Wrap + text: { + switch (flow.state) { case "WaitingForOtherToAccept": return qsTr("Waiting for other side to accept the verification request."); case "WaitingForKeys": return qsTr("Waiting for other side to continue the verification process."); case "WaitingForMac": return qsTr("Waiting for other side to complete the verification process."); - } + default: + return ""; + } + } + color: Nheko.colors.text + verticalAlignment: Text.AlignVCenter + } + + Item { Layout.fillHeight: true; } + Spinner { + Layout.alignment: Qt.AlignHCenter + foreground: Nheko.colors.mid + } + Item { Layout.fillHeight: true; } + + RowLayout { + Button { + Layout.alignment: Qt.AlignLeft + text: qsTr("Cancel") + onClicked: { + flow.cancel(); + dialog.close(); } - color: Nheko.colors.text - verticalAlignment: Text.AlignVCenter } - Item { Layout.fillHeight: true; } - Spinner { - Layout.alignment: Qt.AlignHCenter - foreground: Nheko.colors.mid - } - Item { Layout.fillHeight: true; } - - RowLayout { - Button { - Layout.alignment: Qt.AlignLeft - text: qsTr("Cancel") - onClicked: { - flow.cancel(); - dialog.close(); - } - } - - Item { - Layout.fillWidth: true - } - + Item { + Layout.fillWidth: true } } } +