mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Move dialog to settings page and add avatar image to delegate
This commit is contained in:
parent
a0a49b6c2a
commit
0b28e7934d
5 changed files with 38 additions and 31 deletions
|
@ -11,7 +11,6 @@ import im.nheko 1.0
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
id: ignoredUsers
|
id: ignoredUsers
|
||||||
required property var profile
|
|
||||||
|
|
||||||
title: qsTr("Ignored users")
|
title: qsTr("Ignored users")
|
||||||
flags: Qt.WindowCloseButtonHint | Qt.WindowTitleHint
|
flags: Qt.WindowCloseButtonHint | Qt.WindowTitleHint
|
||||||
|
@ -20,14 +19,6 @@ Window {
|
||||||
minimumHeight: 420
|
minimumHeight: 420
|
||||||
color: palette.window
|
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 {
|
ListView {
|
||||||
id: view
|
id: view
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -46,7 +37,17 @@ Window {
|
||||||
Item { Layout.preferredHeight: Nheko.paddingLarge }
|
Item { Layout.preferredHeight: Nheko.paddingLarge }
|
||||||
}
|
}
|
||||||
delegate: RowLayout {
|
delegate: RowLayout {
|
||||||
|
property var profile: TimelineManager.getGlobalUserProfile(modelData)
|
||||||
|
|
||||||
width: view.width
|
width: view.width
|
||||||
|
|
||||||
|
Avatar {
|
||||||
|
enabled: false
|
||||||
|
displayName: profile.displayName
|
||||||
|
userid: profile.userid
|
||||||
|
url: profile.avatarUrl.replace("mxc://", "image://MxcImage/")
|
||||||
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignLeft
|
Layout.alignment: Qt.AlignLeft
|
||||||
|
@ -62,7 +63,7 @@ Window {
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
ToolTip.text: qsTr("Stop Ignoring.")
|
ToolTip.text: qsTr("Stop Ignoring.")
|
||||||
onClicked: profile.ignoredStatus(modelData, false)
|
onClicked: profile.ignored = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,26 +310,6 @@ ApplicationWindow {
|
||||||
ToolTip.text: qsTr("Refresh device list.")
|
ToolTip.text: qsTr("Refresh device list.")
|
||||||
onClicked: profile.refreshDevices()
|
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 {
|
TabBar {
|
||||||
|
|
|
@ -233,6 +233,24 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DelegateChoice {
|
||||||
|
roleValue: UserSettingsModel.ManageIgnoredUsers
|
||||||
|
Button {
|
||||||
|
text: qsTr("MANAGE")
|
||||||
|
onClicked: {
|
||||||
|
var dialog = ignoredUsersDialog.createObject();
|
||||||
|
dialog.show();
|
||||||
|
destroyOnClose(dialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: ignoredUsersDialog
|
||||||
|
|
||||||
|
IgnoredUsers {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DelegateChoice {
|
DelegateChoice {
|
||||||
Text {
|
Text {
|
||||||
text: model.value
|
text: model.value
|
||||||
|
|
|
@ -1043,6 +1043,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
return tr("Read receipts");
|
return tr("Read receipts");
|
||||||
case HiddenTimelineEvents:
|
case HiddenTimelineEvents:
|
||||||
return tr("Hidden events");
|
return tr("Hidden events");
|
||||||
|
case IgnoredUsers:
|
||||||
|
return tr("Ignored users");
|
||||||
case DesktopNotifications:
|
case DesktopNotifications:
|
||||||
return tr("Desktop notifications");
|
return tr("Desktop notifications");
|
||||||
case AlertOnNotification:
|
case AlertOnNotification:
|
||||||
|
@ -1486,6 +1488,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
return tr("Regularly redact expired events as specified in the event expiration "
|
return tr("Regularly redact expired events as specified in the event expiration "
|
||||||
"configuration. Since this is currently not executed server side, you need "
|
"configuration. Since this is currently not executed server side, you need "
|
||||||
"to have one client running this regularly.");
|
"to have one client running this regularly.");
|
||||||
|
case IgnoredUsers:
|
||||||
|
return tr("Manage your ignored users.");
|
||||||
}
|
}
|
||||||
} else if (role == Type) {
|
} else if (role == Type) {
|
||||||
switch (index.row()) {
|
switch (index.row()) {
|
||||||
|
@ -1572,6 +1576,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
return KeyStatus;
|
return KeyStatus;
|
||||||
case HiddenTimelineEvents:
|
case HiddenTimelineEvents:
|
||||||
return ConfigureHiddenEvents;
|
return ConfigureHiddenEvents;
|
||||||
|
case IgnoredUsers:
|
||||||
|
return ManageIgnoredUsers;
|
||||||
}
|
}
|
||||||
} else if (role == ValueLowerBound) {
|
} else if (role == ValueLowerBound) {
|
||||||
switch (index.row()) {
|
switch (index.row()) {
|
||||||
|
|
|
@ -508,6 +508,7 @@ class UserSettingsModel : public QAbstractListModel
|
||||||
MessageVisibilitySection,
|
MessageVisibilitySection,
|
||||||
ExpireEvents,
|
ExpireEvents,
|
||||||
HiddenTimelineEvents,
|
HiddenTimelineEvents,
|
||||||
|
IgnoredUsers,
|
||||||
|
|
||||||
NotificationsSection,
|
NotificationsSection,
|
||||||
DesktopNotifications,
|
DesktopNotifications,
|
||||||
|
@ -566,6 +567,7 @@ public:
|
||||||
SessionKeyImportExport,
|
SessionKeyImportExport,
|
||||||
XSignKeysRequestDownload,
|
XSignKeysRequestDownload,
|
||||||
ConfigureHiddenEvents,
|
ConfigureHiddenEvents,
|
||||||
|
ManageIgnoredUsers,
|
||||||
};
|
};
|
||||||
Q_ENUM(Types);
|
Q_ENUM(Types);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue