[UI] Reformatting + Niconico forward / back buttons (using YouTube's icons for now)
This commit is contained in:
parent
bdea9ade90
commit
a307a01eef
|
@ -1,5 +1,5 @@
|
||||||
SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||||
pushd $SOURCE_DIR
|
pushd $SOURCE_DIR
|
||||||
qmlfmt -w src/qml/*.qml
|
qmlfmt -w src/qml/*.qml src/qml/*/*.qml
|
||||||
clang-format -style mozilla -i src/*
|
clang-format -style mozilla -i src/*
|
||||||
popd
|
popd
|
||||||
|
|
|
@ -30,9 +30,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
var component = Qt.createComponent(themeName + "ButtonLayout.qml")
|
var component = Qt.createComponent(themeName + "ButtonLayout.qml")
|
||||||
component.createObject(controlsBar, {
|
component.createObject(controlsBar, {})
|
||||||
"anchors.fill": controlsBar
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
|
@ -10,7 +10,9 @@ Rectangle {
|
||||||
Connections {
|
Connections {
|
||||||
target: player
|
target: player
|
||||||
enabled: true
|
enabled: true
|
||||||
onChaptersChanged: {chapterMarker.destroy()}
|
onChaptersChanged: {
|
||||||
|
chapterMarker.destroy()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
width: 4
|
width: 4
|
||||||
|
|
|
@ -10,6 +10,7 @@ import player 1.0
|
||||||
Item {
|
Item {
|
||||||
objectName: "buttonLayout"
|
objectName: "buttonLayout"
|
||||||
id: layout
|
id: layout
|
||||||
|
anchors.fill: controlsBar
|
||||||
|
|
||||||
PlayPauseButton {
|
PlayPauseButton {
|
||||||
id: playPauseButton
|
id: playPauseButton
|
||||||
|
@ -36,21 +37,37 @@ Item {
|
||||||
|
|
||||||
PlaylistPrevButton {
|
PlaylistPrevButton {
|
||||||
id: playlistPrevButton
|
id: playlistPrevButton
|
||||||
anchors.right: timeLabel.left
|
anchors.right: backwardButton.left
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
icon.height: 16
|
icon.height: 16
|
||||||
icon.width: 16
|
icon.width: 16
|
||||||
}
|
}
|
||||||
|
BackwardButton {
|
||||||
|
id: backwardButton
|
||||||
|
anchors.right: timeLabel.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
icon.height: 32
|
||||||
|
icon.width: 32
|
||||||
|
}
|
||||||
TimeLabel {
|
TimeLabel {
|
||||||
id: timeLabel
|
id: timeLabel
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
}
|
}
|
||||||
|
ForwardButton {
|
||||||
|
id: forwardButton
|
||||||
|
anchors.left: timeLabel.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
icon.height: 32
|
||||||
|
icon.width: 32
|
||||||
|
}
|
||||||
PlaylistNextButton {
|
PlaylistNextButton {
|
||||||
id: playlistNextButton
|
id: playlistNextButton
|
||||||
anchors.left: timeLabel.right
|
anchors.left: forwardButton.right
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
icon.height: 16
|
icon.height: 16
|
||||||
|
|
20
src/qml/UIComponents/BackwardButton.qml
Normal file
20
src/qml/UIComponents/BackwardButton.qml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import QtQuick 2.11
|
||||||
|
import QtQuick.Controls 2.4
|
||||||
|
import QtQuick.Dialogs 1.3
|
||||||
|
import QtQuick.Layouts 1.11
|
||||||
|
import QtQuick.Window 2.11
|
||||||
|
import Qt.labs.settings 1.0
|
||||||
|
import Qt.labs.platform 1.0 as LabsPlatform
|
||||||
|
import player 1.0
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: backwardButton
|
||||||
|
icon.source: "icons/" + appearance.themeName + "/backward.svg"
|
||||||
|
icon.color: appearance.buttonColor
|
||||||
|
display: AbstractButton.IconOnly
|
||||||
|
onClicked: {
|
||||||
|
player.playerCommand(Enums.Commands.Seek, "-10")
|
||||||
|
}
|
||||||
|
background: Item {
|
||||||
|
}
|
||||||
|
}
|
20
src/qml/UIComponents/ForwardButton.qml
Normal file
20
src/qml/UIComponents/ForwardButton.qml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import QtQuick 2.11
|
||||||
|
import QtQuick.Controls 2.4
|
||||||
|
import QtQuick.Dialogs 1.3
|
||||||
|
import QtQuick.Layouts 1.11
|
||||||
|
import QtQuick.Window 2.11
|
||||||
|
import Qt.labs.settings 1.0
|
||||||
|
import Qt.labs.platform 1.0 as LabsPlatform
|
||||||
|
import player 1.0
|
||||||
|
|
||||||
|
Button {
|
||||||
|
id: forwardButton
|
||||||
|
icon.source: "icons/" + appearance.themeName + "/forward.svg"
|
||||||
|
icon.color: appearance.buttonColor
|
||||||
|
display: AbstractButton.IconOnly
|
||||||
|
onClicked: {
|
||||||
|
player.playerCommand(Enums.Commands.Seek, "10")
|
||||||
|
}
|
||||||
|
background: Item {
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,7 +7,6 @@ import Qt.labs.settings 1.0
|
||||||
import Qt.labs.platform 1.0 as LabsPlatform
|
import Qt.labs.platform 1.0 as LabsPlatform
|
||||||
import player 1.0
|
import player 1.0
|
||||||
|
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: playlistNextButton
|
id: playlistNextButton
|
||||||
//icon.name: "next"
|
//icon.name: "next"
|
||||||
|
@ -20,4 +19,3 @@ import player 1.0
|
||||||
background: Item {
|
background: Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import Qt.labs.settings 1.0
|
||||||
import Qt.labs.platform 1.0 as LabsPlatform
|
import Qt.labs.platform 1.0 as LabsPlatform
|
||||||
import player 1.0
|
import player 1.0
|
||||||
|
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: playlistPrevButton
|
id: playlistPrevButton
|
||||||
objectName: "playlistPrevButton"
|
objectName: "playlistPrevButton"
|
||||||
|
@ -27,7 +26,6 @@ Button {
|
||||||
if (appearance.themeName == "YouTube") {
|
if (appearance.themeName == "YouTube") {
|
||||||
if (position != 0) {
|
if (position != 0) {
|
||||||
visible = true
|
visible = true
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
visible = false
|
visible = false
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,6 @@ import player 1.0
|
||||||
fun.nyanCat, mouseAreaProgressBar.containsMouse)
|
fun.nyanCat, mouseAreaProgressBar.containsMouse)
|
||||||
color: appearance.progressBackgroundColor
|
color: appearance.progressBackgroundColor
|
||||||
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
x: (mouseAreaProgressBar.mouseX - width / 2) + progressBar.leftPadding
|
x: (mouseAreaProgressBar.mouseX - width / 2) + progressBar.leftPadding
|
||||||
y: progressBackground.y - 20 - height
|
y: progressBackground.y - 20 - height
|
||||||
|
@ -124,17 +123,14 @@ import player 1.0
|
||||||
enabled: true
|
enabled: true
|
||||||
onChaptersChanged: function (chapters) {
|
onChaptersChanged: function (chapters) {
|
||||||
for (var i = 0, len = chapters.length; i < len; i++) {
|
for (var i = 0, len = chapters.length; i < len; i++) {
|
||||||
var component = Qt.createComponent(
|
var component = Qt.createComponent("ChapterMarker.qml")
|
||||||
"ChapterMarker.qml")
|
|
||||||
|
|
||||||
var marker = component.createObject(chapterMarkers,
|
var marker = component.createObject(chapterMarkers, {
|
||||||
{
|
|
||||||
time: chapters[i]["time"]
|
time: chapters[i]["time"]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -166,7 +162,8 @@ import player 1.0
|
||||||
implicitWidth: radius
|
implicitWidth: radius
|
||||||
radius: 12 + (progressBackground.height / 2)
|
radius: 12 + (progressBackground.height / 2)
|
||||||
color: fun.nyanCat ? "transparent" : appearance.progressSliderColor
|
color: fun.nyanCat ? "transparent" : appearance.progressSliderColor
|
||||||
visible: getHandleVisibility(appearance.themeName, mouseAreaProgressBar.containsMouse)
|
visible: getHandleVisibility(appearance.themeName,
|
||||||
|
mouseAreaProgressBar.containsMouse)
|
||||||
AnimatedImage {
|
AnimatedImage {
|
||||||
z: 80
|
z: 80
|
||||||
visible: fun.nyanCat
|
visible: fun.nyanCat
|
||||||
|
|
|
@ -7,7 +7,6 @@ import Qt.labs.settings 1.0
|
||||||
import Qt.labs.platform 1.0 as LabsPlatform
|
import Qt.labs.platform 1.0 as LabsPlatform
|
||||||
import player 1.0
|
import player 1.0
|
||||||
|
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: volumeButton
|
id: volumeButton
|
||||||
objectName: "volumeButton"
|
objectName: "volumeButton"
|
||||||
|
@ -24,7 +23,7 @@ import player 1.0
|
||||||
enabled: true
|
enabled: true
|
||||||
onVolumeStatusChanged: function (status) {
|
onVolumeStatusChanged: function (status) {
|
||||||
if (volumeButton == null)
|
if (volumeButton == null)
|
||||||
console.log("OwO");
|
console.log("OwO")
|
||||||
|
|
||||||
if (status == Enums.VolumeStatus.Muted) {
|
if (status == Enums.VolumeStatus.Muted) {
|
||||||
volumeButton.icon.source = "qrc:/icons/" + appearance.themeName + "/volume-mute.svg"
|
volumeButton.icon.source = "qrc:/icons/" + appearance.themeName + "/volume-mute.svg"
|
||||||
|
|
|
@ -7,19 +7,16 @@ import Qt.labs.settings 1.0
|
||||||
import Qt.labs.platform 1.0 as LabsPlatform
|
import Qt.labs.platform 1.0 as LabsPlatform
|
||||||
import player 1.0
|
import player 1.0
|
||||||
|
|
||||||
|
|
||||||
Slider {
|
Slider {
|
||||||
id: volumeBar
|
id: volumeBar
|
||||||
to: 100
|
to: 100
|
||||||
value: 100
|
value: 100
|
||||||
palette.dark: "#f00"
|
palette.dark: "#f00"
|
||||||
|
|
||||||
implicitWidth: Math.max(
|
implicitWidth: Math.max(background ? background.implicitWidth : 0,
|
||||||
background ? background.implicitWidth : 0,
|
|
||||||
(handle ? handle.implicitWidth : 0)
|
(handle ? handle.implicitWidth : 0)
|
||||||
+ leftPadding + rightPadding)
|
+ leftPadding + rightPadding)
|
||||||
implicitHeight: Math.max(
|
implicitHeight: Math.max(background ? background.implicitHeight : 0,
|
||||||
background ? background.implicitHeight : 0,
|
|
||||||
(handle ? handle.implicitHeight : 0)
|
(handle ? handle.implicitHeight : 0)
|
||||||
+ topPadding + bottomPadding)
|
+ topPadding + bottomPadding)
|
||||||
onMoved: {
|
onMoved: {
|
||||||
|
@ -34,8 +31,7 @@ import player 1.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
handle: Rectangle {
|
handle: Rectangle {
|
||||||
x: volumeBar.leftPadding + volumeBar.visualPosition
|
x: volumeBar.leftPadding + volumeBar.visualPosition * (volumeBar.availableWidth - width)
|
||||||
* (volumeBar.availableWidth - width)
|
|
||||||
y: volumeBar.topPadding + volumeBar.availableHeight / 2 - height / 2
|
y: volumeBar.topPadding + volumeBar.availableHeight / 2 - height / 2
|
||||||
implicitWidth: 12
|
implicitWidth: 12
|
||||||
implicitHeight: 12
|
implicitHeight: 12
|
||||||
|
@ -60,4 +56,3 @@ import player 1.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import player 1.0
|
||||||
Item {
|
Item {
|
||||||
objectName: "buttonLayout"
|
objectName: "buttonLayout"
|
||||||
id: layout
|
id: layout
|
||||||
|
anchors.fill: controlsBar
|
||||||
|
|
||||||
PlaylistPrevButton {
|
PlaylistPrevButton {
|
||||||
id: playlistPrevButton
|
id: playlistPrevButton
|
||||||
|
|
1
src/qml/icons/Niconico/backward.svg
Normal file
1
src/qml/icons/Niconico/backward.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48"><path d="M24 10V2L14 12l10 10v-8c6.6 0 12 5.4 12 12s-5.4 12-12 12-12-5.4-12-12H8c0 8.8 7.2 16 16 16s16-7.2 16-16-7.2-16-16-16zm-2.2 22h-1.7v-6.5l-2 .6v-1.4l3.5-1.3h.2V32zm8.5-3.5c0 .6-.1 1.2-.2 1.6s-.3.8-.6 1.1-.6.5-.9.7-.7.2-1.2.2-.8-.1-1.2-.2-.7-.4-.9-.7-.5-.7-.6-1.1-.2-1-.2-1.6V27c0-.6.1-1.2.2-1.6s.3-.8.6-1.1.6-.5.9-.7.7-.2 1.2-.2.8.1 1.2.2.7.4.9.7.5.7.6 1.1.2 1 .2 1.6v1.5zm-1.6-1.7c0-.4 0-.7-.1-1s-.1-.5-.2-.6-.2-.3-.4-.3-.3-.1-.5-.1-.4 0-.5.1-.3.2-.4.3-.2.4-.2.6-.1.6-.1 1v1.9c0 .4 0 .7.1 1s.1.5.2.6.2.3.4.3.3.1.5.1.4 0 .5-.1.3-.2.4-.3.2-.4.2-.6.1-.6.1-1v-1.9z"/></svg>
|
After Width: | Height: | Size: 640 B |
1
src/qml/icons/Niconico/forward.svg
Normal file
1
src/qml/icons/Niconico/forward.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48"><path d="M8 26c0 8.8 7.2 16 16 16s16-7.2 16-16h-4c0 6.6-5.4 12-12 12s-12-5.4-12-12 5.4-12 12-12v8l10-10L24 2v8c-8.8 0-16 7.2-16 16zm13.7 6H20v-6.5l-2 .6v-1.4l3.5-1.3h.2V32zm8.5-3.5c0 .6-.1 1.2-.2 1.6s-.3.8-.6 1.1-.6.5-.9.7-.7.2-1.2.2-.8-.1-1.2-.2-.7-.4-.9-.7-.5-.7-.6-1.1-.2-1-.2-1.6V27c0-.6.1-1.2.2-1.6s.3-.8.6-1.1.6-.5.9-.7.7-.2 1.2-.2.8.1 1.2.2.7.4.9.7.5.7.6 1.1.2 1 .2 1.6v1.5zm-1.7-1.7c0-.4 0-.7-.1-1s-.1-.5-.2-.6-.2-.3-.4-.3-.3-.1-.5-.1-.4 0-.5.1-.3.2-.4.3-.2.4-.2.6-.1.6-.1 1v1.9c0 .4 0 .7.1 1s.1.5.2.6.2.3.4.3.3.1.5.1.4 0 .5-.1.3-.2.4-.3.2-.4.2-.6.1-.6.1-1v-1.9z"/></svg>
|
After Width: | Height: | Size: 642 B |
|
@ -45,7 +45,6 @@ Window {
|
||||||
property string volumeSliderBackground: "white"
|
property string volumeSliderBackground: "white"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Settings {
|
Settings {
|
||||||
id: i18n
|
id: i18n
|
||||||
category: "I18N"
|
category: "I18N"
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
<file>MainMenu.qml</file>
|
<file>MainMenu.qml</file>
|
||||||
<file>YouTubeButtonLayout.qml</file>
|
<file>YouTubeButtonLayout.qml</file>
|
||||||
<file>NiconicoButtonLayout.qml</file>
|
<file>NiconicoButtonLayout.qml</file>
|
||||||
|
<file alias="ForwardButton.qml">UIComponents/ForwardButton.qml</file>
|
||||||
|
<file alias="BackwardButton.qml">UIComponents/BackwardButton.qml</file>
|
||||||
<file alias="PlaylistPrevButton.qml">UIComponents/PlaylistPrevButton.qml</file>
|
<file alias="PlaylistPrevButton.qml">UIComponents/PlaylistPrevButton.qml</file>
|
||||||
<file alias="PlayPauseButton.qml">UIComponents/PlayPauseButton.qml</file>
|
<file alias="PlayPauseButton.qml">UIComponents/PlayPauseButton.qml</file>
|
||||||
<file alias="VideoProgress.qml">UIComponents/VideoProgress.qml</file>
|
<file alias="VideoProgress.qml">UIComponents/VideoProgress.qml</file>
|
||||||
|
@ -45,6 +47,8 @@
|
||||||
<file>icons/Niconico/prev.svg</file>
|
<file>icons/Niconico/prev.svg</file>
|
||||||
<file>icons/Niconico/next.svg</file>
|
<file>icons/Niconico/next.svg</file>
|
||||||
<file>icons/Niconico/fullscreen.svg</file>
|
<file>icons/Niconico/fullscreen.svg</file>
|
||||||
|
<file>icons/Niconico/forward.svg</file>
|
||||||
|
<file>icons/Niconico/backward.svg</file>
|
||||||
<file>icons/nyancat.gif</file>
|
<file>icons/nyancat.gif</file>
|
||||||
<file>icons/rainbow.png</file>
|
<file>icons/rainbow.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
|
|
Loading…
Reference in a new issue