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 {
sequence: "F10"
context: Qt.ApplicationShortcut
onActivated: {
KeyboardShortcutTableCreation.createKeyboardShortcutTableWindowObject()
KeyboardShortcutTableCreation.createKeyboardShortcutTableWindowObject(appWindow)
KeyboardShortcutTableCreation.showKeyboardShortcutTableWindow()
}
}
......
......@@ -241,7 +241,7 @@ Rectangle {
toolTipText: JamiStrings.keyboardShortcuts
onClicked: {
KeyboardShortcutTableCreation.createKeyboardShortcutTableWindowObject()
KeyboardShortcutTableCreation.createKeyboardShortcutTableWindowObject(appWindow)
KeyboardShortcutTableCreation.showKeyboardShortcutTableWindow()
}
}
......
......@@ -19,12 +19,14 @@
// Global select screen window component, object variable for creation.
var keyboardShortcutTableWindowComponent
var keyboardShortcutTableWindowObject
var mainWindow
function createKeyboardShortcutTableWindowObject() {
function createKeyboardShortcutTableWindowObject(appWindow) {
if (keyboardShortcutTableWindowObject)
return
keyboardShortcutTableWindowComponent = Qt.createComponent(
"../components/KeyboardShortcutTable.qml")
mainWindow = appWindow
if (keyboardShortcutTableWindowComponent.status === Component.Ready)
finishCreation()
else if (keyboardShortcutTableWindowComponent.status === Component.Error)
......@@ -45,12 +47,13 @@ function finishCreation() {
function showKeyboardShortcutTableWindow() {
keyboardShortcutTableWindowObject.show()
var centerX = mainWindow.x + mainWindow.width / 2
var centerY = mainWindow.y + mainWindow.height / 2
var screen = keyboardShortcutTableWindowObject.screen
keyboardShortcutTableWindowObject.x = screen.virtualX +
(screen.width - keyboardShortcutTableWindowObject.width) / 2
keyboardShortcutTableWindowObject.y = screen.virtualY +
(screen.height - keyboardShortcutTableWindowObject.height) / 2
keyboardShortcutTableWindowObject.width = 0.75 * appWindow.width
keyboardShortcutTableWindowObject.height = 0.75 * appWindow.height
keyboardShortcutTableWindowObject.x = centerX - keyboardShortcutTableWindowObject.width / 2
keyboardShortcutTableWindowObject.y = centerY - keyboardShortcutTableWindowObject.height / 2
}
// Destroy and reset selectScreenWindowObject when window is closed.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment