1
0
Fork 0

[UI] Add nyancat fun feature.

This commit is contained in:
Kitteh 2018-10-26 19:11:07 +01:00
parent a44ebe93f7
commit 32e5fdab5e
4 changed files with 75 additions and 15 deletions

View file

@ -1,3 +1,3 @@
# Icons # Icons
- Icons where all from https://material.io/tools/icons/?style=baseline - Icons where all from https://material.io/tools/icons/?style=baseline
- Exceptions: none yet - Exceptions: nyancat.gif

BIN
src/qml/icons/nyancat.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View file

@ -5,6 +5,7 @@ import QtQuick.Layouts 1.11
import QtQuick.Window 2.11 import QtQuick.Window 2.11
import Qt.labs.settings 1.0 import Qt.labs.settings 1.0
import player 1.0 import player 1.0
import QtGraphicalEffects 1.0
import "codes.js" as LanguageCodes import "codes.js" as LanguageCodes
@ -251,6 +252,12 @@ ApplicationWindow {
property bool titleOnlyOnFullscreen: true property bool titleOnlyOnFullscreen: true
} }
Settings {
id: fun
category: "Fun"
property bool nyanCat: false
}
Dialog { Dialog {
id: screenshotSaveDialog id: screenshotSaveDialog
title: "Save Screenshot To" title: "Save Screenshot To"
@ -363,6 +370,7 @@ ApplicationWindow {
property string screenshot: "S" property string screenshot: "S"
property string screenshotWithoutSubtitles: "Shift+S" property string screenshotWithoutSubtitles: "Shift+S"
property string fullScreenshot: "Ctrl+S" property string fullScreenshot: "Ctrl+S"
property string nyanCat: "Ctrl+N"
} }
MenuBar { MenuBar {
@ -607,6 +615,14 @@ ApplicationWindow {
} }
shortcut: keybinds.statsForNerds shortcut: keybinds.statsForNerds
} }
Action {
text: "Toggle Nyan Cat"
onTriggered: {
fun.nyanCat = ! fun.nyanCat
}
shortcut: keybinds.nyanCat
}
} }
Action { Action {
@ -771,7 +787,7 @@ ApplicationWindow {
anchors.left: menuBar.right anchors.left: menuBar.right
anchors.top: parent.top anchors.top: parent.top
visible: ! appearance.titleOnlyOnFullscreen visible: !appearance.titleOnlyOnFullscreen
color: "transparent" color: "transparent"
Text { Text {
@ -799,7 +815,7 @@ ApplicationWindow {
Rectangle { Rectangle {
id: controlsBackground id: controlsBackground
height: controlsBar.visible ? controlsBar.height + (progressBar.topPadding * 2) height: controlsBar.visible ? controlsBar.height + (progressBar.topPadding * 2)
- (progressBackground.height * 2) : 0 - (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
@ -816,7 +832,8 @@ ApplicationWindow {
anchors.left: controlsBar.left anchors.left: controlsBar.left
anchors.right: controlsBar.right anchors.right: controlsBar.right
anchors.bottom: controlsBackground.top anchors.bottom: controlsBackground.top
anchors.bottomMargin: fun.nyanCat ? 0 : nyanimation.height
radius: 5 radius: 5
color: "transparent" color: "transparent"
TextMetrics { TextMetrics {
@ -867,7 +884,6 @@ ApplicationWindow {
anchors.bottomMargin: 1 anchors.bottomMargin: 1
visible: true visible: true
color: "transparent" color: "transparent"
Rectangle { Rectangle {
id: settingsMenuBackground id: settingsMenuBackground
anchors.fill: settingsMenu anchors.fill: settingsMenu
@ -899,20 +915,19 @@ ApplicationWindow {
onClicked: loadDialog.open() onClicked: loadDialog.open()
} }
} }
} }
Slider { Slider {
id: progressBar id: progressBar
to: 1 to: 1
value: 0.0 value: 0.0
palette.dark: "#f00"
anchors.bottom: parent.top anchors.bottom: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.bottomMargin: 0 anchors.bottomMargin: 0
anchors.topMargin: progressBackground.height + handleRect.height anchors.topMargin: progressBackground.height + handleRect.height
bottomPadding: 0 bottomPadding: 0
z: 10
onMoved: { onMoved: {
player.command(["seek", progressBar.value, "absolute"]) player.command(["seek", progressBar.value, "absolute"])
@ -922,10 +937,10 @@ ApplicationWindow {
id: progressBackground id: progressBackground
x: progressBar.leftPadding x: progressBar.leftPadding
y: progressBar.topPadding + progressBar.availableHeight / 2 - height / 2 y: progressBar.topPadding + progressBar.availableHeight / 2 - height / 2
implicitHeight: (Screen.height / 256) < 2 ? 2 : Screen.height / 256 implicitHeight: (Screen.height / 256) < (fun.nyanCat ? 12 : 2) ? (fun.nyanCat ? 12 : 2) : Screen.height / 256
width: progressBar.availableWidth width: progressBar.availableWidth
height: implicitHeight height: implicitHeight
color: Qt.rgba(255, 255, 255, 0.4) color: Qt.rgba(255, 255, 255, 0.6)
Rectangle { Rectangle {
id: progressLength id: progressLength
@ -933,10 +948,45 @@ ApplicationWindow {
height: parent.height height: parent.height
color: "red" color: "red"
opacity: 1 opacity: 1
LinearGradient {
height: parent.height
visible: fun.nyanCat
anchors.fill: parent
gradient: Gradient {
GradientStop {
position: 0.0
color: "#f00"
}
GradientStop {
position: 0.17
color: "#f90"
}
GradientStop {
position: 0.33
color: "#ff0"
}
GradientStop {
position: 0.50
color: "#3f0"
}
GradientStop {
position: 0.67
color: "#09f"
}
GradientStop {
position: 0.83
color: "#63f"
}
GradientStop {
position: 1
color: "#63f"
}
}
}
} }
Rectangle { Rectangle {
id: cachedLength id: cachedLength
z: 1 z: 100
anchors.left: progressLength.right anchors.left: progressLength.right
anchors.leftMargin: progressBar.handle.width / 2 anchors.leftMargin: progressBar.handle.width / 2
//anchors.left: progressBar.handle.horizontalCenter //anchors.left: progressBar.handle.horizontalCenter
@ -949,16 +999,25 @@ ApplicationWindow {
} }
handle: Rectangle { handle: Rectangle {
z: 2
id: handleRect id: handleRect
x: progressBar.leftPadding + progressBar.visualPosition x: progressBar.leftPadding + progressBar.visualPosition
* (progressBar.availableWidth - width) * (progressBar.availableWidth - width)
y: progressBar.topPadding + progressBar.availableHeight / 2 - height / 2 y: progressBar.topPadding + progressBar.availableHeight / 2 - height / 2
implicitWidth: 12
implicitHeight: 12 implicitHeight: 12
implicitWidth: 12
radius: 12 radius: 12
color: "red" color: fun.nyanCat ? "transparent" : "red"
border.color: "red" //border.color: "red"
AnimatedImage {
z: 100
visible: fun.nyanCat
paused: progressBar.pressed
height: 24
id: nyanimation
anchors.centerIn: parent
source: "qrc:/player/icons/nyancat.gif"
fillMode: Image.PreserveAspectFit
}
} }
} }

View file

@ -15,6 +15,7 @@
<file>icons/next.svg</file> <file>icons/next.svg</file>
<file>icons/prev.svg</file> <file>icons/prev.svg</file>
<file>icons/subtitles.svg</file> <file>icons/subtitles.svg</file>
<file>icons/nyancat.gif</file>
<file>fonts/NotoSans.ttf</file> <file>fonts/NotoSans.ttf</file>
<file>icons/playlist.svg</file> <file>icons/playlist.svg</file>
<file>codes.js</file> <file>codes.js</file>