1
0
Fork 0

[UI] Fix screen moving.

This commit is contained in:
Kitteh 2018-11-11 13:31:33 +00:00
parent edff89b22e
commit 01fba29efd

View file

@ -9,7 +9,7 @@ import player 1.0
import "codes.js" as LanguageCodes import "codes.js" as LanguageCodes
Window { ApplicationWindow {
id: mainWindow id: mainWindow
title: titleLabel.text title: titleLabel.text
visible: true visible: true
@ -18,7 +18,6 @@ Window {
Translator { Translator {
id: translate id: translate
} }
screen: Qt.application.screens[0]
property int lastScreenVisibility property int lastScreenVisibility
@ -76,8 +75,6 @@ Window {
player.setOption("sub-back-color", "0.0/0.0/0.0/0.0") player.setOption("sub-back-color", "0.0/0.0/0.0/0.0")
} }
player.setOption("ytdl-format", "bestvideo[width<=" + Screen.width
+ "][height<=" + Screen.height + "]+bestaudio")
if (len > 1) { if (len > 1) {
for (argNo = 1; argNo < len; argNo++) { for (argNo = 1; argNo < len; argNo++) {
var argument = args[argNo] var argument = args[argNo]
@ -88,13 +85,20 @@ Window {
argument = argument.substr(2) argument = argument.substr(2)
if (argument.length > 0) { if (argument.length > 0) {
var splitArg = argument.split(/=(.+)/) var splitArg = argument.split(/=(.+)/)
if (splitArg[0] == "screen") { if (splitArg[0] == "screen" || splitArg[0] == "fs-screen") {
for (var i = 0, len = Qt.application.screens.length; i < len; i++) { for (var i = 0, len = Qt.application.screens.length; i < len; i++) {
var screen = Qt.application.screens[i]; var screen = Qt.application.screens[i];
console.log(screen["name"]) console.log("Screen Name: " + screen["name"] + " Screen Number: " + String(i))
if (screen["name"] == splitArg[1]) { if (screen["name"] == splitArg[1] || String(i) == splitArg[1] ) {
console.log("Switching to window: " + screen["name"]) console.log("Switching to screen: " + screen["name"])
mainWindow.screen = screen mainWindow.screen = screen
mainWindow.width = mainWindow.screen.width / 2
mainWindow.height = mainWindow.screen.height / 2
mainWindow.x = mainWindow.screen.virtualX + mainWindow.width / 2
mainWindow.y = mainWindow.screen.virtualY + mainWindow.height / 2
if (splitArg[0] == "fs-screen" ) {
toggleFullscreen()
}
continue continue
} }
} }