summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/ImageButton.qml2
-rw-r--r--resources/qml/MessageInput.qml2
-rw-r--r--resources/qml/RoomList.qml3
-rw-r--r--resources/qml/Root.qml15
-rw-r--r--resources/qml/ToggleButton.qml2
-rw-r--r--resources/qml/UserSettingsPage.qml218
-rw-r--r--resources/qml/dialogs/ImagePackEditorDialog.qml8
-rw-r--r--resources/qml/dialogs/ImagePackSettingsDialog.qml2
-rw-r--r--resources/qml/dialogs/RoomSettings.qml2
-rw-r--r--resources/res.qrc1
10 files changed, 245 insertions, 10 deletions
diff --git a/resources/qml/ImageButton.qml b/resources/qml/ImageButton.qml

index c68b6cde..ffd3e920 100644 --- a/resources/qml/ImageButton.qml +++ b/resources/qml/ImageButton.qml
@@ -16,6 +16,7 @@ AbstractButton { property color highlightColor: Nheko.colors.highlight property color buttonTextColor: Nheko.colors.buttonText property bool changeColorOnHover: true + property bool ripple: true focusPolicy: Qt.NoFocus width: 16 @@ -38,6 +39,7 @@ AbstractButton { } Ripple { + enabled: button.ripple color: Qt.rgba(buttonTextColor.r, buttonTextColor.g, buttonTextColor.b, 0.5) } diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml
index 87fad633..ceb2e1ea 100644 --- a/resources/qml/MessageInput.qml +++ b/resources/qml/MessageInput.qml
@@ -194,7 +194,7 @@ Rectangle { } room.input.send(); event.accepted = true; - } else if (event.key == Qt.Key_Tab) { + } else if (event.key == Qt.Key_Tab && (event.modifiers == Qt.NoModifier || event.modifiers == Qt.ShiftModifier)) { event.accepted = true; if (popup.opened) { if (event.modifiers & Qt.ShiftModifier) diff --git a/resources/qml/RoomList.qml b/resources/qml/RoomList.qml
index 2f8a2d43..6e7b683f 100644 --- a/resources/qml/RoomList.qml +++ b/resources/qml/RoomList.qml
@@ -678,6 +678,7 @@ Page { visible: !collapsed Layout.fillWidth: true hoverEnabled: true + ripple: false width: 22 height: 22 image: ":/icons/icons/ui/settings.svg" @@ -685,7 +686,7 @@ Page { ToolTip.delay: Nheko.tooltipDelay ToolTip.text: qsTr("User settings") Layout.margins: Nheko.paddingMedium - onClicked: Nheko.showUserSettingsPage() + onClicked: mainWindow.push(userSettingsPage); } } diff --git a/resources/qml/Root.qml b/resources/qml/Root.qml
index c85b641a..82025057 100644 --- a/resources/qml/Root.qml +++ b/resources/qml/Root.qml
@@ -144,6 +144,14 @@ Page { } + Component { + id: userSettingsPage + + UserSettingsPage { + } + + } + Shortcut { sequence: "Ctrl+K" onActivated: { @@ -353,8 +361,13 @@ Page { target: UIA } - ChatPage { + StackView { + id: mainWindow + anchors.fill: parent + initialItem: ChatPage { + //anchors.fill: parent + } } } diff --git a/resources/qml/ToggleButton.qml b/resources/qml/ToggleButton.qml
index 3859891a..98950b8a 100644 --- a/resources/qml/ToggleButton.qml +++ b/resources/qml/ToggleButton.qml
@@ -36,7 +36,7 @@ Switch { width: parent.height height: width radius: width / 2 - color: toggleButton.down ? "whitesmoke" : "whitesmoke" + color: toggleButton.enabled ? "whitesmoke" : "#cccccc" border.color: "#ebebeb" } diff --git a/resources/qml/UserSettingsPage.qml b/resources/qml/UserSettingsPage.qml new file mode 100644
index 00000000..025f44fa --- /dev/null +++ b/resources/qml/UserSettingsPage.qml
@@ -0,0 +1,218 @@ +// SPDX-FileCopyrightText: 2021 Nheko Contributors +// SPDX-FileCopyrightText: 2022 Nheko Contributors +// +// SPDX-License-Identifier: GPL-3.0-or-later + +import "ui" +import Qt.labs.platform 1.1 as Platform +import QtQuick 2.15 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.2 +import QtQuick.Window 2.13 +import im.nheko 1.0 + +Rectangle { + id: userSettingsDialog + + property bool collapsed: width < 800 + color: Nheko.colors.window + + Shortcut { + sequence: StandardKey.Cancel + onActivated: userSettingsDialog.close() + } + + ScrollView { + id: scroll + + palette: Nheko.colors + ScrollBar.horizontal.visible: false + anchors.fill: parent + anchors.margins: Nheko.paddingLarge + + contentWidth: availableWidth + + Timer { + id: deadTimer + interval: 500 + } + + Connections { + target: scroll.contentItem + function onContentYChanged() { deadTimer.restart(); } + } + + + GridLayout { + id: grid + + columns: userSettingsDialog.collapsed ? 1 : 2 + rowSpacing: Nheko.paddingMedium + columnSpacing: Nheko.paddingMedium + + anchors.fill: parent + anchors.leftMargin: userSettingsDialog.collapsed ? Nheko.paddingLarge : (userSettingsDialog.width-600) * 0.4 + anchors.rightMargin: userSettingsDialog.collapsed ? Nheko.paddingLarge : (userSettingsDialog.width-600) * 0.4 + + Repeater { + model: UserSettingsModel + + delegate: Item { + required property var model + id: r + + Component.onCompleted: { + while (children.length) { + console.log("Reparenting: " + children[0]); + children[0].parent = grid; + } + } + + Label { + Layout.alignment: Qt.AlignLeft + Layout.fillWidth: true + color: Nheko.colors.text + text: model.name + //Layout.column: 0 + Layout.columnSpan: (model.type == UserSettingsModel.SectionTitle && !userSettingsDialog.collapsed) ? 2 : 1 + //Layout.row: model.index + Layout.minimumWidth: implicitWidth + Layout.leftMargin: model.type == UserSettingsModel.SectionTitle ? 0 : Nheko.paddingMedium + Layout.topMargin: model.type == UserSettingsModel.SectionTitle ? Nheko.paddingLarge : 0 + font.pointSize: 1.1 * fontInfo.pointSize + + HoverHandler { + id: hovered + enabled: model.description ?? false + } + ToolTip.visible: hovered.hovered && model.description + ToolTip.text: model.description ?? "" + ToolTip.delay: Nheko.tooltipDelay + } + + DelegateChooser { + id: chooser + + roleValue: model.type + Layout.alignment: Qt.AlignRight + + //Layout.column: model.type == UserSettingsModel.SectionTitle ? 0 : 1 + Layout.columnSpan: (model.type == UserSettingsModel.SectionTitle && !userSettingsDialog.collapsed) ? 2 : 1 + //Layout.row: model.index + Layout.preferredHeight: child.height + Layout.preferredWidth: Math.min(child.implicitWidth, child.width || 1000) + Layout.fillWidth: model.type == UserSettingsModel.SectionTitle + Layout.rightMargin: model.type == UserSettingsModel.SectionTitle ? 0 : Nheko.paddingMedium + + DelegateChoice { + roleValue: UserSettingsModel.Toggle + ToggleButton { + checked: model.value + onCheckedChanged: model.value = checked + enabled: model.enabled + } + } + DelegateChoice { + roleValue: UserSettingsModel.Options + ComboBox { + Layout.preferredWidth: Math.min(200, implicitWidth) + width: Math.min(200, implicitWidth) + model: r.model.values + currentIndex: r.model.value + enabled: !deadTimer.running + onCurrentIndexChanged: r.model.value = currentIndex + } + } + DelegateChoice { + roleValue: UserSettingsModel.Number + + SpinBox { + //implicitWidth: 100 + enabled: !deadTimer.running && model.enabled + from: model.valueLowerBound + to: model.valueUpperBound + stepSize: model.valueStep + value: model.value + onValueChanged: model.value = value + } + } + DelegateChoice { + roleValue: UserSettingsModel.ReadOnlyText + Text { + color: Nheko.colors.text + text: model.value + } + } + DelegateChoice { + roleValue: UserSettingsModel.SectionTitle + Item { + width: grid.width + height: fontMetrics.lineSpacing + Rectangle { + anchors.topMargin: Nheko.paddingSmall + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + color: Nheko.colors.buttonText + height: 1 + } + } + } + DelegateChoice { + roleValue: UserSettingsModel.KeyStatus + Text { + color: model.good ? "green" : Nheko.theme.error + text: model.value ? qsTr("CACHED") : qsTr("NOT CACHED") + } + } + DelegateChoice { + roleValue: UserSettingsModel.SessionKeyImportExport + RowLayout { + Button { + text: qsTr("IMPORT") + onClicked: UserSettingsModel.importSessionKeys() + } + Button { + text: qsTr("EXPORT") + onClicked: UserSettingsModel.exportSessionKeys() + } + } + } + DelegateChoice { + roleValue: UserSettingsModel.XSignKeysRequestDownload + RowLayout { + Button { + text: qsTr("DOWNLOAD") + onClicked: UserSettingsModel.downloadCrossSigningSecrets() + } + Button { + text: qsTr("REQUEST") + onClicked: UserSettingsModel.requestCrossSigningSecrets() + } + } + } + DelegateChoice { + Text { + text: model.value + } + } + } + } + } + } + } + + ImageButton { + anchors.top: parent.top + anchors.left: parent.left + anchors.margins: Nheko.paddingMedium + width: Nheko.avatarSize + height: Nheko.avatarSize + image: ":/icons/icons/ui/angle-arrow-left.svg" + ToolTip.visible: hovered + ToolTip.text: qsTr("Back") + onClicked: mainWindow.pop() + } + +} + diff --git a/resources/qml/dialogs/ImagePackEditorDialog.qml b/resources/qml/dialogs/ImagePackEditorDialog.qml
index 852290f2..3ba04d94 100644 --- a/resources/qml/dialogs/ImagePackEditorDialog.qml +++ b/resources/qml/dialogs/ImagePackEditorDialog.qml
@@ -213,7 +213,7 @@ ApplicationWindow { ToggleButton { checked: imagePack.isEmotePack - onClicked: imagePack.isEmotePack = checked + onCheckedChanged: imagePack.isEmotePack = checked Layout.alignment: Qt.AlignRight } @@ -223,7 +223,7 @@ ApplicationWindow { ToggleButton { checked: imagePack.isStickerPack - onClicked: imagePack.isStickerPack = checked + onCheckedChanged: imagePack.isStickerPack = checked Layout.alignment: Qt.AlignRight } @@ -279,7 +279,7 @@ ApplicationWindow { ToggleButton { checked: imagePack.data(imagePack.index(currentImageIndex, 0), SingleImagePackModel.IsEmote) - onClicked: imagePack.setData(imagePack.index(currentImageIndex, 0), checked, SingleImagePackModel.IsEmote) + onCheckedChanged: imagePack.setData(imagePack.index(currentImageIndex, 0), checked, SingleImagePackModel.IsEmote) Layout.alignment: Qt.AlignRight } @@ -289,7 +289,7 @@ ApplicationWindow { ToggleButton { checked: imagePack.data(imagePack.index(currentImageIndex, 0), SingleImagePackModel.IsSticker) - onClicked: imagePack.setData(imagePack.index(currentImageIndex, 0), checked, SingleImagePackModel.IsSticker) + onCheckedChanged: imagePack.setData(imagePack.index(currentImageIndex, 0), checked, SingleImagePackModel.IsSticker) Layout.alignment: Qt.AlignRight } diff --git a/resources/qml/dialogs/ImagePackSettingsDialog.qml b/resources/qml/dialogs/ImagePackSettingsDialog.qml
index d6025f80..fa079855 100644 --- a/resources/qml/dialogs/ImagePackSettingsDialog.qml +++ b/resources/qml/dialogs/ImagePackSettingsDialog.qml
@@ -185,7 +185,7 @@ ApplicationWindow { ToggleButton { ToolTip.text: qsTr("Enables this pack to be used in all rooms") checked: currentPack ? currentPack.isGloballyEnabled : false - onClicked: currentPack.isGloballyEnabled = !currentPack.isGloballyEnabled + onCheckedChanged: currentPack.isGloballyEnabled = checked Layout.alignment: Qt.AlignRight } diff --git a/resources/qml/dialogs/RoomSettings.qml b/resources/qml/dialogs/RoomSettings.qml
index 0320beb7..c9f2b1a1 100644 --- a/resources/qml/dialogs/RoomSettings.qml +++ b/resources/qml/dialogs/RoomSettings.qml
@@ -214,7 +214,7 @@ ApplicationWindow { id: encryptionToggle checked: roomSettings.isEncryptionEnabled - onClicked: { + onCheckedChanged: { if (roomSettings.isEncryptionEnabled) { checked = true; return ; diff --git a/resources/res.qrc b/resources/res.qrc
index d825699a..660a48c7 100644 --- a/resources/res.qrc +++ b/resources/res.qrc
@@ -86,6 +86,7 @@ <file>qml/CommunitiesList.qml</file> <file>qml/RoomList.qml</file> <file>qml/TimelineView.qml</file> + <file>qml/UserSettingsPage.qml</file> <file>qml/Avatar.qml</file> <file>qml/Completer.qml</file> <file>qml/EncryptionIndicator.qml</file>