[QML] Reformatted code.
This commit is contained in:
parent
59110f590a
commit
8fbe73a718
|
@ -27,13 +27,13 @@ ComboBox {
|
||||||
}
|
}
|
||||||
|
|
||||||
onPaint: {
|
onPaint: {
|
||||||
context.reset();
|
context.reset()
|
||||||
context.moveTo(0, 0);
|
context.moveTo(0, 0)
|
||||||
context.lineTo(width, 0);
|
context.lineTo(width, 0)
|
||||||
context.lineTo(width / 2, height);
|
context.lineTo(width / 2, height)
|
||||||
context.closePath();
|
context.closePath()
|
||||||
context.fillStyle = control.pressed ? "#17a81a" : "#21be2b";
|
context.fillStyle = control.pressed ? "#17a81a" : "#21be2b"
|
||||||
context.fill();
|
context.fill()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,9 +66,13 @@ ComboBox {
|
||||||
implicitHeight: contentHeight
|
implicitHeight: contentHeight
|
||||||
model: control.popup.visible ? control.delegateModel : null
|
model: control.popup.visible ? control.delegateModel : null
|
||||||
currentIndex: control.highlightedIndex
|
currentIndex: control.highlightedIndex
|
||||||
highlight: Rectangle { color: "white"; opacity: 1; }
|
highlight: Rectangle {
|
||||||
|
color: "white"
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
|
||||||
ScrollIndicator.vertical: ScrollIndicator { }
|
ScrollIndicator.vertical: ScrollIndicator {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
|
|
@ -30,4 +30,4 @@ MenuItem {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
color: menuItem.highlighted ? "#c0c0f0" : "transparent"
|
color: menuItem.highlighted ? "#c0c0f0" : "transparent"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
109
src/qml/main.qml
109
src/qml/main.qml
|
@ -91,8 +91,7 @@ ApplicationWindow {
|
||||||
console.log("Updating Track Menu, Total Tracks: " + tracks)
|
console.log("Updating Track Menu, Total Tracks: " + tracks)
|
||||||
for (track = 0; track <= tracks; track++) {
|
for (track = 0; track <= tracks; track++) {
|
||||||
var trackID = player.getProperty("track-list/" + track + "/id")
|
var trackID = player.getProperty("track-list/" + track + "/id")
|
||||||
var trackType = player.getProperty(
|
var trackType = player.getProperty("track-list/" + track + "/type")
|
||||||
"track-list/" + track + "/type")
|
|
||||||
var trackLang = LanguageCodes.localeCodeToEnglish(
|
var trackLang = LanguageCodes.localeCodeToEnglish(
|
||||||
String(player.getProperty(
|
String(player.getProperty(
|
||||||
"track-list/" + track + "/lang")))
|
"track-list/" + track + "/lang")))
|
||||||
|
@ -142,7 +141,9 @@ ApplicationWindow {
|
||||||
player.startPlayer()
|
player.startPlayer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Component.onCompleted: { initTimer.start() }
|
Component.onCompleted: {
|
||||||
|
initTimer.start()
|
||||||
|
}
|
||||||
|
|
||||||
function startPlayer() {
|
function startPlayer() {
|
||||||
var args = Qt.application.arguments
|
var args = Qt.application.arguments
|
||||||
|
@ -153,7 +154,9 @@ ApplicationWindow {
|
||||||
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]
|
||||||
if (argument.indexOf("KittehPlayer") !== -1) { continue; }
|
if (argument.indexOf("KittehPlayer") !== -1) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if (argument.startsWith("--")) {
|
if (argument.startsWith("--")) {
|
||||||
argument = argument.substr(2)
|
argument = argument.substr(2)
|
||||||
if (argument.length > 0) {
|
if (argument.length > 0) {
|
||||||
|
@ -215,12 +218,14 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isAnyMenuOpen() {
|
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() {
|
function hideControls() {
|
||||||
if ( ! isAnyMenuOpen() ) {
|
if (!isAnyMenuOpen()) {
|
||||||
player.setOption("sub-margin-y", "22")
|
//player.setOption("sub-margin-y", "22")
|
||||||
controlsBar.visible = false
|
controlsBar.visible = false
|
||||||
controlsBackground.visible = false
|
controlsBackground.visible = false
|
||||||
titleBar.visible = false
|
titleBar.visible = false
|
||||||
|
@ -230,7 +235,7 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
function showControls() {
|
function showControls() {
|
||||||
if (! controlsBar.visible) {
|
if (!controlsBar.visible) {
|
||||||
updateControls()
|
updateControls()
|
||||||
//player.setOption("sub-margin-y", String(controlsBar.height + progressBar.height))
|
//player.setOption("sub-margin-y", String(controlsBar.height + progressBar.height))
|
||||||
controlsBar.visible = true
|
controlsBar.visible = true
|
||||||
|
@ -381,8 +386,8 @@ ApplicationWindow {
|
||||||
color: "black"
|
color: "black"
|
||||||
opacity: 0.6
|
opacity: 0.6
|
||||||
}
|
}
|
||||||
delegate: CustomMenuItem {}
|
delegate: CustomMenuItem {
|
||||||
|
}
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
text: "Open File"
|
text: "Open File"
|
||||||
|
@ -393,7 +398,6 @@ ApplicationWindow {
|
||||||
text: "Open URI/URL"
|
text: "Open URI/URL"
|
||||||
onTriggered: loadDialog.open()
|
onTriggered: loadDialog.open()
|
||||||
shortcut: keybinds.openURI
|
shortcut: keybinds.openURI
|
||||||
|
|
||||||
}
|
}
|
||||||
Action {
|
Action {
|
||||||
text: "Exit"
|
text: "Exit"
|
||||||
|
@ -412,7 +416,9 @@ ApplicationWindow {
|
||||||
color: "black"
|
color: "black"
|
||||||
opacity: 0.6
|
opacity: 0.6
|
||||||
}
|
}
|
||||||
delegate: CustomMenuItem { width: 100 }
|
delegate: CustomMenuItem {
|
||||||
|
width: 100
|
||||||
|
}
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
text: "Play/Pause"
|
text: "Play/Pause"
|
||||||
|
@ -473,7 +479,8 @@ ApplicationWindow {
|
||||||
Action {
|
Action {
|
||||||
text: "Switch Aspect Ratio"
|
text: "Switch Aspect Ratio"
|
||||||
onTriggered: {
|
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
|
shortcut: keybinds.cycleVideoAspect
|
||||||
}
|
}
|
||||||
|
@ -489,7 +496,9 @@ ApplicationWindow {
|
||||||
color: "black"
|
color: "black"
|
||||||
opacity: 0.6
|
opacity: 0.6
|
||||||
}
|
}
|
||||||
delegate: CustomMenuItem { width: 100 }
|
delegate: CustomMenuItem {
|
||||||
|
width: 100
|
||||||
|
}
|
||||||
Action {
|
Action {
|
||||||
text: "Track Menu"
|
text: "Track Menu"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
@ -539,7 +548,8 @@ ApplicationWindow {
|
||||||
color: "black"
|
color: "black"
|
||||||
opacity: 0.6
|
opacity: 0.6
|
||||||
}
|
}
|
||||||
delegate: CustomMenuItem {}
|
delegate: CustomMenuItem {
|
||||||
|
}
|
||||||
|
|
||||||
Action {
|
Action {
|
||||||
text: "Fullscreen"
|
text: "Fullscreen"
|
||||||
|
@ -552,24 +562,53 @@ ApplicationWindow {
|
||||||
Action {
|
Action {
|
||||||
text: "Stats For Nerds"
|
text: "Stats For Nerds"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
player.command(["script-binding", "stats/display-stats-toggle"])
|
player.command(
|
||||||
|
["script-binding", "stats/display-stats-toggle"])
|
||||||
}
|
}
|
||||||
shortcut: keybinds.statsForNerds
|
shortcut: keybinds.statsForNerds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Action {
|
||||||
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "1";}
|
onTriggered: player.skipToNinth(parseInt(shortcut))
|
||||||
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "2";}
|
shortcut: "1"
|
||||||
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "3";}
|
}
|
||||||
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "4";}
|
Action {
|
||||||
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "5";}
|
onTriggered: player.skipToNinth(parseInt(shortcut))
|
||||||
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "6";}
|
shortcut: "2"
|
||||||
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "7";}
|
}
|
||||||
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "8";}
|
Action {
|
||||||
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "9";}
|
onTriggered: player.skipToNinth(parseInt(shortcut))
|
||||||
Action { onTriggered: player.skipToNinth(parseInt(shortcut)); shortcut: "0";}
|
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 {
|
Rectangle {
|
||||||
|
@ -594,7 +633,6 @@ ApplicationWindow {
|
||||||
border.color: "black"
|
border.color: "black"
|
||||||
border.width: 2
|
border.width: 2
|
||||||
|
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: audioLabel
|
id: audioLabel
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
@ -615,8 +653,8 @@ ApplicationWindow {
|
||||||
id: audioModel
|
id: audioModel
|
||||||
}
|
}
|
||||||
onActivated: {
|
onActivated: {
|
||||||
player.command(["set", "aid", String(
|
player.command(["set", "aid", String(audioModel.get(
|
||||||
audioModel.get(index).value)])
|
index).value)])
|
||||||
}
|
}
|
||||||
opacity: 1
|
opacity: 1
|
||||||
}
|
}
|
||||||
|
@ -641,8 +679,8 @@ ApplicationWindow {
|
||||||
id: subModel
|
id: subModel
|
||||||
}
|
}
|
||||||
onActivated: {
|
onActivated: {
|
||||||
player.command(["set", "sid", String(
|
player.command(["set", "sid", String(subModel.get(
|
||||||
subModel.get(index).value)])
|
index).value)])
|
||||||
}
|
}
|
||||||
opacity: 1
|
opacity: 1
|
||||||
}
|
}
|
||||||
|
@ -667,8 +705,8 @@ ApplicationWindow {
|
||||||
id: vidModel
|
id: vidModel
|
||||||
}
|
}
|
||||||
onActivated: {
|
onActivated: {
|
||||||
player.command(["set", "vid", String(
|
player.command(["set", "vid", String(vidModel.get(
|
||||||
vidModel.get(index).value)])
|
index).value)])
|
||||||
}
|
}
|
||||||
opacity: 1
|
opacity: 1
|
||||||
}
|
}
|
||||||
|
@ -1047,6 +1085,5 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue