summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authorNepNep21 <43792621+NepNep21@users.noreply.github.com>2023-10-24 19:46:04 -0300
committerNepNep21 <43792621+NepNep21@users.noreply.github.com>2023-10-24 19:46:04 -0300
commit0b28e7934d4647288d4704d6fa44259d47b79782 (patch)
tree2373dbec5a6d80b27e9b5b593f2655bdeaa04a57 /resources
parentCleanup ignore user functionality slightly (diff)
downloadnheko-0b28e7934d4647288d4704d6fa44259d47b79782.tar.xz
Move dialog to settings page and add avatar image to delegate
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/dialogs/IgnoredUsers.qml23
-rw-r--r--resources/qml/dialogs/UserProfile.qml20
-rw-r--r--resources/qml/pages/UserSettingsPage.qml18
3 files changed, 30 insertions, 31 deletions
diff --git a/resources/qml/dialogs/IgnoredUsers.qml b/resources/qml/dialogs/IgnoredUsers.qml
index ff1e528e..6527eb18 100644
--- a/resources/qml/dialogs/IgnoredUsers.qml
+++ b/resources/qml/dialogs/IgnoredUsers.qml
@@ -11,7 +11,6 @@ import im.nheko 1.0
 
 Window {
     id: ignoredUsers
-    required property var profile
 
     title: qsTr("Ignored users")
     flags: Qt.WindowCloseButtonHint | Qt.WindowTitleHint
@@ -20,14 +19,6 @@ Window {
     minimumHeight: 420
     color: palette.window
 
-    Connections {
-        target: profile
-        function onUnignoredUserError(id, err) {
-            const text = qsTr("Failed to unignore \"%1\": %2").arg(id).arg(err)
-            MainWindow.showNotification(text)
-        }
-    }
-
     ListView {
         id: view
         anchors.fill: parent
@@ -46,7 +37,17 @@ Window {
             Item { Layout.preferredHeight: Nheko.paddingLarge }
         }
         delegate: RowLayout {
+            property var profile: TimelineManager.getGlobalUserProfile(modelData)
+
             width: view.width
+
+            Avatar {
+                enabled: false
+                displayName: profile.displayName
+                userid: profile.userid
+                url: profile.avatarUrl.replace("mxc://", "image://MxcImage/")
+            }
+
             Text {
                 Layout.fillWidth: true
                 Layout.alignment: Qt.AlignLeft
@@ -62,8 +63,8 @@ Window {
                 hoverEnabled: true
                 ToolTip.visible: hovered
                 ToolTip.text: qsTr("Stop Ignoring.")
-                onClicked: profile.ignoredStatus(modelData, false)
+                onClicked: profile.ignored = false
             }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/resources/qml/dialogs/UserProfile.qml b/resources/qml/dialogs/UserProfile.qml
index 989c2bab..6cf747e3 100644
--- a/resources/qml/dialogs/UserProfile.qml
+++ b/resources/qml/dialogs/UserProfile.qml
@@ -310,26 +310,6 @@ ApplicationWindow {
                     ToolTip.text: qsTr("Refresh device list.")
                     onClicked: profile.refreshDevices()
                 }
-
-                ImageButton {
-                    Layout.preferredHeight: 24
-                    Layout.preferredWidth: 24
-                    image: ":/icons/icons/ui/volume-off-indicator.svg"
-                    hoverEnabled: true
-                    ToolTip.visible: hovered
-                    ToolTip.text: qsTr("Ignored users.")
-                    onClicked: {
-                        var component = Qt.createComponent("IgnoredUsers.qml")
-                        if (component.status == Component.Ready) {
-                            var window = component.createObject(userProfileDialog, { profile: profile})
-                            window.show()
-                            timelineRoot.destroyOnClose(window)
-                        } else {
-                            console.error("Failed to create component: " + component.errorString());
-                        }
-                    }
-                    visible: profile.isSelf && profile.isGlobalUserProfile
-                }
             }
 
             TabBar {
diff --git a/resources/qml/pages/UserSettingsPage.qml b/resources/qml/pages/UserSettingsPage.qml
index 7159a2f6..2dc4684d 100644
--- a/resources/qml/pages/UserSettingsPage.qml
+++ b/resources/qml/pages/UserSettingsPage.qml
@@ -234,6 +234,24 @@ Rectangle {
                         }
 
                         DelegateChoice {
+                            roleValue: UserSettingsModel.ManageIgnoredUsers
+                            Button {
+                                text: qsTr("MANAGE")
+                                onClicked: {
+                                    var dialog = ignoredUsersDialog.createObject();
+                                    dialog.show();
+                                    destroyOnClose(dialog);
+                                }
+
+                                Component {
+                                    id: ignoredUsersDialog
+
+                                    IgnoredUsers {}
+                                }
+                            }
+                        }
+
+                        DelegateChoice {
                             Text {
                                 text: model.value
                             }