From 37679ac57ec79d112a76bd8afb0dfea7e433da80 Mon Sep 17 00:00:00 2001 From: Jedi18 Date: Tue, 9 Feb 2021 23:11:39 +0530 Subject: [PATCH] added room settings qml --- resources/qml/RoomSettings.qml | 157 +++++++++++++++++++++++++++ resources/qml/TimelineView.qml | 16 +++ resources/res.qrc | 1 + src/timeline/TimelineViewManager.cpp | 3 +- src/timeline/TimelineViewManager.h | 4 +- 5 files changed, 179 insertions(+), 2 deletions(-) create mode 100644 resources/qml/RoomSettings.qml diff --git a/resources/qml/RoomSettings.qml b/resources/qml/RoomSettings.qml new file mode 100644 index 00000000..106c9119 --- /dev/null +++ b/resources/qml/RoomSettings.qml @@ -0,0 +1,157 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.2 +import QtQuick.Window 2.3 +import im.nheko 1.0 + +ApplicationWindow { + id: roomSettingsDialog + + property var roomSettings + + x: MainWindow.x + (MainWindow.width / 2) - (width / 2) + y: MainWindow.y + (MainWindow.height / 2) - (height / 2) + height: 600 + width: 420 + minimumHeight: 420 + palette: colors + color: colors.window + title: "Room Settings" + modality: Qt.Modal + + Shortcut { + sequence: StandardKey.Cancel + onActivated: roomSettingsDialog.close() + } + + ColumnLayout { + id: contentLayout + + anchors.fill: parent + anchors.margins: 10 + spacing: 10 + + Avatar { + url: "" + height: 130 + width: 130 + displayName: "" + userid: "" + Layout.alignment: Qt.AlignHCenter + } + + ColumnLayout { + Layout.alignment: Qt.AlignHCenter + + MatrixText { + text: "room name" + font.pixelSize: 24 + Layout.alignment: Qt.AlignHCenter + } + + MatrixText { + text: "1 member" + Layout.alignment: Qt.AlignHCenter + } + } + + ImageButton { + Layout.alignment: Qt.AlignHCenter + image: ":/icons/icons/ui/edit.png" + } + + MatrixText { + text: "SETTINGS" + } + + RowLayout { + MatrixText { + text: "Notifications" + } + + Item { + Layout.fillWidth: true + } + + ComboBox { + model: [ "Muted", "Mentions only", "All messages" ] + } + } + + RowLayout { + MatrixText { + text: "Room access" + } + + ComboBox { + Layout.fillWidth: true + model: [ "Anyone and guests", "Anyone", "Invited users" ] + } + } + + RowLayout { + MatrixText { + text: "Encryption" + } + + Item { + Layout.fillWidth: true + } + + Switch { + } + } + + RowLayout { + MatrixText { + text: "Respond to key requests" + } + + Item { + Layout.fillWidth: true + } + + Switch { + } + } + + MatrixText { + text: "INFO" + } + + RowLayout { + MatrixText { + text: "Internal ID" + } + + Item { + Layout.fillWidth: true + } + + MatrixText { + text: "asdajdhasjkdhaskjdhasjdks" + font.pixelSize: 12 + } + } + + RowLayout { + MatrixText { + text: "Room Version" + } + + Item { + Layout.fillWidth: true + } + + MatrixText { + text: "6" + font.pixelSize: 12 + } + } + + Button { + Layout.alignment: Qt.AlignRight + text: "Ok" + } + } +} \ No newline at end of file diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index c03e8d31..c6c1e2b2 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -52,6 +52,14 @@ Page { } + Component { + id: roomSettingsComponent + + RoomSettings { + } + + } + Component { id: mobileCallInviteDialog @@ -166,6 +174,14 @@ Page { } } + Connections { + target: TimelineManager + onOpenRoomSettingsDialog: { + var roomSettings = roomSettingsComponent.createObject(timelineRoot); + roomSettings.show(); + } + } + Connections { target: CallManager onNewInviteState: { diff --git a/resources/res.qrc b/resources/res.qrc index 308d81a6..24b41179 100644 --- a/resources/res.qrc +++ b/resources/res.qrc @@ -139,6 +139,7 @@ qml/TimelineRow.qml qml/TopBar.qml qml/TypingIndicator.qml + qml/RoomSettings.qml qml/emoji/EmojiButton.qml qml/emoji/EmojiPicker.qml qml/UserProfile.qml diff --git a/src/timeline/TimelineViewManager.cpp b/src/timeline/TimelineViewManager.cpp index 93451976..d7d06386 100644 --- a/src/timeline/TimelineViewManager.cpp +++ b/src/timeline/TimelineViewManager.cpp @@ -390,9 +390,10 @@ TimelineViewManager::openLeaveRoomDialog() const MainWindow::instance()->openLeaveRoomDialog(timeline_->roomId()); } void -TimelineViewManager::openRoomSettings() const +TimelineViewManager::openRoomSettings() { MainWindow::instance()->openRoomSettings(timeline_->roomId()); + emit openRoomSettingsDialog(); } void diff --git a/src/timeline/TimelineViewManager.h b/src/timeline/TimelineViewManager.h index 74128865..841e0bcb 100644 --- a/src/timeline/TimelineViewManager.h +++ b/src/timeline/TimelineViewManager.h @@ -18,6 +18,7 @@ #include "WebRTCSession.h" #include "emoji/EmojiModel.h" #include "emoji/Provider.h" +#include "dialogs/RoomSettings.h" class MxcImageProvider; class BlurhashProvider; @@ -69,7 +70,7 @@ public: Q_INVOKABLE void openInviteUsersDialog(); Q_INVOKABLE void openMemberListDialog() const; Q_INVOKABLE void openLeaveRoomDialog() const; - Q_INVOKABLE void openRoomSettings() const; + Q_INVOKABLE void openRoomSettings(); Q_INVOKABLE void removeVerificationFlow(DeviceVerificationFlow *flow); void verifyUser(QString userid); @@ -87,6 +88,7 @@ signals: void showRoomList(); void narrowViewChanged(); void focusChanged(); + void openRoomSettingsDialog(); public slots: void updateReadReceipts(const QString &room_id, const std::vector &event_ids);