Skip to content
Snippets Groups Projects
Commit 49aadea7 authored by Nicolas Vengeon's avatar Nicolas Vengeon Committed by Nicolas Vengeon
Browse files

fix: open shortcuts window on correct screen

corrections:
- open on the same display,
- center to the parent window,
- has dimensions not more than the parent window

Change-Id: I2315d62fef6d830b6957770807ace462fbb77901
Gitlab: #774
parent 682721b7
No related branches found
No related tags found
No related merge requests found
...@@ -606,7 +606,7 @@ Rectangle { ...@@ -606,7 +606,7 @@ Rectangle {
sequence: "F10" sequence: "F10"
context: Qt.ApplicationShortcut context: Qt.ApplicationShortcut
onActivated: { onActivated: {
KeyboardShortcutTableCreation.createKeyboardShortcutTableWindowObject() KeyboardShortcutTableCreation.createKeyboardShortcutTableWindowObject(appWindow)
KeyboardShortcutTableCreation.showKeyboardShortcutTableWindow() KeyboardShortcutTableCreation.showKeyboardShortcutTableWindow()
} }
} }
......
...@@ -241,7 +241,7 @@ Rectangle { ...@@ -241,7 +241,7 @@ Rectangle {
toolTipText: JamiStrings.keyboardShortcuts toolTipText: JamiStrings.keyboardShortcuts
onClicked: { onClicked: {
KeyboardShortcutTableCreation.createKeyboardShortcutTableWindowObject() KeyboardShortcutTableCreation.createKeyboardShortcutTableWindowObject(appWindow)
KeyboardShortcutTableCreation.showKeyboardShortcutTableWindow() KeyboardShortcutTableCreation.showKeyboardShortcutTableWindow()
} }
} }
......
...@@ -19,12 +19,14 @@ ...@@ -19,12 +19,14 @@
// Global select screen window component, object variable for creation. // Global select screen window component, object variable for creation.
var keyboardShortcutTableWindowComponent var keyboardShortcutTableWindowComponent
var keyboardShortcutTableWindowObject var keyboardShortcutTableWindowObject
var mainWindow
function createKeyboardShortcutTableWindowObject() { function createKeyboardShortcutTableWindowObject(appWindow) {
if (keyboardShortcutTableWindowObject) if (keyboardShortcutTableWindowObject)
return return
keyboardShortcutTableWindowComponent = Qt.createComponent( keyboardShortcutTableWindowComponent = Qt.createComponent(
"../components/KeyboardShortcutTable.qml") "../components/KeyboardShortcutTable.qml")
mainWindow = appWindow
if (keyboardShortcutTableWindowComponent.status === Component.Ready) if (keyboardShortcutTableWindowComponent.status === Component.Ready)
finishCreation() finishCreation()
else if (keyboardShortcutTableWindowComponent.status === Component.Error) else if (keyboardShortcutTableWindowComponent.status === Component.Error)
...@@ -45,12 +47,13 @@ function finishCreation() { ...@@ -45,12 +47,13 @@ function finishCreation() {
function showKeyboardShortcutTableWindow() { function showKeyboardShortcutTableWindow() {
keyboardShortcutTableWindowObject.show() keyboardShortcutTableWindowObject.show()
var centerX = mainWindow.x + mainWindow.width / 2
var centerY = mainWindow.y + mainWindow.height / 2
var screen = keyboardShortcutTableWindowObject.screen keyboardShortcutTableWindowObject.width = 0.75 * appWindow.width
keyboardShortcutTableWindowObject.x = screen.virtualX + keyboardShortcutTableWindowObject.height = 0.75 * appWindow.height
(screen.width - keyboardShortcutTableWindowObject.width) / 2 keyboardShortcutTableWindowObject.x = centerX - keyboardShortcutTableWindowObject.width / 2
keyboardShortcutTableWindowObject.y = screen.virtualY + keyboardShortcutTableWindowObject.y = centerY - keyboardShortcutTableWindowObject.height / 2
(screen.height - keyboardShortcutTableWindowObject.height) / 2
} }
// Destroy and reset selectScreenWindowObject when window is closed. // Destroy and reset selectScreenWindowObject when window is closed.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment