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)
|
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
|
height: 380
|
||||||
width: 340
|
width: 340
|
||||||
palette: Nheko.colors
|
palette: Nheko.colors
|
||||||
color: Nheko.colors.window
|
color: Nheko.colors.window
|
||||||
|
flags: Qt.Dialog | Qt.WindowCloseButtonHint
|
||||||
|
Component.onCompleted: Nheko.reparent(inviteDialogRoot)
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
sequence: "Ctrl+Enter"
|
sequence: "Ctrl+Enter"
|
||||||
|
|
|
@ -7,7 +7,7 @@ import "./voip"
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
import QtQuick.Layouts 1.2
|
import QtQuick.Layouts 1.2
|
||||||
import QtQuick.Window 2.2
|
import QtQuick.Window 2.13
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import QtGraphicalEffects 1.0
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.15
|
import QtQuick.Controls 2.15
|
||||||
import QtQuick.Layouts 1.2
|
import QtQuick.Layouts 1.2
|
||||||
import QtQuick.Window 2.2
|
import QtQuick.Window 2.13
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
|
|
|
@ -11,13 +11,12 @@ ApplicationWindow {
|
||||||
|
|
||||||
property alias rawMessage: rawMessageView.text
|
property alias rawMessage: rawMessageView.text
|
||||||
|
|
||||||
x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
|
|
||||||
y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
|
|
||||||
height: 420
|
height: 420
|
||||||
width: 420
|
width: 420
|
||||||
palette: Nheko.colors
|
palette: Nheko.colors
|
||||||
color: Nheko.colors.window
|
color: Nheko.colors.window
|
||||||
flags: Qt.Tool | Qt.WindowStaysOnTopHint
|
flags: Qt.Tool | Qt.WindowStaysOnTopHint | Qt.WindowCloseButtonHint
|
||||||
|
Component.onCompleted: Nheko.reparent(rawMessageRoot)
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
sequence: StandardKey.Cancel
|
sequence: StandardKey.Cancel
|
||||||
|
@ -40,6 +39,7 @@ ApplicationWindow {
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: Nheko.colors.base
|
color: Nheko.colors.base
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -48,4 +48,5 @@ ApplicationWindow {
|
||||||
standardButtons: DialogButtonBox.Ok
|
standardButtons: DialogButtonBox.Ok
|
||||||
onAccepted: rawMessageRoot.close()
|
onAccepted: rawMessageRoot.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,15 +13,14 @@ ApplicationWindow {
|
||||||
property ReadReceiptsProxy readReceipts
|
property ReadReceiptsProxy readReceipts
|
||||||
property Room room
|
property Room room
|
||||||
|
|
||||||
x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
|
|
||||||
y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
|
|
||||||
height: 380
|
height: 380
|
||||||
width: 340
|
width: 340
|
||||||
minimumHeight: 380
|
minimumHeight: 380
|
||||||
minimumWidth: headerTitle.width + 2 * Nheko.paddingMedium
|
minimumWidth: headerTitle.width + 2 * Nheko.paddingMedium
|
||||||
palette: Nheko.colors
|
palette: Nheko.colors
|
||||||
color: Nheko.colors.window
|
color: Nheko.colors.window
|
||||||
flags: Qt.Dialog
|
flags: Qt.Dialog | Qt.WindowCloseButtonHint
|
||||||
|
Component.onCompleted: Nheko.reparent(readReceiptsRoot)
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
sequence: StandardKey.Cancel
|
sequence: StandardKey.Cancel
|
||||||
|
|
|
@ -6,7 +6,7 @@ import "./ui"
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.12
|
import QtQuick.Controls 2.12
|
||||||
import QtQuick.Layouts 1.12
|
import QtQuick.Layouts 1.12
|
||||||
import QtQuick.Window 2.12
|
import QtQuick.Window 2.13
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
|
@ -15,13 +15,13 @@ ApplicationWindow {
|
||||||
property MemberList members
|
property MemberList members
|
||||||
|
|
||||||
title: qsTr("Members of %1").arg(members.roomName)
|
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
|
height: 650
|
||||||
width: 420
|
width: 420
|
||||||
minimumHeight: 420
|
minimumHeight: 420
|
||||||
palette: Nheko.colors
|
palette: Nheko.colors
|
||||||
color: Nheko.colors.window
|
color: Nheko.colors.window
|
||||||
|
flags: Qt.Dialog | Qt.WindowCloseButtonHint
|
||||||
|
Component.onCompleted: Nheko.reparent(roomMembersRoot)
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
sequence: StandardKey.Cancel
|
sequence: StandardKey.Cancel
|
||||||
|
|
|
@ -7,7 +7,7 @@ import Qt.labs.platform 1.1 as Platform
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
import QtQuick.Layouts 1.2
|
import QtQuick.Layouts 1.2
|
||||||
import QtQuick.Window 2.3
|
import QtQuick.Window 2.13
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
|
@ -15,14 +15,13 @@ ApplicationWindow {
|
||||||
|
|
||||||
property var roomSettings
|
property var roomSettings
|
||||||
|
|
||||||
x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
|
|
||||||
y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
|
|
||||||
minimumWidth: 420
|
minimumWidth: 420
|
||||||
minimumHeight: 650
|
minimumHeight: 650
|
||||||
palette: Nheko.colors
|
palette: Nheko.colors
|
||||||
color: Nheko.colors.window
|
color: Nheko.colors.window
|
||||||
modality: Qt.NonModal
|
modality: Qt.NonModal
|
||||||
flags: Qt.Dialog
|
flags: Qt.Dialog | Qt.WindowCloseButtonHint
|
||||||
|
Component.onCompleted: Nheko.reparent(roomSettingsDialog)
|
||||||
title: qsTr("Room Settings")
|
title: qsTr("Room Settings")
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
|
|
|
@ -9,10 +9,10 @@ import "./emoji"
|
||||||
import "./voip"
|
import "./voip"
|
||||||
import Qt.labs.platform 1.1 as Platform
|
import Qt.labs.platform 1.1 as Platform
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
import QtQuick 2.9
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.5
|
import QtQuick.Controls 2.15
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Window 2.2
|
import QtQuick.Window 2.15
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
import im.nheko.EmojiModel 1.0
|
import im.nheko.EmojiModel 1.0
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import "./emoji"
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
import QtQuick.Layouts 1.2
|
import QtQuick.Layouts 1.2
|
||||||
import QtQuick.Window 2.2
|
import QtQuick.Window 2.13
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import QtGraphicalEffects 1.0
|
||||||
import QtQuick 2.9
|
import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.5
|
import QtQuick.Controls 2.5
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Window 2.2
|
import QtQuick.Window 2.13
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
import im.nheko.EmojiModel 1.0
|
import im.nheko.EmojiModel 1.0
|
||||||
|
|
||||||
|
|
|
@ -4,19 +4,20 @@
|
||||||
|
|
||||||
import "./device-verification"
|
import "./device-verification"
|
||||||
import "./ui"
|
import "./ui"
|
||||||
import QtQuick 2.9
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.15
|
||||||
import QtQuick.Layouts 1.2
|
import QtQuick.Layouts 1.2
|
||||||
import QtQuick.Window 2.3
|
import QtQuick.Window 2.13
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
|
// this does not work in ApplicationWindow, just in Window
|
||||||
|
//transientParent: Nheko.mainwindow()
|
||||||
|
|
||||||
id: userProfileDialog
|
id: userProfileDialog
|
||||||
|
|
||||||
property var profile
|
property var profile
|
||||||
|
|
||||||
x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
|
|
||||||
y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
|
|
||||||
height: 650
|
height: 650
|
||||||
width: 420
|
width: 420
|
||||||
minimumHeight: 420
|
minimumHeight: 420
|
||||||
|
@ -24,7 +25,8 @@ ApplicationWindow {
|
||||||
color: Nheko.colors.window
|
color: Nheko.colors.window
|
||||||
title: profile.isGlobalUserProfile ? qsTr("Global User Profile") : qsTr("Room User Profile")
|
title: profile.isGlobalUserProfile ? qsTr("Global User Profile") : qsTr("Room User Profile")
|
||||||
modality: Qt.NonModal
|
modality: Qt.NonModal
|
||||||
flags: Qt.Dialog
|
flags: Qt.Dialog | Qt.WindowCloseButtonHint
|
||||||
|
Component.onCompleted: Nheko.reparent(userProfileDialog)
|
||||||
|
|
||||||
Shortcut {
|
Shortcut {
|
||||||
sequence: StandardKey.Cancel
|
sequence: StandardKey.Cancel
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
import QtQuick.Layouts 1.2
|
import QtQuick.Layouts 1.2
|
||||||
import QtQuick.Window 2.2
|
import QtQuick.Window 2.13
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
import QtQuick 2.10
|
import QtQuick 2.10
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
import QtQuick.Window 2.10
|
import QtQuick.Window 2.13
|
||||||
import im.nheko 1.0
|
import im.nheko 1.0
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
|
@ -14,13 +14,12 @@ ApplicationWindow {
|
||||||
|
|
||||||
onClosing: TimelineManager.removeVerificationFlow(flow)
|
onClosing: TimelineManager.removeVerificationFlow(flow)
|
||||||
title: stack.currentItem.title
|
title: stack.currentItem.title
|
||||||
flags: Qt.Dialog
|
|
||||||
modality: Qt.NonModal
|
modality: Qt.NonModal
|
||||||
palette: Nheko.colors
|
palette: Nheko.colors
|
||||||
height: stack.implicitHeight
|
height: stack.implicitHeight
|
||||||
width: stack.implicitWidth
|
width: stack.implicitWidth
|
||||||
x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
|
flags: Qt.Dialog | Qt.WindowCloseButtonHint
|
||||||
y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
|
Component.onCompleted: Nheko.reparent(dialog)
|
||||||
|
|
||||||
StackView {
|
StackView {
|
||||||
id: stack
|
id: stack
|
||||||
|
|
|
@ -20,14 +20,13 @@ ApplicationWindow {
|
||||||
readonly property int stickerDimPad: 128 + Nheko.paddingSmall
|
readonly property int stickerDimPad: 128 + Nheko.paddingSmall
|
||||||
|
|
||||||
title: qsTr("Image pack settings")
|
title: qsTr("Image pack settings")
|
||||||
x: MainWindow.x + (MainWindow.width / 2) - (width / 2)
|
|
||||||
y: MainWindow.y + (MainWindow.height / 2) - (height / 2)
|
|
||||||
height: 400
|
height: 400
|
||||||
width: 600
|
width: 600
|
||||||
palette: Nheko.colors
|
palette: Nheko.colors
|
||||||
color: Nheko.colors.base
|
color: Nheko.colors.base
|
||||||
modality: Qt.NonModal
|
modality: Qt.NonModal
|
||||||
flags: Qt.Dialog
|
flags: Qt.Dialog | Qt.WindowCloseButtonHint
|
||||||
|
Component.onCompleted: Nheko.reparent(win)
|
||||||
|
|
||||||
AdaptiveLayout {
|
AdaptiveLayout {
|
||||||
id: adaptiveView
|
id: adaptiveView
|
||||||
|
@ -202,6 +201,12 @@ ApplicationWindow {
|
||||||
color: Nheko.colors.window
|
color: Nheko.colors.window
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
//Button {
|
||||||
|
// Layout.alignment: Qt.AlignHCenter
|
||||||
|
// text: qsTr("Edit")
|
||||||
|
// enabled: currentPack.canEdit
|
||||||
|
//}
|
||||||
|
|
||||||
id: packinfo
|
id: packinfo
|
||||||
|
|
||||||
property string packName: currentPack ? currentPack.packname : ""
|
property string packName: currentPack ? currentPack.packname : ""
|
||||||
|
|
|
@ -16,6 +16,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
modality: Qt.NonModal
|
modality: Qt.NonModal
|
||||||
flags: Qt.Dialog
|
flags: Qt.Dialog
|
||||||
|
Component.onCompleted: Nheko.reparent(inputDialog)
|
||||||
width: 350
|
width: 350
|
||||||
height: fontMetrics.lineSpacing * 7
|
height: fontMetrics.lineSpacing * 7
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QWindow>
|
||||||
|
|
||||||
#include "Cache_p.h"
|
#include "Cache_p.h"
|
||||||
#include "ChatPage.h"
|
#include "ChatPage.h"
|
||||||
|
@ -140,3 +141,9 @@ Nheko::openJoinRoomDialog() const
|
||||||
MainWindow::instance()->openJoinRoomDialog(
|
MainWindow::instance()->openJoinRoomDialog(
|
||||||
[](const QString &room_id) { ChatPage::instance()->joinRoom(room_id); });
|
[](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 "Theme.h"
|
||||||
#include "UserProfile.h"
|
#include "UserProfile.h"
|
||||||
|
|
||||||
|
class QWindow;
|
||||||
|
|
||||||
class Nheko : public QObject
|
class Nheko : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -49,6 +51,7 @@ public:
|
||||||
Q_INVOKABLE void openLogoutDialog() const;
|
Q_INVOKABLE void openLogoutDialog() const;
|
||||||
Q_INVOKABLE void openCreateRoomDialog() const;
|
Q_INVOKABLE void openCreateRoomDialog() const;
|
||||||
Q_INVOKABLE void openJoinRoomDialog() const;
|
Q_INVOKABLE void openJoinRoomDialog() const;
|
||||||
|
Q_INVOKABLE void reparent(QWindow *win) const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateUserProfile();
|
void updateUserProfile();
|
||||||
|
|
Loading…
Reference in a new issue