summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-08-04 02:27:50 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-08-04 02:27:50 +0200
commit87e81498b73d59e8173953079ca5d0d73c5c302f (patch)
tree8950646036c5019a47f201b9ccae8056716fd048 /resources
parentMerge pull request #662 from LorenDB/qml-all-the-things (diff)
downloadnheko-87e81498b73d59e8173953079ca5d0d73c5c302f.tar.xz
Fix window placement on wayland and add close buttons
We explicitly set a parent. We can't assign to
ApplicationWindow.transientParent though, only to
Window.transientParent, so we just call setTransientParent in C++.
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/InviteDialog.qml4
-rw-r--r--resources/qml/MessageInput.qml2
-rw-r--r--resources/qml/MessageView.qml2
-rw-r--r--resources/qml/RawMessageDialog.qml7
-rw-r--r--resources/qml/ReadReceipts.qml5
-rw-r--r--resources/qml/RoomMembers.qml6
-rw-r--r--resources/qml/RoomSettings.qml7
-rw-r--r--resources/qml/Root.qml6
-rw-r--r--resources/qml/TimelineRow.qml2
-rw-r--r--resources/qml/TimelineView.qml2
-rw-r--r--resources/qml/UserProfile.qml14
-rw-r--r--resources/qml/delegates/Reply.qml2
-rw-r--r--resources/qml/device-verification/DeviceVerification.qml7
-rw-r--r--resources/qml/dialogs/ImagePackSettingsDialog.qml11
-rw-r--r--resources/qml/dialogs/InputDialog.qml1
15 files changed, 42 insertions, 36 deletions
diff --git a/resources/qml/InviteDialog.qml b/resources/qml/InviteDialog.qml
index 50287ad5..2c0e15a7 100644
--- a/resources/qml/InviteDialog.qml
+++ b/resources/qml/InviteDialog.qml
@@ -30,12 +30,12 @@ ApplicationWindow {
     }
 
     title: qsTr("Invite users to %1").arg(plainRoomName)
-    x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
-    y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
     height: 380
     width: 340
     palette: Nheko.colors
     color: Nheko.colors.window
+    flags: Qt.Dialog | Qt.WindowCloseButtonHint
+    Component.onCompleted: Nheko.reparent(inviteDialogRoot)
 
     Shortcut {
         sequence: "Ctrl+Enter"
diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml
index 8bc8ac62..7fb09684 100644
--- a/resources/qml/MessageInput.qml
+++ b/resources/qml/MessageInput.qml
@@ -7,7 +7,7 @@ import "./voip"
 import QtQuick 2.12
 import QtQuick.Controls 2.3
 import QtQuick.Layouts 1.2
-import QtQuick.Window 2.2
+import QtQuick.Window 2.13
 import im.nheko 1.0
 
 Rectangle {
diff --git a/resources/qml/MessageView.qml b/resources/qml/MessageView.qml
index 9ba5e2d0..f3e15d84 100644
--- a/resources/qml/MessageView.qml
+++ b/resources/qml/MessageView.qml
@@ -10,7 +10,7 @@ import QtGraphicalEffects 1.0
 import QtQuick 2.15
 import QtQuick.Controls 2.15
 import QtQuick.Layouts 1.2
-import QtQuick.Window 2.2
+import QtQuick.Window 2.13
 import im.nheko 1.0
 
 ScrollView {
diff --git a/resources/qml/RawMessageDialog.qml b/resources/qml/RawMessageDialog.qml
index 231e2f6d..e2a476cd 100644
--- a/resources/qml/RawMessageDialog.qml
+++ b/resources/qml/RawMessageDialog.qml
@@ -11,13 +11,12 @@ ApplicationWindow {
 
     property alias rawMessage: rawMessageView.text
 
-    x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
-    y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
     height: 420
     width: 420
     palette: Nheko.colors
     color: Nheko.colors.window
-    flags: Qt.Tool | Qt.WindowStaysOnTopHint
+    flags: Qt.Tool | Qt.WindowStaysOnTopHint | Qt.WindowCloseButtonHint
+    Component.onCompleted: Nheko.reparent(rawMessageRoot)
 
     Shortcut {
         sequence: StandardKey.Cancel
@@ -40,6 +39,7 @@ ApplicationWindow {
             background: Rectangle {
                 color: Nheko.colors.base
             }
+
         }
 
     }
@@ -48,4 +48,5 @@ ApplicationWindow {
         standardButtons: DialogButtonBox.Ok
         onAccepted: rawMessageRoot.close()
     }
+
 }
diff --git a/resources/qml/ReadReceipts.qml b/resources/qml/ReadReceipts.qml
index 8869d813..9adbfd5c 100644
--- a/resources/qml/ReadReceipts.qml
+++ b/resources/qml/ReadReceipts.qml
@@ -13,15 +13,14 @@ ApplicationWindow {
     property ReadReceiptsProxy readReceipts
     property Room room
 
-    x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
-    y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
     height: 380
     width: 340
     minimumHeight: 380
     minimumWidth: headerTitle.width + 2 * Nheko.paddingMedium
     palette: Nheko.colors
     color: Nheko.colors.window
-    flags: Qt.Dialog
+    flags: Qt.Dialog | Qt.WindowCloseButtonHint
+    Component.onCompleted: Nheko.reparent(readReceiptsRoot)
 
     Shortcut {
         sequence: StandardKey.Cancel
diff --git a/resources/qml/RoomMembers.qml b/resources/qml/RoomMembers.qml
index 641a08be..447e6fd1 100644
--- a/resources/qml/RoomMembers.qml
+++ b/resources/qml/RoomMembers.qml
@@ -6,7 +6,7 @@ import "./ui"
 import QtQuick 2.12
 import QtQuick.Controls 2.12
 import QtQuick.Layouts 1.12
-import QtQuick.Window 2.12
+import QtQuick.Window 2.13
 import im.nheko 1.0
 
 ApplicationWindow {
@@ -15,13 +15,13 @@ ApplicationWindow {
     property MemberList members
 
     title: qsTr("Members of %1").arg(members.roomName)
-    x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
-    y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
     height: 650
     width: 420
     minimumHeight: 420
     palette: Nheko.colors
     color: Nheko.colors.window
+    flags: Qt.Dialog | Qt.WindowCloseButtonHint
+    Component.onCompleted: Nheko.reparent(roomMembersRoot)
 
     Shortcut {
         sequence: StandardKey.Cancel
diff --git a/resources/qml/RoomSettings.qml b/resources/qml/RoomSettings.qml
index b8e527a5..6ba080c4 100644
--- a/resources/qml/RoomSettings.qml
+++ b/resources/qml/RoomSettings.qml
@@ -7,7 +7,7 @@ import Qt.labs.platform 1.1 as Platform
 import QtQuick 2.15
 import QtQuick.Controls 2.3
 import QtQuick.Layouts 1.2
-import QtQuick.Window 2.3
+import QtQuick.Window 2.13
 import im.nheko 1.0
 
 ApplicationWindow {
@@ -15,14 +15,13 @@ ApplicationWindow {
 
     property var roomSettings
 
-    x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
-    y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
     minimumWidth: 420
     minimumHeight: 650
     palette: Nheko.colors
     color: Nheko.colors.window
     modality: Qt.NonModal
-    flags: Qt.Dialog
+    flags: Qt.Dialog | Qt.WindowCloseButtonHint
+    Component.onCompleted: Nheko.reparent(roomSettingsDialog)
     title: qsTr("Room Settings")
 
     Shortcut {
diff --git a/resources/qml/Root.qml b/resources/qml/Root.qml
index 70cfbda5..b229acda 100644
--- a/resources/qml/Root.qml
+++ b/resources/qml/Root.qml
@@ -9,10 +9,10 @@ import "./emoji"
 import "./voip"
 import Qt.labs.platform 1.1 as Platform
 import QtGraphicalEffects 1.0
-import QtQuick 2.9
-import QtQuick.Controls 2.5
+import QtQuick 2.15
+import QtQuick.Controls 2.15
 import QtQuick.Layouts 1.3
-import QtQuick.Window 2.2
+import QtQuick.Window 2.15
 import im.nheko 1.0
 import im.nheko.EmojiModel 1.0
 
diff --git a/resources/qml/TimelineRow.qml b/resources/qml/TimelineRow.qml
index 755ab503..6345f44c 100644
--- a/resources/qml/TimelineRow.qml
+++ b/resources/qml/TimelineRow.qml
@@ -7,7 +7,7 @@ import "./emoji"
 import QtQuick 2.12
 import QtQuick.Controls 2.3
 import QtQuick.Layouts 1.2
-import QtQuick.Window 2.2
+import QtQuick.Window 2.13
 import im.nheko 1.0
 
 Item {
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml
index e4036eb7..6fc9d51b 100644
--- a/resources/qml/TimelineView.qml
+++ b/resources/qml/TimelineView.qml
@@ -13,7 +13,7 @@ import QtGraphicalEffects 1.0
 import QtQuick 2.9
 import QtQuick.Controls 2.5
 import QtQuick.Layouts 1.3
-import QtQuick.Window 2.2
+import QtQuick.Window 2.13
 import im.nheko 1.0
 import im.nheko.EmojiModel 1.0
 
diff --git a/resources/qml/UserProfile.qml b/resources/qml/UserProfile.qml
index d138060b..767d2317 100644
--- a/resources/qml/UserProfile.qml
+++ b/resources/qml/UserProfile.qml
@@ -4,19 +4,20 @@
 
 import "./device-verification"
 import "./ui"
-import QtQuick 2.9
-import QtQuick.Controls 2.3
+import QtQuick 2.15
+import QtQuick.Controls 2.15
 import QtQuick.Layouts 1.2
-import QtQuick.Window 2.3
+import QtQuick.Window 2.13
 import im.nheko 1.0
 
 ApplicationWindow {
+    // this does not work in ApplicationWindow, just in Window
+    //transientParent: Nheko.mainwindow()
+
     id: userProfileDialog
 
     property var profile
 
-    x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
-    y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
     height: 650
     width: 420
     minimumHeight: 420
@@ -24,7 +25,8 @@ ApplicationWindow {
     color: Nheko.colors.window
     title: profile.isGlobalUserProfile ? qsTr("Global User Profile") : qsTr("Room User Profile")
     modality: Qt.NonModal
-    flags: Qt.Dialog
+    flags: Qt.Dialog | Qt.WindowCloseButtonHint
+    Component.onCompleted: Nheko.reparent(userProfileDialog)
 
     Shortcut {
         sequence: StandardKey.Cancel
diff --git a/resources/qml/delegates/Reply.qml b/resources/qml/delegates/Reply.qml
index 75e3d617..3e02a940 100644
--- a/resources/qml/delegates/Reply.qml
+++ b/resources/qml/delegates/Reply.qml
@@ -5,7 +5,7 @@
 import QtQuick 2.12
 import QtQuick.Controls 2.3
 import QtQuick.Layouts 1.2
-import QtQuick.Window 2.2
+import QtQuick.Window 2.13
 import im.nheko 1.0
 
 Item {
diff --git a/resources/qml/device-verification/DeviceVerification.qml b/resources/qml/device-verification/DeviceVerification.qml
index e2c66c5a..8e0271d6 100644
--- a/resources/qml/device-verification/DeviceVerification.qml
+++ b/resources/qml/device-verification/DeviceVerification.qml
@@ -4,7 +4,7 @@
 
 import QtQuick 2.10
 import QtQuick.Controls 2.3
-import QtQuick.Window 2.10
+import QtQuick.Window 2.13
 import im.nheko 1.0
 
 ApplicationWindow {
@@ -14,13 +14,12 @@ ApplicationWindow {
 
     onClosing: TimelineManager.removeVerificationFlow(flow)
     title: stack.currentItem.title
-    flags: Qt.Dialog
     modality: Qt.NonModal
     palette: Nheko.colors
     height: stack.implicitHeight
     width: stack.implicitWidth
-    x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
-    y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
+    flags: Qt.Dialog | Qt.WindowCloseButtonHint
+    Component.onCompleted: Nheko.reparent(dialog)
 
     StackView {
         id: stack
diff --git a/resources/qml/dialogs/ImagePackSettingsDialog.qml b/resources/qml/dialogs/ImagePackSettingsDialog.qml
index c4b4a885..3d830bf7 100644
--- a/resources/qml/dialogs/ImagePackSettingsDialog.qml
+++ b/resources/qml/dialogs/ImagePackSettingsDialog.qml
@@ -20,14 +20,13 @@ ApplicationWindow {
     readonly property int stickerDimPad: 128 + Nheko.paddingSmall
 
     title: qsTr("Image pack settings")
-    x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
-    y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
     height: 400
     width: 600
     palette: Nheko.colors
     color: Nheko.colors.base
     modality: Qt.NonModal
-    flags: Qt.Dialog
+    flags: Qt.Dialog | Qt.WindowCloseButtonHint
+    Component.onCompleted: Nheko.reparent(win)
 
     AdaptiveLayout {
         id: adaptiveView
@@ -202,6 +201,12 @@ ApplicationWindow {
                 color: Nheko.colors.window
 
                 ColumnLayout {
+                    //Button {
+                    //    Layout.alignment: Qt.AlignHCenter
+                    //    text: qsTr("Edit")
+                    //    enabled: currentPack.canEdit
+                    //}
+
                     id: packinfo
 
                     property string packName: currentPack ? currentPack.packname : ""
diff --git a/resources/qml/dialogs/InputDialog.qml b/resources/qml/dialogs/InputDialog.qml
index 134b78a3..e0f17851 100644
--- a/resources/qml/dialogs/InputDialog.qml
+++ b/resources/qml/dialogs/InputDialog.qml
@@ -16,6 +16,7 @@ ApplicationWindow {
 
     modality: Qt.NonModal
     flags: Qt.Dialog
+    Component.onCompleted: Nheko.reparent(inputDialog)
     width: 350
     height: fontMetrics.lineSpacing * 7