[UI] Minor optimizations and customizability additions.
This commit is contained in:
parent
ba0119fad3
commit
b27f2e6b27
|
@ -64,7 +64,7 @@ Item {
|
||||||
opacity: 1
|
opacity: 1
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
id: subsBackground
|
id: subsBackground
|
||||||
color: Qt.rgba(0, 0, 0, 0.6)
|
color: appearance.mainBackground
|
||||||
width: subsContainer.childrenRect.width
|
width: subsContainer.childrenRect.width
|
||||||
height: subsContainer.childrenRect.height
|
height: subsContainer.childrenRect.height
|
||||||
}
|
}
|
||||||
|
@ -88,8 +88,7 @@ Item {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
color: "black"
|
color: appearance.mainBackground
|
||||||
opacity: 0.6
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
@ -45,7 +45,6 @@ ComboBox {
|
||||||
implicitWidth: 120
|
implicitWidth: 120
|
||||||
implicitHeight: 40
|
implicitHeight: 40
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
opacity: 0.6
|
|
||||||
}
|
}
|
||||||
|
|
||||||
popup: Popup {
|
popup: Popup {
|
||||||
|
|
|
@ -6,8 +6,7 @@ Menu {
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
implicitWidth: parent.width
|
implicitWidth: parent.width
|
||||||
implicitHeight: 10
|
implicitHeight: 10
|
||||||
color: "black"
|
color: appearance.mainBackground
|
||||||
opacity: 0.6
|
|
||||||
}
|
}
|
||||||
delegate: CustomMenuItem {
|
delegate: CustomMenuItem {
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,38 +12,28 @@ MenuBar {
|
||||||
id: menuBar
|
id: menuBar
|
||||||
//width: parent.width
|
//width: parent.width
|
||||||
height: Math.max(24, Screen.height / 32)
|
height: Math.max(24, Screen.height / 32)
|
||||||
property bool anythingOpen: fileMenuBarItem.opened
|
function anythingOpen() {
|
||||||
|| playbackMenuBarItem.opened
|
for (var i = 0, len = menuBar.count; i < len; i++) {
|
||||||
|| viewMenuBarItem.opened
|
if (menuBar.menuAt(i).opened) { return true }
|
||||||
|| audioMenuBarItem.opened
|
}
|
||||||
|| videoMenuBarItem.opened
|
}
|
||||||
|| subsMenuBarItem.opened
|
|
||||||
|| aboutMenuBarItem.opened
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
player.tracksChanged.connect(updateTracks)
|
player.tracksChanged.connect(updateTracks)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function updateTracks() {
|
function updateTracks() {
|
||||||
for (var i = 0, len = audioMenu.count; i < len; i++) {
|
var trackMenus = [audioMenu, videoMenu, subMenu]
|
||||||
var audioAction = audioMenu.actionAt(i)
|
for (var a = 0; i < trackMenus.length; a++) {
|
||||||
if (audioAction.trackID != "no") {
|
var menu = trackMenus[a]
|
||||||
audioMenu.removeAction(audioAction)
|
for (var i = 0, len = menu.count; i < len; i++) {
|
||||||
}
|
var action = menu.actionAt(i)
|
||||||
}
|
if (action.trackID != "no") {
|
||||||
for (var i = 0, len = videoMenu.count; i < len; i++) {
|
menu.removeAction(action)
|
||||||
var videoAction = videoMenu.actionAt(i)
|
}
|
||||||
if (videoAction.trackID != "no") {
|
|
||||||
videoMenu.removeAction(videoAction)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (var i = 0, len = subMenu.count; i < len; i++) {
|
|
||||||
var subAction = subMenu.actionAt(i)
|
|
||||||
if (subAction.trackID != "no") {
|
|
||||||
subMenu.removeAction(subAction)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var newTracks = player.playerCommand(Enums.Commands.GetTracks)
|
var newTracks = player.playerCommand(Enums.Commands.GetTracks)
|
||||||
|
|
||||||
for (var i = 0, len = newTracks.length; i < len; i++) {
|
for (var i = 0, len = newTracks.length; i < len; i++) {
|
||||||
|
@ -168,8 +158,7 @@ MenuBar {
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
implicitHeight: 10
|
implicitHeight: 10
|
||||||
color: "black"
|
color: appearance.mainBackground
|
||||||
opacity: 0.6
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomMenu {
|
CustomMenu {
|
||||||
|
|
|
@ -26,6 +26,7 @@ ApplicationWindow {
|
||||||
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"
|
||||||
}
|
}
|
||||||
Settings {
|
Settings {
|
||||||
id: i18n
|
id: i18n
|
||||||
|
@ -111,6 +112,7 @@ ApplicationWindow {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
z: 1
|
z: 1
|
||||||
|
property bool controlsShowing: true
|
||||||
|
|
||||||
function startPlayer() {
|
function startPlayer() {
|
||||||
console.log(player)
|
console.log(player)
|
||||||
|
@ -188,37 +190,30 @@ ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isAnyMenuOpen() {
|
function isAnyMenuOpen() {
|
||||||
return menuBar.anythingOpen
|
return menuBar.anythingOpen()
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideControls(force) {
|
function hideControls(force) {
|
||||||
if (!isAnyMenuOpen() || force) {
|
if (!isAnyMenuOpen() || force) {
|
||||||
controlsBar.controls.visible = false
|
controlsShowing = false
|
||||||
controlsBar.background.visible = false
|
|
||||||
titleBar.visible = false
|
|
||||||
titleBackground.visible = false
|
|
||||||
menuBar.visible = false;
|
|
||||||
mouseAreaPlayer.cursorShape = Qt.BlankCursor
|
mouseAreaPlayer.cursorShape = Qt.BlankCursor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showControls() {
|
function showControls() {
|
||||||
if (!controlsBar.controls.visible) {
|
if (!controlsBar.controls.visible) {
|
||||||
controlsBar.controls.visible = true
|
controlsShowing = true
|
||||||
controlsBar.background.visible = true
|
|
||||||
if (appearance.titleOnlyOnFullscreen) {
|
|
||||||
if (mainWindow.visibility == Window.FullScreen) {
|
|
||||||
titleBar.visible = true
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
titleBar.visible = true
|
|
||||||
}
|
|
||||||
titleBackground.visible = true
|
|
||||||
menuBar.visible = true
|
|
||||||
mouseAreaPlayer.cursorShape = Qt.ArrowCursor
|
mouseAreaPlayer.cursorShape = Qt.ArrowCursor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Item {
|
||||||
|
anchors.centerIn: player
|
||||||
|
height: player.height
|
||||||
|
width: player.width
|
||||||
|
z: 2
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouseAreaBar
|
id: mouseAreaBar
|
||||||
x: 0
|
x: 0
|
||||||
|
@ -289,18 +284,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
MainMenu {
|
MainMenu {
|
||||||
id: menuBar
|
id: menuBar
|
||||||
}
|
visible: player.controlsShowing
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: titleBackground
|
|
||||||
height: titleBar.height
|
|
||||||
anchors.top: titleBar.top
|
|
||||||
anchors.left: titleBar.left
|
|
||||||
anchors.right: titleBar.right
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
color: "black"
|
|
||||||
opacity: 0.6
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -309,9 +293,9 @@ ApplicationWindow {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.left: menuBar.right
|
anchors.left: menuBar.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
visible: player.controlsShowing
|
||||||
|
|
||||||
visible: !appearance.titleOnlyOnFullscreen
|
color: appearance.mainBackground
|
||||||
color: "transparent"
|
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: titleLabel
|
id: titleLabel
|
||||||
|
@ -330,6 +314,7 @@ 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) )
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
player.titleChanged.connect(function(title) {
|
player.titleChanged.connect(function(title) {
|
||||||
text = title
|
text = title
|
||||||
|
@ -340,6 +325,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
ControlsBar {
|
ControlsBar {
|
||||||
id: controlsBar
|
id: controlsBar
|
||||||
|
visible: player.controlsShowing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue