diff --git a/format-code.sh b/format-code.sh
new file mode 100755
index 0000000..58fc9bb
--- /dev/null
+++ b/format-code.sh
@@ -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
diff --git a/src/DirectMpvPlayerBackend.cpp b/src/DirectMpvPlayerBackend.cpp
index 20367fe..bc57a3c 100644
--- a/src/DirectMpvPlayerBackend.cpp
+++ b/src/DirectMpvPlayerBackend.cpp
@@ -435,7 +435,8 @@ DirectMpvPlayerBackend::playerCommand(const Enums::Commands& cmd,
case Enums::Commands::SetPlaylistPos: {
- command(QVariantList() << "set" << "playlist-pos" << args);
+ command(QVariantList() << "set"
+ << "playlist-pos" << args);
break;
}
diff --git a/src/MpvPlayerBackend.cpp b/src/MpvPlayerBackend.cpp
index a2ad726..4d8905c 100644
--- a/src/MpvPlayerBackend.cpp
+++ b/src/MpvPlayerBackend.cpp
@@ -425,7 +425,8 @@ MpvPlayerBackend::playerCommand(const Enums::Commands& cmd,
case Enums::Commands::SetPlaylistPos: {
- command(QVariantList() << "set" << "playlist-pos" << args);
+ command(QVariantList() << "set"
+ << "playlist-pos" << args);
break;
}
diff --git a/src/MpvPlayerBackend.h b/src/MpvPlayerBackend.h
index acfa4a7..5806f28 100644
--- a/src/MpvPlayerBackend.h
+++ b/src/MpvPlayerBackend.h
@@ -66,7 +66,6 @@ signals:
void audioDevicesChanged();
void playlistChanged();
-
private slots:
void doUpdate();
void on_mpv_events();
diff --git a/src/qml/ControlsBar.qml b/src/qml/ControlsBar.qml
index 7f05f8f..74b9223 100644
--- a/src/qml/ControlsBar.qml
+++ b/src/qml/ControlsBar.qml
@@ -68,7 +68,7 @@ Item {
height: subsContainer.childrenRect.height
}
Component.onCompleted: {
- player.subtitlesChanged.connect(function(subtitles) {
+ player.subtitlesChanged.connect(function (subtitles) {
text = subtitles
})
}
@@ -79,7 +79,9 @@ Item {
Rectangle {
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.left: parent.left
anchors.right: parent.right
@@ -111,13 +113,15 @@ Item {
anchors.topMargin: progressBackground.height
bottomPadding: 0
Component.onCompleted: {
- player.positionChanged.connect(function(position) {
- if (! pressed) {progressBar.value = position}
+ player.positionChanged.connect(function (position) {
+ if (!pressed) {
+ progressBar.value = position
+ }
})
- player.durationChanged.connect(function(duration) {
+ player.durationChanged.connect(function (duration) {
progressBar.to = duration
})
- player.cachedDurationChanged.connect(function(duration) {
+ player.cachedDurationChanged.connect(function (duration) {
cachedLength.value = progressBar.value + duration
})
}
@@ -153,7 +157,8 @@ Item {
color: appearance.progressBackgroundColor
ProgressBar {
id: cachedLength
- background: Item {}
+ background: Item {
+ }
contentItem: Item {
Rectangle {
width: cachedLength.visualPosition * parent.width
@@ -174,10 +179,12 @@ Item {
value: progressBar.value
opacity: 1
anchors.leftMargin: 0
- background: Item {}
+ background: Item {
+ }
contentItem: Item {
Rectangle {
- width: progressLength.visualPosition * parent.width + progressBar.handle.width / 2
+ width: progressLength.visualPosition * parent.width
+ + progressBar.handle.width / 2
height: parent.height
color: appearance.progressSliderColor
Image {
@@ -198,7 +205,7 @@ Item {
z: 70
id: handleRect
x: progressBar.leftPadding + progressBar.visualPosition
- * (progressBar.availableWidth - width)
+ * (progressBar.availableWidth - width)
y: progressBar.topPadding + progressBar.availableHeight / 2 - height / 2
implicitHeight: radius
implicitWidth: radius
@@ -217,186 +224,193 @@ Item {
}
}
-RowLayout {
- id: layout
- anchors.fill: parent
- spacing: 2
-
+ RowLayout {
+ id: layout
+ anchors.fill: parent
+ spacing: 2
- Button {
- id: playlistPrevButton
- objectName: "playlistPrevButton"
- icon.source: "icons/prev.svg"
- icon.color: appearance.buttonColor
- display: AbstractButton.IconOnly
- visible: false
- width: visible ? playPauseButton.width : 0
- onClicked: {
- player.playerCommand(Enums.Commands.PreviousPlaylistItem)
+ Button {
+ id: playlistPrevButton
+ objectName: "playlistPrevButton"
+ icon.source: "icons/prev.svg"
+ icon.color: appearance.buttonColor
+ display: AbstractButton.IconOnly
+ visible: false
+ width: visible ? playPauseButton.width : 0
+ onClicked: {
+ 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: {
- player.playlistPositionChanged.connect(function(position) {
- if (position != 0 ) {
- visible = true
- } else {
- visible = false
+
+ 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 {
+ 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 {
- 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"
+ 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 {
}
}
}
-
- 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 {}
- }
-}
}
}
diff --git a/src/qml/MainMenu.qml b/src/qml/MainMenu.qml
index df62692..1054067 100644
--- a/src/qml/MainMenu.qml
+++ b/src/qml/MainMenu.qml
@@ -14,14 +14,16 @@ MenuBar {
height: Screen.height / 32
function anythingOpen() {
for (var i = 0, len = menuBar.count; i < len; i++) {
- if (menuBar.menuAt(i).opened) { return true }
+ if (menuBar.menuAt(i).opened) {
+ return true
+ }
}
}
Component.onCompleted: {
player.tracksChanged.connect(updateTracks)
}
-
+
function updateTracks() {
var trackMenus = [audioMenu, videoMenu, subMenu]
for (var a = 0; i < trackMenus.length; a++) {
@@ -33,7 +35,7 @@ MenuBar {
}
}
}
-
+
var newTracks = player.playerCommand(Enums.Commands.GetTracks)
for (var i = 0, len = newTracks.length; i < len; i++) {
@@ -101,7 +103,8 @@ MenuBar {
title: translate.getTranslation("OPEN_FILE", i18n.language)
nameFilters: ["All files (*)"]
onAccepted: {
- player.playerCommand(Enums.Commands.LoadFile, String(fileDialog.file))
+ player.playerCommand(Enums.Commands.LoadFile,
+ String(fileDialog.file))
fileDialog.close()
}
onRejected: {
@@ -124,87 +127,8 @@ MenuBar {
}
}
- Dialog {
+ 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 += 'Title: ' + playlistItemTitle + "
"
- playlistItem.height += 30
- }
- if (typeof playlistItemFilename !== "undefined") {
- itemText += 'Filename: ' + playlistItemFilename + "
"
- playlistItem.height += 30
- }
- playlistItemText.text = itemText
- }
- }
- }
-
- ListView {
- id: playlistListView
- anchors.fill: parent
- model: ListModel { id: playlistModel }
- delegate: playlistDelegate
- highlight: Item {}
- focus: true
- }
-
}
delegate: MenuBarItem {
@@ -423,7 +347,8 @@ MenuBar {
player.audioDevicesChanged.connect(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++) {
audioDeviceMenu.takeAction(0)
@@ -564,8 +489,7 @@ MenuBar {
}
}
Action {
- text: translate.getTranslation("PLAYLIST_MENU",
- i18n.language)
+ text: translate.getTranslation("PLAYLIST_MENU", i18n.language)
onTriggered: {
playlistDialog.open()
}
@@ -590,7 +514,7 @@ MenuBar {
}
player.playerCommand(Enums.Commands.SeekAbsolute, skipto)
}
-
+
Action {
onTriggered: skipToNinth(parseInt(shortcut))
shortcut: "1"
diff --git a/src/qml/PlaylistDialog.qml b/src/qml/PlaylistDialog.qml
new file mode 100644
index 0000000..1744424
--- /dev/null
+++ b/src/qml/PlaylistDialog.qml
@@ -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 += 'Title: ' + playlistItemTitle + "
"
+ }
+ if (typeof playlistItemFilename !== "undefined") {
+ itemText += 'Filename: ' + playlistItemFilename
+ }
+ playlistItemText.text = itemText
+ }
+ }
+ }
+
+ ListView {
+ id: playlistListView
+ anchors.fill: parent
+ model: ListModel {
+ id: playlistModel
+ }
+ delegate: playlistDelegate
+ highlight: Item {
+ }
+ focus: true
+ }
+}
diff --git a/src/qml/main.qml b/src/qml/main.qml
index f9e82ae..16dd351 100644
--- a/src/qml/main.qml
+++ b/src/qml/main.qml
@@ -18,86 +18,85 @@ ApplicationWindow {
Translator {
id: translate
}
-
- Settings {
- id: appearance
- category: "Appearance"
- property bool titleOnlyOnFullscreen: true
- property bool clickToPause: true
- property bool useMpvSubs: false
- property string fontName: "Roboto"
- property string mainBackground: "#9C000000"
- property string progressBackgroundColor: "#3CFFFFFF"
- property string progressCachedColor: "white"
- property string buttonColor: "white"
- property string progressSliderColor: "red"
- }
- Settings {
- id: i18n
- category: "I18N"
- property string language: "english"
- }
- Settings {
- id: fun
- category: "Fun"
- 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: appearance
+ category: "Appearance"
+ property bool titleOnlyOnFullscreen: true
+ property bool clickToPause: true
+ property bool useMpvSubs: false
+ property string fontName: "Roboto"
+ property string mainBackground: "#9C000000"
+ property string progressBackgroundColor: "#3CFFFFFF"
+ property string progressCachedColor: "white"
+ property string buttonColor: "white"
+ property string progressSliderColor: "red"
+ }
+ Settings {
+ id: i18n
+ category: "I18N"
+ property string language: "english"
+ }
+ Settings {
+ id: fun
+ category: "Fun"
+ 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: ""
+ }
property int lastScreenVisibility
@@ -117,10 +116,10 @@ ApplicationWindow {
height: parent.height
z: 1
property bool controlsShowing: true
-
+
function startPlayer() {
console.log(player)
- console.log(typeof(player))
+ console.log(typeof (player))
var args = Qt.application.arguments
var len = Qt.application.arguments.length
var argNo = 0
@@ -149,18 +148,24 @@ ApplicationWindow {
argument = argument.substr(2)
if (argument.length > 0) {
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++) {
- var screen = Qt.application.screens[i];
- console.log("Screen Name: " + screen["name"] + " Screen Number: " + String(i))
- if (screen["name"] == splitArg[1] || String(i) == splitArg[1] ) {
+ var screen = Qt.application.screens[i]
+ console.log("Screen Name: " + screen["name"]
+ + " Screen Number: " + String(
+ i))
+ if (screen["name"] == splitArg[1] || String(
+ i) == splitArg[1]) {
console.log("Switching to screen: " + screen["name"])
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" ) {
+ mainWindow.x = mainWindow.screen.virtualX
+ + mainWindow.width / 2
+ mainWindow.y = mainWindow.screen.virtualY
+ + mainWindow.height / 2
+ if (splitArg[0] == "fs-screen") {
toggleFullscreen()
}
continue
@@ -170,16 +175,17 @@ ApplicationWindow {
}
if (splitArg[0] == "fullscreen") {
toggleFullscreen()
- continue;
- }
- if (splitArg[1] == undefined || splitArg[1].length == 0) {
+ continue
+ }
+ if (splitArg[1] == undefined
+ || splitArg[1].length == 0) {
splitArg[1] = "yes"
}
player.setOption(splitArg[0], splitArg[1])
-
}
} else {
- player.playerCommand(Enums.Commands.AppendFile, argument)
+ player.playerCommand(Enums.Commands.AppendFile,
+ argument)
}
}
}
@@ -198,7 +204,6 @@ ApplicationWindow {
mouseAreaPlayer.cursorShape = Qt.ArrowCursor
}
}
-
}
Item {
anchors.centerIn: player
@@ -239,7 +244,9 @@ ApplicationWindow {
}
Action {
onTriggered: {
- if (mainWindow.visibility == Window.FullScreen) {toggleFullscreen()}
+ if (mainWindow.visibility == Window.FullScreen) {
+ toggleFullscreen()
+ }
}
shortcut: "Esc"
}
@@ -259,7 +266,7 @@ ApplicationWindow {
}
Timer {
id: mouseAreaPlayerTimer
- interval: 2000
+ interval: 1000
running: true
repeat: false
onTriggered: {
@@ -272,7 +279,6 @@ ApplicationWindow {
}
}
-
MainMenu {
id: menuBar
visible: player.controlsShowing
@@ -305,9 +311,11 @@ ApplicationWindow {
font.pixelSize: 14
font.bold: true
opacity: 1
- visible: player.controlsShowing && ((!appearance.titleOnlyOnFullscreen) || (mainWindow.visibility == Window.FullScreen) )
+ visible: player.controlsShowing
+ && ((!appearance.titleOnlyOnFullscreen)
+ || (mainWindow.visibility == Window.FullScreen))
Component.onCompleted: {
- player.titleChanged.connect(function(title) {
+ player.titleChanged.connect(function (title) {
text = title
})
}
diff --git a/src/qml/qml.qrc b/src/qml/qml.qrc
index 43e250e..f4dabaa 100644
--- a/src/qml/qml.qrc
+++ b/src/qml/qml.qrc
@@ -1,6 +1,7 @@
main.qml
+ PlaylistDialog.qml
CustomComboBox.qml
CustomMenuItem.qml
CustomMenu.qml