mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
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++.
This commit is contained in:
parent
619525e62f
commit
87e81498b7
17 changed files with 52 additions and 36 deletions
|
@ -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"
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 : ""
|
||||
|
|
|
@ -16,6 +16,7 @@ ApplicationWindow {
|
|||
|
||||
modality: Qt.NonModal
|
||||
flags: Qt.Dialog
|
||||
Component.onCompleted: Nheko.reparent(inputDialog)
|
||||
width: 350
|
||||
height: fontMetrics.lineSpacing * 7
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <QDesktopServices>
|
||||
#include <QUrl>
|
||||
#include <QWindow>
|
||||
|
||||
#include "Cache_p.h"
|
||||
#include "ChatPage.h"
|
||||
|
@ -140,3 +141,9 @@ Nheko::openJoinRoomDialog() const
|
|||
MainWindow::instance()->openJoinRoomDialog(
|
||||
[](const QString &room_id) { ChatPage::instance()->joinRoom(room_id); });
|
||||
}
|
||||
|
||||
void
|
||||
Nheko::reparent(QWindow *win) const
|
||||
{
|
||||
win->setTransientParent(MainWindow::instance()->windowHandle());
|
||||
}
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include "Theme.h"
|
||||
#include "UserProfile.h"
|
||||
|
||||
class QWindow;
|
||||
|
||||
class Nheko : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -49,6 +51,7 @@ public:
|
|||
Q_INVOKABLE void openLogoutDialog() const;
|
||||
Q_INVOKABLE void openCreateRoomDialog() const;
|
||||
Q_INVOKABLE void openJoinRoomDialog() const;
|
||||
Q_INVOKABLE void reparent(QWindow *win) const;
|
||||
|
||||
public slots:
|
||||
void updateUserProfile();
|
||||
|
|
Loading…
Reference in a new issue