Improve room settings dialog.
This commit is contained in:
@@ -15,7 +15,9 @@ Dialog {
|
||||
readonly property bool canChangeCanonicalAlias: room.canSendState("m.room.canonical_alias")
|
||||
|
||||
anchors.centerIn: parent
|
||||
|
||||
width: 480
|
||||
height: window.height * 0.9
|
||||
|
||||
id: root
|
||||
|
||||
@@ -85,6 +87,42 @@ Dialog {
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
|
||||
visible: canChangeName || canChangeTopic
|
||||
|
||||
text: "Save"
|
||||
highlighted: true
|
||||
|
||||
onClicked: {
|
||||
if (room.name != roomNameField.text) {
|
||||
room.setName(roomNameField.text)
|
||||
}
|
||||
|
||||
if (room.topic != roomTopicField.text) {
|
||||
room.setTopic(roomTopicField.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MenuSeparator {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
id: scrollview
|
||||
|
||||
clip: true
|
||||
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
|
||||
ColumnLayout {
|
||||
width: scrollview.width
|
||||
|
||||
Control {
|
||||
Layout.fillWidth: true
|
||||
|
||||
@@ -110,7 +148,7 @@ Dialog {
|
||||
|
||||
font.bold: true
|
||||
color: MPalette.foreground
|
||||
text: "This room is a continuation of another conversation."
|
||||
text: "This room continues another conversation."
|
||||
}
|
||||
|
||||
Label {
|
||||
@@ -161,7 +199,7 @@ Dialog {
|
||||
|
||||
font.bold: true
|
||||
color: MPalette.foreground
|
||||
text: "This room has been replaced and is no longer active."
|
||||
text: "This room has been replaced."
|
||||
}
|
||||
|
||||
Label {
|
||||
@@ -187,32 +225,6 @@ Dialog {
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
|
||||
visible: canChangeName || canChangeTopic
|
||||
|
||||
text: "Save"
|
||||
highlighted: true
|
||||
|
||||
onClicked: {
|
||||
if (room.name != roomNameField.text) {
|
||||
room.setName(roomNameField.text)
|
||||
}
|
||||
|
||||
if (room.topic != roomTopicField.text) {
|
||||
room.setTopic(roomTopicField.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MenuSeparator {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
||||
@@ -328,6 +340,7 @@ Dialog {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: openFileDialog
|
||||
|
||||
@@ -106,6 +106,21 @@ void RoomListModel::connectRoomSignals(SpectralRoom* room) {
|
||||
sender->displayname(), room->eventToString(*lastEvent),
|
||||
room->avatar(128));
|
||||
});
|
||||
connect(room, &Room::highlightCountChanged, this, [=] {
|
||||
if (room->highlightCount() == 0)
|
||||
return;
|
||||
if (room->timelineSize() == 0)
|
||||
return;
|
||||
const RoomEvent* lastEvent = room->messageEvents().rbegin()->get();
|
||||
if (lastEvent->isStateEvent())
|
||||
return;
|
||||
User* sender = room->user(lastEvent->senderId());
|
||||
if (sender == room->localUser())
|
||||
return;
|
||||
emit newHighlight(room->id(), lastEvent->id(), room->displayName(),
|
||||
sender->displayname(), room->eventToString(*lastEvent),
|
||||
room->avatar(128));
|
||||
});
|
||||
connect(room, &Room::notificationCountChanged, this,
|
||||
&RoomListModel::refreshNotificationCount);
|
||||
}
|
||||
|
||||
@@ -89,6 +89,12 @@ class RoomListModel : public QAbstractListModel {
|
||||
const QString& senderName,
|
||||
const QString& text,
|
||||
const QImage& icon);
|
||||
void newHighlight(const QString& roomId,
|
||||
const QString& eventId,
|
||||
const QString& roomName,
|
||||
const QString& senderName,
|
||||
const QString& text,
|
||||
const QImage& icon);
|
||||
};
|
||||
|
||||
#endif // ROOMLISTMODEL_H
|
||||
|
||||
Reference in New Issue
Block a user