Replace rowlayouts with gridlayout and fix room settings initializer list

This commit is contained in:
Jedi18 2021-02-14 11:26:10 +05:30
parent 8400540428
commit b5e351ab02
2 changed files with 27 additions and 38 deletions

View file

@ -12,7 +12,7 @@ ApplicationWindow {
x: MainWindow.x + (MainWindow.width / 2) - (width / 2) x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
y: MainWindow.y + (MainWindow.height / 2) - (height / 2) y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
minimumWidth: 400 minimumWidth: 420
minimumHeight: 650 minimumHeight: 650
palette: colors palette: colors
color: colors.window color: colors.window
@ -113,56 +113,55 @@ ApplicationWindow {
wrapMode: TextEdit.WordWrap wrapMode: TextEdit.WordWrap
readOnly: true readOnly: true
background: null background: null
horizontalAlignment: TextEdit.AlignHCenter
selectByMouse: true
} }
} }
MatrixText { GridLayout {
text: "SETTINGS" columns: 2
}
RowLayout {
MatrixText { MatrixText {
text: "Notifications" text: "SETTINGS"
} }
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
} }
MatrixText {
text: "Notifications"
Layout.fillWidth: true
}
ComboBox { ComboBox {
model: [ "Muted", "Mentions only", "All messages" ] model: [ "Muted", "Mentions only", "All messages" ]
currentIndex: roomSettings.notifications currentIndex: roomSettings.notifications
onActivated: { onActivated: {
roomSettings.changeNotifications(index) roomSettings.changeNotifications(index)
} }
Layout.fillWidth: true
} }
}
RowLayout {
MatrixText { MatrixText {
text: "Room access" text: "Room access"
Layout.fillWidth: true
} }
ComboBox { ComboBox {
Layout.fillWidth: true
enabled: roomSettings.canChangeJoinRules enabled: roomSettings.canChangeJoinRules
model: [ "Anyone and guests", "Anyone", "Invited users" ] model: [ "Anyone and guests", "Anyone", "Invited users" ]
currentIndex: roomSettings.accessJoinRules currentIndex: roomSettings.accessJoinRules
onActivated: { onActivated: {
roomSettings.changeAccessRules(index) roomSettings.changeAccessRules(index)
} }
Layout.fillWidth: true
} }
}
RowLayout {
MatrixText { MatrixText {
text: "Encryption" text: "Encryption"
} }
Item {
Layout.fillWidth: true
}
ToggleButton { ToggleButton {
id: encryptionToggle id: encryptionToggle
@ -175,6 +174,7 @@ ApplicationWindow {
confirmEncryptionDialog.open(); confirmEncryptionDialog.open();
} }
Layout.alignment: Qt.AlignRight
} }
MessageDialog { MessageDialog {
@ -199,20 +199,14 @@ ApplicationWindow {
standardButtons: Dialog.Ok | Dialog.Cancel standardButtons: Dialog.Ok | Dialog.Cancel
} }
}
RowLayout {
visible: roomSettings.isEncryptionEnabled
MatrixText { MatrixText {
visible: roomSettings.isEncryptionEnabled
text: "Respond to key requests" text: "Respond to key requests"
} }
Item {
Layout.fillWidth: true
}
ToggleButton { ToggleButton {
visible: roomSettings.isEncryptionEnabled
ToolTip.text: qsTr("Whether or not the client should respond automatically with the session keys ToolTip.text: qsTr("Whether or not the client should respond automatically with the session keys
upon request. Use with caution, this is a temporary measure to test the upon request. Use with caution, this is a temporary measure to test the
E2E implementation until device verification is completed.") E2E implementation until device verification is completed.")
@ -222,40 +216,35 @@ ApplicationWindow {
onClicked: { onClicked: {
roomSettings.changeKeyRequestsPreference(checked) roomSettings.changeKeyRequestsPreference(checked)
} }
Layout.alignment: Qt.AlignRight
} }
}
MatrixText {
text: "INFO"
}
RowLayout {
MatrixText { MatrixText {
text: "Internal ID" text: "INFO"
} }
Item { Item {
Layout.fillWidth: true Layout.fillWidth: true
} }
MatrixText {
text: "Internal ID"
}
MatrixText { MatrixText {
text: roomSettings.roomId text: roomSettings.roomId
font.pixelSize: 12 font.pixelSize: 12
Layout.alignment: Qt.AlignRight
} }
}
RowLayout {
MatrixText { MatrixText {
text: "Room Version" text: "Room Version"
} }
Item {
Layout.fillWidth: true
}
MatrixText { MatrixText {
text: roomSettings.roomVersion text: roomSettings.roomVersion
font.pixelSize: 12 font.pixelSize: 12
Layout.alignment: Qt.AlignRight
} }
} }

View file

@ -165,8 +165,8 @@ EditModal::setFields(const QString &roomName, const QString &roomTopic)
} }
RoomSettings::RoomSettings(QString roomid, QObject *parent) RoomSettings::RoomSettings(QString roomid, QObject *parent)
: roomid_{std::move(roomid)} : QObject(parent)
, QObject(parent) , roomid_{std::move(roomid)}
{ {
retrieveRoomInfo(); retrieveRoomInfo();