[UI] Moved PlaylistDialog into it's own file.
This commit is contained in:
parent
afba6a63d2
commit
37158fbcad
5
format-code.sh
Executable file
5
format-code.sh
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||||
|
pushd $SOURCE_DIR
|
||||||
|
qmlfmt -w src/qml/*.qml
|
||||||
|
clang-format -style mozilla -i src/*
|
||||||
|
popd
|
|
@ -435,7 +435,8 @@ DirectMpvPlayerBackend::playerCommand(const Enums::Commands& cmd,
|
||||||
|
|
||||||
case Enums::Commands::SetPlaylistPos: {
|
case Enums::Commands::SetPlaylistPos: {
|
||||||
|
|
||||||
command(QVariantList() << "set" << "playlist-pos" << args);
|
command(QVariantList() << "set"
|
||||||
|
<< "playlist-pos" << args);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -425,7 +425,8 @@ MpvPlayerBackend::playerCommand(const Enums::Commands& cmd,
|
||||||
|
|
||||||
case Enums::Commands::SetPlaylistPos: {
|
case Enums::Commands::SetPlaylistPos: {
|
||||||
|
|
||||||
command(QVariantList() << "set" << "playlist-pos" << args);
|
command(QVariantList() << "set"
|
||||||
|
<< "playlist-pos" << args);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,6 @@ signals:
|
||||||
void audioDevicesChanged();
|
void audioDevicesChanged();
|
||||||
void playlistChanged();
|
void playlistChanged();
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void doUpdate();
|
void doUpdate();
|
||||||
void on_mpv_events();
|
void on_mpv_events();
|
||||||
|
|
|
@ -68,7 +68,7 @@ Item {
|
||||||
height: subsContainer.childrenRect.height
|
height: subsContainer.childrenRect.height
|
||||||
}
|
}
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
player.subtitlesChanged.connect(function(subtitles) {
|
player.subtitlesChanged.connect(function (subtitles) {
|
||||||
text = subtitles
|
text = subtitles
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,9 @@ Item {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: controlsBackground
|
id: controlsBackground
|
||||||
height: controlsBar.visible ? controlsBar.height + (fun.nyanCat ? progressBackground.height * 0.3: progressBackground.height * 2) : 0
|
height: controlsBar.visible ? controlsBar.height
|
||||||
|
+ (fun.nyanCat ? progressBackground.height
|
||||||
|
* 0.3 : progressBackground.height * 2) : 0
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
@ -111,13 +113,15 @@ Item {
|
||||||
anchors.topMargin: progressBackground.height
|
anchors.topMargin: progressBackground.height
|
||||||
bottomPadding: 0
|
bottomPadding: 0
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
player.positionChanged.connect(function(position) {
|
player.positionChanged.connect(function (position) {
|
||||||
if (! pressed) {progressBar.value = position}
|
if (!pressed) {
|
||||||
|
progressBar.value = position
|
||||||
|
}
|
||||||
})
|
})
|
||||||
player.durationChanged.connect(function(duration) {
|
player.durationChanged.connect(function (duration) {
|
||||||
progressBar.to = duration
|
progressBar.to = duration
|
||||||
})
|
})
|
||||||
player.cachedDurationChanged.connect(function(duration) {
|
player.cachedDurationChanged.connect(function (duration) {
|
||||||
cachedLength.value = progressBar.value + duration
|
cachedLength.value = progressBar.value + duration
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -153,7 +157,8 @@ Item {
|
||||||
color: appearance.progressBackgroundColor
|
color: appearance.progressBackgroundColor
|
||||||
ProgressBar {
|
ProgressBar {
|
||||||
id: cachedLength
|
id: cachedLength
|
||||||
background: Item {}
|
background: Item {
|
||||||
|
}
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: cachedLength.visualPosition * parent.width
|
width: cachedLength.visualPosition * parent.width
|
||||||
|
@ -174,10 +179,12 @@ Item {
|
||||||
value: progressBar.value
|
value: progressBar.value
|
||||||
opacity: 1
|
opacity: 1
|
||||||
anchors.leftMargin: 0
|
anchors.leftMargin: 0
|
||||||
background: Item {}
|
background: Item {
|
||||||
|
}
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: progressLength.visualPosition * parent.width + progressBar.handle.width / 2
|
width: progressLength.visualPosition * parent.width
|
||||||
|
+ progressBar.handle.width / 2
|
||||||
height: parent.height
|
height: parent.height
|
||||||
color: appearance.progressSliderColor
|
color: appearance.progressSliderColor
|
||||||
Image {
|
Image {
|
||||||
|
@ -217,186 +224,193 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: layout
|
id: layout
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 2
|
spacing: 2
|
||||||
|
|
||||||
|
Button {
|
||||||
Button {
|
id: playlistPrevButton
|
||||||
id: playlistPrevButton
|
objectName: "playlistPrevButton"
|
||||||
objectName: "playlistPrevButton"
|
icon.source: "icons/prev.svg"
|
||||||
icon.source: "icons/prev.svg"
|
icon.color: appearance.buttonColor
|
||||||
icon.color: appearance.buttonColor
|
display: AbstractButton.IconOnly
|
||||||
display: AbstractButton.IconOnly
|
visible: false
|
||||||
visible: false
|
width: visible ? playPauseButton.width : 0
|
||||||
width: visible ? playPauseButton.width : 0
|
onClicked: {
|
||||||
onClicked: {
|
player.playerCommand(Enums.Commands.PreviousPlaylistItem)
|
||||||
player.playerCommand(Enums.Commands.PreviousPlaylistItem)
|
}
|
||||||
|
background: Item {
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
player.playlistPositionChanged.connect(function (position) {
|
||||||
|
if (position != 0) {
|
||||||
|
visible = true
|
||||||
|
} else {
|
||||||
|
visible = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
background: Item {}
|
|
||||||
Component.onCompleted: {
|
Button {
|
||||||
player.playlistPositionChanged.connect(function(position) {
|
id: playPauseButton
|
||||||
if (position != 0 ) {
|
icon.source: "icons/pause.svg"
|
||||||
visible = true
|
icon.color: appearance.buttonColor
|
||||||
} else {
|
display: AbstractButton.IconOnly
|
||||||
visible = false
|
onClicked: {
|
||||||
|
player.playerCommand(Enums.Commands.TogglePlayPause)
|
||||||
|
}
|
||||||
|
background: Item {
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
player.playStatusChanged.connect(function (status) {
|
||||||
|
if (status == Enums.PlayStatus.Playing) {
|
||||||
|
icon.source = "qrc:/player/icons/pause.svg"
|
||||||
|
} else if (status == Enums.PlayStatus.Paused) {
|
||||||
|
icon.source = "qrc:/player/icons/play.svg"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: playlistNextButton
|
||||||
|
//icon.name: "next"
|
||||||
|
icon.source: "icons/next.svg"
|
||||||
|
icon.color: appearance.buttonColor
|
||||||
|
display: AbstractButton.IconOnly
|
||||||
|
onClicked: {
|
||||||
|
player.playerCommand(Enums.Commands.NextPlaylistItem)
|
||||||
|
}
|
||||||
|
background: Item {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: volumeButton
|
||||||
|
objectName: "volumeButton"
|
||||||
|
icon.source: "icons/volume-up.svg"
|
||||||
|
icon.color: appearance.buttonColor
|
||||||
|
display: AbstractButton.IconOnly
|
||||||
|
onClicked: {
|
||||||
|
player.playerCommand(Enums.Commands.ToggleMute)
|
||||||
|
}
|
||||||
|
background: Item {
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
player.volumeStatusChanged.connect(function (status) {
|
||||||
|
if (status == Enums.VolumeStatus.Muted) {
|
||||||
|
volumeButton.icon.source = "qrc:/player/icons/volume-mute.svg"
|
||||||
|
} else if (status == Enums.VolumeStatus.Low) {
|
||||||
|
volumeButton.icon.source = "qrc:/player/icons/volume-down.svg"
|
||||||
|
} else if (status == Enums.VolumeStatus.Normal) {
|
||||||
|
volumeButton.icon.source = "qrc:/player/icons/volume-up.svg"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Slider {
|
||||||
|
id: volumeBar
|
||||||
|
to: 100
|
||||||
|
value: 100
|
||||||
|
palette.dark: "#f00"
|
||||||
|
|
||||||
|
implicitWidth: Math.max(
|
||||||
|
background ? background.implicitWidth : 0,
|
||||||
|
(handle ? handle.implicitWidth : 0)
|
||||||
|
+ leftPadding + rightPadding)
|
||||||
|
implicitHeight: Math.max(
|
||||||
|
background ? background.implicitHeight : 0,
|
||||||
|
(handle ? handle.implicitHeight : 0)
|
||||||
|
+ topPadding + bottomPadding)
|
||||||
|
onMoved: {
|
||||||
|
player.playerCommand(Enums.Commands.SetVolume,
|
||||||
|
Math.round(volumeBar.value).toString())
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
player.volumeChanged.connect(function (volume) {
|
||||||
|
volumeBar.value = volume
|
||||||
|
})
|
||||||
|
}
|
||||||
|
handle: Rectangle {
|
||||||
|
x: volumeBar.leftPadding + volumeBar.visualPosition
|
||||||
|
* (volumeBar.availableWidth - width)
|
||||||
|
y: volumeBar.topPadding + volumeBar.availableHeight / 2 - height / 2
|
||||||
|
implicitWidth: 12
|
||||||
|
implicitHeight: 12
|
||||||
|
radius: 12
|
||||||
|
color: "#f6f6f6"
|
||||||
|
border.color: "#f6f6f6"
|
||||||
|
}
|
||||||
|
|
||||||
|
background: Rectangle {
|
||||||
|
x: volumeBar.leftPadding
|
||||||
|
y: volumeBar.topPadding + volumeBar.availableHeight / 2 - height / 2
|
||||||
|
implicitWidth: 60
|
||||||
|
implicitHeight: 3
|
||||||
|
width: volumeBar.availableWidth
|
||||||
|
height: implicitHeight
|
||||||
|
color: "#33333311"
|
||||||
|
Rectangle {
|
||||||
|
width: volumeBar.visualPosition * parent.width
|
||||||
|
height: parent.height
|
||||||
|
color: "white"
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: playPauseButton
|
|
||||||
icon.source: "icons/pause.svg"
|
|
||||||
icon.color: appearance.buttonColor
|
|
||||||
display: AbstractButton.IconOnly
|
|
||||||
onClicked: {
|
|
||||||
player.playerCommand(Enums.Commands.TogglePlayPause)
|
|
||||||
}
|
|
||||||
background: Item {}
|
|
||||||
Component.onCompleted: {
|
|
||||||
player.playStatusChanged.connect(function(status) {
|
|
||||||
if (status == Enums.PlayStatus.Playing) {
|
|
||||||
icon.source = "qrc:/player/icons/pause.svg"
|
|
||||||
} else if (status == Enums.PlayStatus.Paused) {
|
|
||||||
icon.source = "qrc:/player/icons/play.svg"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: playlistNextButton
|
|
||||||
//icon.name: "next"
|
|
||||||
icon.source: "icons/next.svg"
|
|
||||||
icon.color: appearance.buttonColor
|
|
||||||
display: AbstractButton.IconOnly
|
|
||||||
onClicked: {
|
|
||||||
player.playerCommand(Enums.Commands.NextPlaylistItem)
|
|
||||||
}
|
|
||||||
background: Item {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: volumeButton
|
|
||||||
objectName: "volumeButton"
|
|
||||||
icon.source: "icons/volume-up.svg"
|
|
||||||
icon.color: appearance.buttonColor
|
|
||||||
display: AbstractButton.IconOnly
|
|
||||||
onClicked: {
|
|
||||||
player.playerCommand(Enums.Commands.ToggleMute)
|
|
||||||
}
|
|
||||||
background: Item {}
|
|
||||||
Component.onCompleted: {
|
|
||||||
player.volumeStatusChanged.connect(function(status) {
|
|
||||||
if (status == Enums.VolumeStatus.Muted) {
|
|
||||||
volumeButton.icon.source = "qrc:/player/icons/volume-mute.svg"
|
|
||||||
} else if (status == Enums.VolumeStatus.Low) {
|
|
||||||
volumeButton.icon.source = "qrc:/player/icons/volume-down.svg"
|
|
||||||
} else if (status == Enums.VolumeStatus.Normal) {
|
|
||||||
volumeButton.icon.source = "qrc:/player/icons/volume-up.svg"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Slider {
|
|
||||||
id: volumeBar
|
|
||||||
to: 100
|
|
||||||
value: 100
|
|
||||||
palette.dark: "#f00"
|
|
||||||
|
|
||||||
implicitWidth: Math.max(
|
|
||||||
background ? background.implicitWidth : 0,
|
|
||||||
(handle ? handle.implicitWidth : 0)
|
|
||||||
+ leftPadding + rightPadding)
|
|
||||||
implicitHeight: Math.max(
|
|
||||||
background ? background.implicitHeight : 0,
|
|
||||||
(handle ? handle.implicitHeight : 0)
|
|
||||||
+ topPadding + bottomPadding)
|
|
||||||
onMoved: {
|
|
||||||
player.playerCommand(Enums.Commands.SetVolume, Math.round(volumeBar.value).toString())
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
player.volumeChanged.connect(function(volume) {
|
|
||||||
volumeBar.value = volume
|
|
||||||
})
|
|
||||||
}
|
|
||||||
handle: Rectangle {
|
|
||||||
x: volumeBar.leftPadding + volumeBar.visualPosition
|
|
||||||
* (volumeBar.availableWidth - width)
|
|
||||||
y: volumeBar.topPadding + volumeBar.availableHeight / 2 - height / 2
|
|
||||||
implicitWidth: 12
|
|
||||||
implicitHeight: 12
|
|
||||||
radius: 12
|
|
||||||
color: "#f6f6f6"
|
|
||||||
border.color: "#f6f6f6"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
Text {
|
||||||
x: volumeBar.leftPadding
|
id: timeLabel
|
||||||
y: volumeBar.topPadding + volumeBar.availableHeight / 2 - height / 2
|
objectName: "timeLabel"
|
||||||
implicitWidth: 60
|
text: "0:00 / 0:00"
|
||||||
implicitHeight: 3
|
color: "white"
|
||||||
width: volumeBar.availableWidth
|
padding: 2
|
||||||
height: implicitHeight
|
font.family: appearance.fontName
|
||||||
color: "#33333311"
|
font.pixelSize: 14
|
||||||
Rectangle {
|
verticalAlignment: Text.AlignVCenter
|
||||||
width: volumeBar.visualPosition * parent.width
|
renderType: Text.NativeRendering
|
||||||
height: parent.height
|
Component.onCompleted: {
|
||||||
color: "white"
|
player.durationStringChanged.connect(
|
||||||
|
function (durationString) {
|
||||||
|
text = durationString
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: settingsButton
|
||||||
|
//icon.name: "settings"
|
||||||
|
icon.source: "icons/settings.svg"
|
||||||
|
icon.color: appearance.buttonColor
|
||||||
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
||||||
|
display: AbstractButton.IconOnly
|
||||||
|
onClicked: {
|
||||||
|
console.log("Settings Menu Not Yet Implemented.")
|
||||||
|
}
|
||||||
|
background: Item {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: fullscreenButton
|
||||||
|
//icon.name: "fullscreen"
|
||||||
|
icon.source: "icons/fullscreen.svg"
|
||||||
|
icon.color: appearance.buttonColor
|
||||||
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
||||||
|
|
||||||
|
display: AbstractButton.IconOnly
|
||||||
|
onClicked: {
|
||||||
|
toggleFullscreen()
|
||||||
|
}
|
||||||
|
|
||||||
|
background: Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
|
||||||
id: timeLabel
|
|
||||||
objectName: "timeLabel"
|
|
||||||
text: "0:00 / 0:00"
|
|
||||||
color: "white"
|
|
||||||
padding: 2
|
|
||||||
font.family: appearance.fontName
|
|
||||||
font.pixelSize: 14
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
renderType: Text.NativeRendering
|
|
||||||
Component.onCompleted: {
|
|
||||||
player.durationStringChanged.connect(function(durationString) {
|
|
||||||
text = durationString
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: settingsButton
|
|
||||||
//icon.name: "settings"
|
|
||||||
icon.source: "icons/settings.svg"
|
|
||||||
icon.color: appearance.buttonColor
|
|
||||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
|
||||||
display: AbstractButton.IconOnly
|
|
||||||
onClicked: {
|
|
||||||
console.log("Settings Menu Not Yet Implemented.")
|
|
||||||
}
|
|
||||||
background: Item {}
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
id: fullscreenButton
|
|
||||||
//icon.name: "fullscreen"
|
|
||||||
icon.source: "icons/fullscreen.svg"
|
|
||||||
icon.color: appearance.buttonColor
|
|
||||||
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
|
|
||||||
|
|
||||||
display: AbstractButton.IconOnly
|
|
||||||
onClicked: {
|
|
||||||
toggleFullscreen()
|
|
||||||
}
|
|
||||||
|
|
||||||
background: Item {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,9 @@ MenuBar {
|
||||||
height: Screen.height / 32
|
height: Screen.height / 32
|
||||||
function anythingOpen() {
|
function anythingOpen() {
|
||||||
for (var i = 0, len = menuBar.count; i < len; i++) {
|
for (var i = 0, len = menuBar.count; i < len; i++) {
|
||||||
if (menuBar.menuAt(i).opened) { return true }
|
if (menuBar.menuAt(i).opened) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +103,8 @@ MenuBar {
|
||||||
title: translate.getTranslation("OPEN_FILE", i18n.language)
|
title: translate.getTranslation("OPEN_FILE", i18n.language)
|
||||||
nameFilters: ["All files (*)"]
|
nameFilters: ["All files (*)"]
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
player.playerCommand(Enums.Commands.LoadFile, String(fileDialog.file))
|
player.playerCommand(Enums.Commands.LoadFile,
|
||||||
|
String(fileDialog.file))
|
||||||
fileDialog.close()
|
fileDialog.close()
|
||||||
}
|
}
|
||||||
onRejected: {
|
onRejected: {
|
||||||
|
@ -124,87 +127,8 @@ MenuBar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog {
|
PlaylistDialog {
|
||||||
id: playlistDialog
|
id: playlistDialog
|
||||||
title: "Playlist"
|
|
||||||
height: 480
|
|
||||||
width: 720
|
|
||||||
modality: Qt.NonModal
|
|
||||||
|
|
||||||
onAccepted: {
|
|
||||||
console.log("ok")
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
player.titleChanged.connect(updatePlaylistMenu)
|
|
||||||
player.playlistChanged.connect(updatePlaylistMenu)
|
|
||||||
}
|
|
||||||
function updatePlaylistMenu() {
|
|
||||||
var playlist = player.playerCommand(Enums.Commands.GetPlaylist)
|
|
||||||
playlistModel.clear()
|
|
||||||
for (var thing in playlist) {
|
|
||||||
var item = playlist[thing]
|
|
||||||
playlistModel.append({
|
|
||||||
"playlistItemTitle": item["title"],
|
|
||||||
"playlistItemFilename": item["filename"],
|
|
||||||
"current": item["current"],
|
|
||||||
"playlistPos": thing
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: playlistDelegate
|
|
||||||
Item {
|
|
||||||
id: playlistItem
|
|
||||||
width: playlistDialog.width; height: 0
|
|
||||||
Button {
|
|
||||||
height: parent.height
|
|
||||||
id: playlistItemButton
|
|
||||||
font.pixelSize: 12
|
|
||||||
contentItem: Text {
|
|
||||||
id: playlistItemText
|
|
||||||
font: parent.font
|
|
||||||
color: "white"
|
|
||||||
text: playlistItemButton.text
|
|
||||||
height: parent.height
|
|
||||||
horizontalAlignment: Text.AlignLeft
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
elide: Text.ElideRight
|
|
||||||
}
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
player.playerCommand(Enums.Commands.SetPlaylistPos, playlistPos)
|
|
||||||
}
|
|
||||||
background: Rectangle { color: current ? "orange" : "transparent" }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
var itemText = ""
|
|
||||||
if (typeof playlistItemTitle !== "undefined") {
|
|
||||||
itemText += '<b>Title:</b> ' + playlistItemTitle + "<br>"
|
|
||||||
playlistItem.height += 30
|
|
||||||
}
|
|
||||||
if (typeof playlistItemFilename !== "undefined") {
|
|
||||||
itemText += '<b>Filename:</b> ' + playlistItemFilename + "<br>"
|
|
||||||
playlistItem.height += 30
|
|
||||||
}
|
|
||||||
playlistItemText.text = itemText
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ListView {
|
|
||||||
id: playlistListView
|
|
||||||
anchors.fill: parent
|
|
||||||
model: ListModel { id: playlistModel }
|
|
||||||
delegate: playlistDelegate
|
|
||||||
highlight: Item {}
|
|
||||||
focus: true
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: MenuBarItem {
|
delegate: MenuBarItem {
|
||||||
|
@ -423,7 +347,8 @@ MenuBar {
|
||||||
player.audioDevicesChanged.connect(updateAudioDevices)
|
player.audioDevicesChanged.connect(updateAudioDevices)
|
||||||
}
|
}
|
||||||
function updateAudioDevices() {
|
function updateAudioDevices() {
|
||||||
var audioDevices = player.playerCommand(Enums.Commands.GetAudioDevices)
|
var audioDevices = player.playerCommand(
|
||||||
|
Enums.Commands.GetAudioDevices)
|
||||||
|
|
||||||
for (var i = 0, len = audioDeviceMenu.count; i < len; i++) {
|
for (var i = 0, len = audioDeviceMenu.count; i < len; i++) {
|
||||||
audioDeviceMenu.takeAction(0)
|
audioDeviceMenu.takeAction(0)
|
||||||
|
@ -564,8 +489,7 @@ MenuBar {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Action {
|
Action {
|
||||||
text: translate.getTranslation("PLAYLIST_MENU",
|
text: translate.getTranslation("PLAYLIST_MENU", i18n.language)
|
||||||
i18n.language)
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
playlistDialog.open()
|
playlistDialog.open()
|
||||||
}
|
}
|
||||||
|
|
91
src/qml/PlaylistDialog.qml
Normal file
91
src/qml/PlaylistDialog.qml
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
import QtQuick 2.11
|
||||||
|
import QtQuick.Controls 2.4
|
||||||
|
import QtQuick.Dialogs 1.3
|
||||||
|
import QtQuick.Window 2.11
|
||||||
|
import Qt.labs.settings 1.0
|
||||||
|
import Qt.labs.platform 1.0 as LabsPlatform
|
||||||
|
import player 1.0
|
||||||
|
|
||||||
|
Dialog {
|
||||||
|
id: playlistDialog
|
||||||
|
title: "Playlist"
|
||||||
|
height: Math.max(480, childrenRect.height * playlistListView.count)
|
||||||
|
width: 720
|
||||||
|
modality: Qt.NonModal
|
||||||
|
Component.onCompleted: {
|
||||||
|
player.titleChanged.connect(updatePlaylistMenu)
|
||||||
|
player.playlistChanged.connect(updatePlaylistMenu)
|
||||||
|
}
|
||||||
|
function updatePlaylistMenu() {
|
||||||
|
var playlist = player.playerCommand(Enums.Commands.GetPlaylist)
|
||||||
|
playlistModel.clear()
|
||||||
|
for (var thing in playlist) {
|
||||||
|
var item = playlist[thing]
|
||||||
|
playlistModel.append({
|
||||||
|
playlistItemTitle: item["title"],
|
||||||
|
playlistItemFilename: item["filename"],
|
||||||
|
current: item["current"],
|
||||||
|
playlistPos: thing
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: playlistDelegate
|
||||||
|
Item {
|
||||||
|
id: playlistItem
|
||||||
|
width: playlistDialog.width
|
||||||
|
height: childrenRect.height
|
||||||
|
Button {
|
||||||
|
width: parent.width
|
||||||
|
id: playlistItemButton
|
||||||
|
font.pixelSize: 12
|
||||||
|
padding: 0
|
||||||
|
bottomPadding: 0
|
||||||
|
contentItem: Text {
|
||||||
|
id: playlistItemText
|
||||||
|
font: parent.font
|
||||||
|
bottomPadding: 0
|
||||||
|
color: "white"
|
||||||
|
text: playlistItemButton.text
|
||||||
|
height: parent.height
|
||||||
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
elide: Text.ElideRight
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
player.playerCommand(Enums.Commands.SetPlaylistPos,
|
||||||
|
playlistPos)
|
||||||
|
}
|
||||||
|
background: Rectangle {
|
||||||
|
color: current ? "orange" : "transparent"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
var itemText = ""
|
||||||
|
if (typeof playlistItemTitle !== "undefined") {
|
||||||
|
itemText += '<b>Title:</b> ' + playlistItemTitle + "<br>"
|
||||||
|
}
|
||||||
|
if (typeof playlistItemFilename !== "undefined") {
|
||||||
|
itemText += '<b>Filename:</b> ' + playlistItemFilename
|
||||||
|
}
|
||||||
|
playlistItemText.text = itemText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: playlistListView
|
||||||
|
anchors.fill: parent
|
||||||
|
model: ListModel {
|
||||||
|
id: playlistModel
|
||||||
|
}
|
||||||
|
delegate: playlistDelegate
|
||||||
|
highlight: Item {
|
||||||
|
}
|
||||||
|
focus: true
|
||||||
|
}
|
||||||
|
}
|
198
src/qml/main.qml
198
src/qml/main.qml
|
@ -19,85 +19,84 @@ ApplicationWindow {
|
||||||
id: translate
|
id: translate
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings {
|
Settings {
|
||||||
id: appearance
|
id: appearance
|
||||||
category: "Appearance"
|
category: "Appearance"
|
||||||
property bool titleOnlyOnFullscreen: true
|
property bool titleOnlyOnFullscreen: true
|
||||||
property bool clickToPause: true
|
property bool clickToPause: true
|
||||||
property bool useMpvSubs: false
|
property bool useMpvSubs: false
|
||||||
property string fontName: "Roboto"
|
property string fontName: "Roboto"
|
||||||
property string mainBackground: "#9C000000"
|
property string mainBackground: "#9C000000"
|
||||||
property string progressBackgroundColor: "#3CFFFFFF"
|
property string progressBackgroundColor: "#3CFFFFFF"
|
||||||
property string progressCachedColor: "white"
|
property string progressCachedColor: "white"
|
||||||
property string buttonColor: "white"
|
property string buttonColor: "white"
|
||||||
property string progressSliderColor: "red"
|
property string progressSliderColor: "red"
|
||||||
}
|
}
|
||||||
Settings {
|
Settings {
|
||||||
id: i18n
|
id: i18n
|
||||||
category: "I18N"
|
category: "I18N"
|
||||||
property string language: "english"
|
property string language: "english"
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings {
|
Settings {
|
||||||
id: fun
|
id: fun
|
||||||
category: "Fun"
|
category: "Fun"
|
||||||
property bool nyanCat: false
|
property bool nyanCat: false
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings {
|
|
||||||
id: keybinds
|
|
||||||
category: "Keybinds"
|
|
||||||
property string playPause: "K"
|
|
||||||
property string forward10: "L"
|
|
||||||
property string rewind10: "J"
|
|
||||||
property string forward5: "Right"
|
|
||||||
property string rewind5: "Left"
|
|
||||||
property string openFile: "Ctrl+O"
|
|
||||||
property string openURI: "Ctrl+Shift+O"
|
|
||||||
property string quit: "Ctrl+Q"
|
|
||||||
property string fullscreen: "F"
|
|
||||||
property string tracks: "Ctrl+T"
|
|
||||||
property string statsForNerds: "I"
|
|
||||||
property string forwardFrame: "."
|
|
||||||
property string backwardFrame: ","
|
|
||||||
property string cycleSub: "Alt+S"
|
|
||||||
property string cycleSubBackwards: "Alt+Shift+S"
|
|
||||||
property string cycleAudio: "A"
|
|
||||||
property string cycleVideo: "V"
|
|
||||||
property string cycleVideoAspect: "Shift+A"
|
|
||||||
property string screenshot: "S"
|
|
||||||
property string screenshotWithoutSubtitles: "Shift+S"
|
|
||||||
property string fullScreenshot: "Ctrl+S"
|
|
||||||
property string nyanCat: "Ctrl+N"
|
|
||||||
property string decreaseSpeedByPointOne: "["
|
|
||||||
property string increaseSpeedByPointOne: "]"
|
|
||||||
property string halveSpeed: "{"
|
|
||||||
property string doubleSpeed: "}"
|
|
||||||
property string increaseVolume: "*"
|
|
||||||
property string decreaseVolume: "/"
|
|
||||||
property string mute: "m"
|
|
||||||
property string customKeybind0: ""
|
|
||||||
property string customKeybind0Command: ""
|
|
||||||
property string customKeybind1: ""
|
|
||||||
property string customKeybind1Command: ""
|
|
||||||
property string customKeybind2: ""
|
|
||||||
property string customKeybind2Command: ""
|
|
||||||
property string customKeybind3: ""
|
|
||||||
property string customKeybind3Command: ""
|
|
||||||
property string customKeybind4: ""
|
|
||||||
property string customKeybind4Command: ""
|
|
||||||
property string customKeybind5: ""
|
|
||||||
property string customKeybind5Command: ""
|
|
||||||
property string customKeybind6: ""
|
|
||||||
property string customKeybind6Command: ""
|
|
||||||
property string customKeybind7: ""
|
|
||||||
property string customKeybind7Command: ""
|
|
||||||
property string customKeybind8: ""
|
|
||||||
property string customKeybind8Command: ""
|
|
||||||
property string customKeybind9: ""
|
|
||||||
property string customKeybind9Command: ""
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Settings {
|
||||||
|
id: keybinds
|
||||||
|
category: "Keybinds"
|
||||||
|
property string playPause: "K"
|
||||||
|
property string forward10: "L"
|
||||||
|
property string rewind10: "J"
|
||||||
|
property string forward5: "Right"
|
||||||
|
property string rewind5: "Left"
|
||||||
|
property string openFile: "Ctrl+O"
|
||||||
|
property string openURI: "Ctrl+Shift+O"
|
||||||
|
property string quit: "Ctrl+Q"
|
||||||
|
property string fullscreen: "F"
|
||||||
|
property string tracks: "Ctrl+T"
|
||||||
|
property string statsForNerds: "I"
|
||||||
|
property string forwardFrame: "."
|
||||||
|
property string backwardFrame: ","
|
||||||
|
property string cycleSub: "Alt+S"
|
||||||
|
property string cycleSubBackwards: "Alt+Shift+S"
|
||||||
|
property string cycleAudio: "A"
|
||||||
|
property string cycleVideo: "V"
|
||||||
|
property string cycleVideoAspect: "Shift+A"
|
||||||
|
property string screenshot: "S"
|
||||||
|
property string screenshotWithoutSubtitles: "Shift+S"
|
||||||
|
property string fullScreenshot: "Ctrl+S"
|
||||||
|
property string nyanCat: "Ctrl+N"
|
||||||
|
property string decreaseSpeedByPointOne: "["
|
||||||
|
property string increaseSpeedByPointOne: "]"
|
||||||
|
property string halveSpeed: "{"
|
||||||
|
property string doubleSpeed: "}"
|
||||||
|
property string increaseVolume: "*"
|
||||||
|
property string decreaseVolume: "/"
|
||||||
|
property string mute: "m"
|
||||||
|
property string customKeybind0: ""
|
||||||
|
property string customKeybind0Command: ""
|
||||||
|
property string customKeybind1: ""
|
||||||
|
property string customKeybind1Command: ""
|
||||||
|
property string customKeybind2: ""
|
||||||
|
property string customKeybind2Command: ""
|
||||||
|
property string customKeybind3: ""
|
||||||
|
property string customKeybind3Command: ""
|
||||||
|
property string customKeybind4: ""
|
||||||
|
property string customKeybind4Command: ""
|
||||||
|
property string customKeybind5: ""
|
||||||
|
property string customKeybind5Command: ""
|
||||||
|
property string customKeybind6: ""
|
||||||
|
property string customKeybind6Command: ""
|
||||||
|
property string customKeybind7: ""
|
||||||
|
property string customKeybind7Command: ""
|
||||||
|
property string customKeybind8: ""
|
||||||
|
property string customKeybind8Command: ""
|
||||||
|
property string customKeybind9: ""
|
||||||
|
property string customKeybind9Command: ""
|
||||||
|
}
|
||||||
|
|
||||||
property int lastScreenVisibility
|
property int lastScreenVisibility
|
||||||
|
|
||||||
|
@ -120,7 +119,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
function startPlayer() {
|
function startPlayer() {
|
||||||
console.log(player)
|
console.log(player)
|
||||||
console.log(typeof(player))
|
console.log(typeof (player))
|
||||||
var args = Qt.application.arguments
|
var args = Qt.application.arguments
|
||||||
var len = Qt.application.arguments.length
|
var len = Qt.application.arguments.length
|
||||||
var argNo = 0
|
var argNo = 0
|
||||||
|
@ -149,18 +148,24 @@ ApplicationWindow {
|
||||||
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" || splitArg[0] == "fs-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: " + screen["name"] + " Screen Number: " + String(i))
|
console.log("Screen Name: " + screen["name"]
|
||||||
if (screen["name"] == splitArg[1] || String(i) == splitArg[1] ) {
|
+ " Screen Number: " + String(
|
||||||
|
i))
|
||||||
|
if (screen["name"] == splitArg[1] || String(
|
||||||
|
i) == splitArg[1]) {
|
||||||
console.log("Switching to screen: " + screen["name"])
|
console.log("Switching to screen: " + screen["name"])
|
||||||
mainWindow.screen = screen
|
mainWindow.screen = screen
|
||||||
mainWindow.width = mainWindow.screen.width / 2
|
mainWindow.width = mainWindow.screen.width / 2
|
||||||
mainWindow.height = mainWindow.screen.height / 2
|
mainWindow.height = mainWindow.screen.height / 2
|
||||||
mainWindow.x = mainWindow.screen.virtualX + mainWindow.width / 2
|
mainWindow.x = mainWindow.screen.virtualX
|
||||||
mainWindow.y = mainWindow.screen.virtualY + mainWindow.height / 2
|
+ mainWindow.width / 2
|
||||||
if (splitArg[0] == "fs-screen" ) {
|
mainWindow.y = mainWindow.screen.virtualY
|
||||||
|
+ mainWindow.height / 2
|
||||||
|
if (splitArg[0] == "fs-screen") {
|
||||||
toggleFullscreen()
|
toggleFullscreen()
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
|
@ -170,16 +175,17 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
if (splitArg[0] == "fullscreen") {
|
if (splitArg[0] == "fullscreen") {
|
||||||
toggleFullscreen()
|
toggleFullscreen()
|
||||||
continue;
|
continue
|
||||||
}
|
}
|
||||||
if (splitArg[1] == undefined || splitArg[1].length == 0) {
|
if (splitArg[1] == undefined
|
||||||
|
|| splitArg[1].length == 0) {
|
||||||
splitArg[1] = "yes"
|
splitArg[1] = "yes"
|
||||||
}
|
}
|
||||||
player.setOption(splitArg[0], splitArg[1])
|
player.setOption(splitArg[0], splitArg[1])
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
player.playerCommand(Enums.Commands.AppendFile, argument)
|
player.playerCommand(Enums.Commands.AppendFile,
|
||||||
|
argument)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,7 +204,6 @@ ApplicationWindow {
|
||||||
mouseAreaPlayer.cursorShape = Qt.ArrowCursor
|
mouseAreaPlayer.cursorShape = Qt.ArrowCursor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
anchors.centerIn: player
|
anchors.centerIn: player
|
||||||
|
@ -239,7 +244,9 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
Action {
|
Action {
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (mainWindow.visibility == Window.FullScreen) {toggleFullscreen()}
|
if (mainWindow.visibility == Window.FullScreen) {
|
||||||
|
toggleFullscreen()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
shortcut: "Esc"
|
shortcut: "Esc"
|
||||||
}
|
}
|
||||||
|
@ -259,7 +266,7 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
Timer {
|
Timer {
|
||||||
id: mouseAreaPlayerTimer
|
id: mouseAreaPlayerTimer
|
||||||
interval: 2000
|
interval: 1000
|
||||||
running: true
|
running: true
|
||||||
repeat: false
|
repeat: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
@ -272,7 +279,6 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MainMenu {
|
MainMenu {
|
||||||
id: menuBar
|
id: menuBar
|
||||||
visible: player.controlsShowing
|
visible: player.controlsShowing
|
||||||
|
@ -305,9 +311,11 @@ ApplicationWindow {
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
font.bold: true
|
font.bold: true
|
||||||
opacity: 1
|
opacity: 1
|
||||||
visible: player.controlsShowing && ((!appearance.titleOnlyOnFullscreen) || (mainWindow.visibility == Window.FullScreen) )
|
visible: player.controlsShowing
|
||||||
|
&& ((!appearance.titleOnlyOnFullscreen)
|
||||||
|
|| (mainWindow.visibility == Window.FullScreen))
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
player.titleChanged.connect(function(title) {
|
player.titleChanged.connect(function (title) {
|
||||||
text = title
|
text = title
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/player">
|
<qresource prefix="/player">
|
||||||
<file>main.qml</file>
|
<file>main.qml</file>
|
||||||
|
<file>PlaylistDialog.qml</file>
|
||||||
<file>CustomComboBox.qml</file>
|
<file>CustomComboBox.qml</file>
|
||||||
<file>CustomMenuItem.qml</file>
|
<file>CustomMenuItem.qml</file>
|
||||||
<file>CustomMenu.qml</file>
|
<file>CustomMenu.qml</file>
|
||||||
|
|
Loading…
Reference in a new issue