1
0
Fork 0

[QML] Reformatted code.

This commit is contained in:
Kitteh 2018-10-24 19:49:05 +01:00
parent 59110f590a
commit 8fbe73a718
3 changed files with 443 additions and 402 deletions

View file

@ -27,13 +27,13 @@ ComboBox {
}
onPaint: {
context.reset();
context.moveTo(0, 0);
context.lineTo(width, 0);
context.lineTo(width / 2, height);
context.closePath();
context.fillStyle = control.pressed ? "#17a81a" : "#21be2b";
context.fill();
context.reset()
context.moveTo(0, 0)
context.lineTo(width, 0)
context.lineTo(width / 2, height)
context.closePath()
context.fillStyle = control.pressed ? "#17a81a" : "#21be2b"
context.fill()
}
}
@ -66,9 +66,13 @@ ComboBox {
implicitHeight: contentHeight
model: control.popup.visible ? control.delegateModel : null
currentIndex: control.highlightedIndex
highlight: Rectangle { color: "white"; opacity: 1; }
highlight: Rectangle {
color: "white"
opacity: 1
}
ScrollIndicator.vertical: ScrollIndicator { }
ScrollIndicator.vertical: ScrollIndicator {
}
}
background: Rectangle {

View file

@ -91,8 +91,7 @@ ApplicationWindow {
console.log("Updating Track Menu, Total Tracks: " + tracks)
for (track = 0; track <= tracks; track++) {
var trackID = player.getProperty("track-list/" + track + "/id")
var trackType = player.getProperty(
"track-list/" + track + "/type")
var trackType = player.getProperty("track-list/" + track + "/type")
var trackLang = LanguageCodes.localeCodeToEnglish(
String(player.getProperty(
"track-list/" + track + "/lang")))
@ -142,7 +141,9 @@ ApplicationWindow {
player.startPlayer()
}
}
Component.onCompleted: { initTimer.start() }
Component.onCompleted: {
initTimer.start()
}
function startPlayer() {
var args = Qt.application.arguments
@ -153,7 +154,9 @@ ApplicationWindow {
if (len > 1) {
for (argNo = 1; argNo < len; argNo++) {
var argument = args[argNo]
if (argument.indexOf("KittehPlayer") !== -1) { continue; }
if (argument.indexOf("KittehPlayer") !== -1) {
continue
}
if (argument.startsWith("--")) {
argument = argument.substr(2)
if (argument.length > 0) {
@ -215,12 +218,14 @@ ApplicationWindow {
}
function isAnyMenuOpen() {
return subtitlesMenu.visible || settingsMenu.visible || fileMenuBarItem.opened || playbackMenuBarItem.opened || viewMenuBarItem.opened || tracksMenuBarItem.opened
return subtitlesMenu.visible || settingsMenu.visible
|| fileMenuBarItem.opened || playbackMenuBarItem.opened
|| viewMenuBarItem.opened || tracksMenuBarItem.opened
}
function hideControls() {
if (!isAnyMenuOpen()) {
player.setOption("sub-margin-y", "22")
//player.setOption("sub-margin-y", "22")
controlsBar.visible = false
controlsBackground.visible = false
titleBar.visible = false
@ -381,8 +386,8 @@ ApplicationWindow {
color: "black"
opacity: 0.6
}
delegate: CustomMenuItem {}
delegate: CustomMenuItem {
}
Action {
text: "Open File"
@ -393,7 +398,6 @@ ApplicationWindow {
text: "Open URI/URL"
onTriggered: loadDialog.open()
shortcut: keybinds.openURI
}
Action {
text: "Exit"
@ -412,7 +416,9 @@ ApplicationWindow {
color: "black"
opacity: 0.6
}
delegate: CustomMenuItem { width: 100 }
delegate: CustomMenuItem {
width: 100
}
Action {
text: "Play/Pause"
@ -473,7 +479,8 @@ ApplicationWindow {
Action {
text: "Switch Aspect Ratio"
onTriggered: {
player.command(["cycle-values", "video-aspect", "16:9", "4:3", "2.35:1", "-1"])
player.command(
["cycle-values", "video-aspect", "16:9", "4:3", "2.35:1", "-1"])
}
shortcut: keybinds.cycleVideoAspect
}
@ -489,7 +496,9 @@ ApplicationWindow {
color: "black"
opacity: 0.6
}
delegate: CustomMenuItem { width: 100 }
delegate: CustomMenuItem {
width: 100
}
Action {
text: "Track Menu"
onTriggered: {
@ -539,7 +548,8 @@ ApplicationWindow {
color: "black"
opacity: 0.6
}
delegate: CustomMenuItem {}
delegate: CustomMenuItem {
}
Action {
text: "Fullscreen"
@ -552,24 +562,53 @@ ApplicationWindow {
Action {
text: "Stats For Nerds"
onTriggered: {
player.command(["script-binding", "stats/display-stats-toggle"])
player.command(
["script-binding", "stats/display-stats-toggle"])
}
shortcut: keybinds.statsForNerds
}
}
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "1";}
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "2";}
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "3";}
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "4";}
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "5";}
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "6";}
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "7";}
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "8";}
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "9";}
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "0";}
Action {
onTriggered: player.skipToNinth(parseInt(shortcut))
shortcut: "1"
}
Action {
onTriggered: player.skipToNinth(parseInt(shortcut))
shortcut: "2"
}
Action {
onTriggered: player.skipToNinth(parseInt(shortcut))
shortcut: "3"
}
Action {
onTriggered: player.skipToNinth(parseInt(shortcut))
shortcut: "4"
}
Action {
onTriggered: player.skipToNinth(parseInt(shortcut))
shortcut: "5"
}
Action {
onTriggered: player.skipToNinth(parseInt(shortcut))
shortcut: "6"
}
Action {
onTriggered: player.skipToNinth(parseInt(shortcut))
shortcut: "7"
}
Action {
onTriggered: player.skipToNinth(parseInt(shortcut))
shortcut: "8"
}
Action {
onTriggered: player.skipToNinth(parseInt(shortcut))
shortcut: "9"
}
Action {
onTriggered: player.skipToNinth(parseInt(shortcut))
shortcut: "0"
}
}
Rectangle {
@ -594,7 +633,6 @@ ApplicationWindow {
border.color: "black"
border.width: 2
Text {
id: audioLabel
anchors.left: parent.left
@ -615,8 +653,8 @@ ApplicationWindow {
id: audioModel
}
onActivated: {
player.command(["set", "aid", String(
audioModel.get(index).value)])
player.command(["set", "aid", String(audioModel.get(
index).value)])
}
opacity: 1
}
@ -641,8 +679,8 @@ ApplicationWindow {
id: subModel
}
onActivated: {
player.command(["set", "sid", String(
subModel.get(index).value)])
player.command(["set", "sid", String(subModel.get(
index).value)])
}
opacity: 1
}
@ -667,8 +705,8 @@ ApplicationWindow {
id: vidModel
}
onActivated: {
player.command(["set", "vid", String(
vidModel.get(index).value)])
player.command(["set", "vid", String(vidModel.get(
index).value)])
}
opacity: 1
}
@ -1047,6 +1085,5 @@ ApplicationWindow {
}
}
}
}
}