summary refs log tree commit diff
diff options
context:
space:
mode:
authorJedi18 <targetakhil@gmail.com>2021-02-14 11:26:10 +0530
committerJedi18 <targetakhil@gmail.com>2021-02-14 11:26:10 +0530
commitb5e351ab025fe751cd230371714cdee24125bfc4 (patch)
tree461fad975d6465966b437e779502948766727f30
parentMerge branch 'master' into room_settings_qml (diff)
downloadnheko-b5e351ab025fe751cd230371714cdee24125bfc4.tar.xz
Replace rowlayouts with gridlayout and fix room settings initializer list
-rw-r--r--resources/qml/RoomSettings.qml61
-rw-r--r--src/ui/RoomSettings.cpp4
2 files changed, 27 insertions, 38 deletions
diff --git a/resources/qml/RoomSettings.qml b/resources/qml/RoomSettings.qml
index b3602a6a..eebecebb 100644
--- a/resources/qml/RoomSettings.qml
+++ b/resources/qml/RoomSettings.qml
@@ -12,7 +12,7 @@ ApplicationWindow {
 
 	x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
     y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
-    minimumWidth: 400
+    minimumWidth: 420
     minimumHeight: 650
     palette: colors
     color: colors.window
@@ -113,56 +113,55 @@ ApplicationWindow {
                 wrapMode: TextEdit.WordWrap
                 readOnly: true
                 background: null
+                horizontalAlignment: TextEdit.AlignHCenter
+                selectByMouse: true
             }
         }
 
-        MatrixText {
-            text: "SETTINGS"
-        }
+        GridLayout {
+            columns: 2
 
-        RowLayout {
             MatrixText {
-                text: "Notifications"
+                text: "SETTINGS"
             }
 
             Item {
                 Layout.fillWidth: true
             }
 
+            MatrixText {
+                text: "Notifications"
+                Layout.fillWidth: true
+            }
+
             ComboBox {
                 model: [ "Muted", "Mentions only", "All messages" ]
                 currentIndex: roomSettings.notifications
                 onActivated: {
                     roomSettings.changeNotifications(index)
                 }
+                Layout.fillWidth: true
             }
-        }
 
-        RowLayout {
             MatrixText {
                 text: "Room access"
+                Layout.fillWidth: true
             }
 
             ComboBox {
-                Layout.fillWidth: true
                 enabled: roomSettings.canChangeJoinRules
                 model: [ "Anyone and guests", "Anyone", "Invited users" ]
                 currentIndex: roomSettings.accessJoinRules
                 onActivated: {
                     roomSettings.changeAccessRules(index)
                 }
+                Layout.fillWidth: true
             }
-        }
 
-        RowLayout {
             MatrixText {
                 text: "Encryption"
             }
 
-            Item {
-                Layout.fillWidth: true
-            }
-
             ToggleButton {
                 id: encryptionToggle
 
@@ -175,6 +174,7 @@ ApplicationWindow {
 
                     confirmEncryptionDialog.open();
                 }
+                Layout.alignment: Qt.AlignRight
             }
 
             MessageDialog {
@@ -199,20 +199,14 @@ ApplicationWindow {
 
                 standardButtons: Dialog.Ok | Dialog.Cancel
             }
-        }
-
-        RowLayout {
-            visible: roomSettings.isEncryptionEnabled
 
             MatrixText {
+                visible: roomSettings.isEncryptionEnabled
                 text: "Respond to key requests"
             }
 
-            Item {
-                Layout.fillWidth: true
-            }
-
             ToggleButton {
+                visible: roomSettings.isEncryptionEnabled
                 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 
                                 E2E implementation until device verification is completed.")
@@ -222,16 +216,11 @@ ApplicationWindow {
                 onClicked: {
                     roomSettings.changeKeyRequestsPreference(checked)
                 }
+                Layout.alignment: Qt.AlignRight
             }
-        }
-
-        MatrixText {
-            text: "INFO"
-        }
 
-        RowLayout {
             MatrixText {
-                text: "Internal ID"
+                text: "INFO"
             }
 
             Item {
@@ -239,23 +228,23 @@ ApplicationWindow {
             }
 
             MatrixText {
+                text: "Internal ID"
+            }
+
+            MatrixText {
                 text: roomSettings.roomId
                 font.pixelSize: 12
+                Layout.alignment: Qt.AlignRight
             }
-        }
 
-        RowLayout {
             MatrixText {
                 text: "Room Version"
             }
 
-            Item {
-                Layout.fillWidth: true
-            }
-
             MatrixText {
                 text: roomSettings.roomVersion
                 font.pixelSize: 12
+                Layout.alignment: Qt.AlignRight
             }
         }
 
diff --git a/src/ui/RoomSettings.cpp b/src/ui/RoomSettings.cpp
index b166332c..aa6f60a0 100644
--- a/src/ui/RoomSettings.cpp
+++ b/src/ui/RoomSettings.cpp
@@ -165,8 +165,8 @@ EditModal::setFields(const QString &roomName, const QString &roomTopic)
 }
 
 RoomSettings::RoomSettings(QString roomid, QObject *parent)
-  : roomid_{std::move(roomid)}
-  , QObject(parent)
+  : QObject(parent)
+  , roomid_{std::move(roomid)}
 {
         retrieveRoomInfo();