1
0
Fork 0

[UI] Added theme menu item and made switching themes easier.

This commit is contained in:
NamedKitten 2018-12-05 12:05:18 +00:00
parent 6ba9f7fe35
commit c8cf58df5f
5 changed files with 44 additions and 13 deletions

View file

@ -22,6 +22,11 @@ Item {
setControlsTheme(appearance.themeName) setControlsTheme(appearance.themeName)
} }
Connections {
target: appearance
onThemeNameChanged: setControlsTheme(appearance.themeName)
}
function setControlsTheme(themeName) { function setControlsTheme(themeName) {
for (var i = 0; i < controlsBar.children.length; ++i) { for (var i = 0; i < controlsBar.children.length; ++i) {
if (controlsBar.children[i].objectName == "buttonLayout") { if (controlsBar.children[i].objectName == "buttonLayout") {
@ -103,7 +108,9 @@ Item {
Rectangle { Rectangle {
id: controlsBackground id: controlsBackground
height: controlsBar.visible ? controlsBar.height + (appearance.themeName == "RoosterTeeth" ? 0 : progressBar.topPadding + (fun.nyanCat ? 0 : 1)) : 0 height: controlsBar.visible ? controlsBar.height
+ (appearance.themeName
== "RoosterTeeth" ? 0 : progressBar.topPadding) : 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

View file

@ -459,6 +459,29 @@ MenuBar {
id: viewMenuBarItem id: viewMenuBarItem
title: translate.getTranslation("VIEW", i18n.language) title: translate.getTranslation("VIEW", i18n.language)
CustomMenu {
title: translate.getTranslation("THEME", i18n.language)
id: themeMenu
Action {
text: "YouTube"
onTriggered: appearance.themeName = text
checkable: true
checked: appearance.themeName == text
}
Action {
text: "Niconico"
onTriggered: appearance.themeName = text
checkable: true
checked: appearance.themeName == text
}
Action {
text: "RoosterTeeth"
onTriggered: appearance.themeName = text
checkable: true
checked: appearance.themeName == text
}
}
Action { Action {
text: translate.getTranslation("FULLSCREEN", i18n.language) text: translate.getTranslation("FULLSCREEN", i18n.language)
onTriggered: { onTriggered: {

View file

@ -18,12 +18,12 @@ Button {
appearance.themeName, "buttonColor") appearance.themeName, "buttonColor")
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
display: AbstractButton.IconOnly display: AbstractButton.IconOnly
onClicked: { onClicked: {
var aptn = appearance.themeName var aptn = appearance.themeName
appearance.themeName = aptn == "YouTube" ? "RoosterTeeth" : aptn appearance.themeName = aptn == "YouTube" ? "RoosterTeeth" : aptn
== "RoosterTeeth" ? "Niconico" : "YouTube" == "RoosterTeeth" ? "Niconico" : "YouTube"
controlsBarItem.setControlsTheme(appearance.themeName)
console.log("Settings Menu Not Yet Implemented.")
} }
background: Item { background: Item {
} }

View file

@ -43,7 +43,8 @@ var translations = {
DISABLE_TRACK: "Disable Track", DISABLE_TRACK: "Disable Track",
AUDIO_DEVICES: "Audio Devices", AUDIO_DEVICES: "Audio Devices",
UPDATE: "Update", UPDATE: "Update",
PLAYLIST_MENU: "Playlist Menu" PLAYLIST_MENU: "Playlist Menu",
THEME: "Theme"
}, },
spanish: { spanish: {
SAVE_SCREENSHOT: "Guardar captura en", SAVE_SCREENSHOT: "Guardar captura en",

View file

@ -54,14 +54,14 @@ Window {
Settings { Settings {
id: youTubeAppearance id: youTubeAppearance
category: "YouTubeAppearance" category: "YouTubeAppearance"
property string mainBackground: "#9C000000" property color mainBackground: "#9C000000"
property string progressBackgroundColor: "#3CFFFFFF" property color progressBackgroundColor: "#33FFFFFF"
property string progressCachedColor: "white" property color progressCachedColor: "#66FFFFFF"
property string buttonColor: "white" property color buttonColor: "white"
property string buttonHoverColor: "white" property color buttonHoverColor: "white"
property string progressSliderColor: "red" property color progressSliderColor: "red"
property string chapterMarkerColor: "#fc0" property color chapterMarkerColor: "#fc0"
property string volumeSliderBackground: "white" property color volumeSliderBackground: "white"
} }
Settings { Settings {
@ -69,7 +69,7 @@ Window {
category: "NicoNicoAppearance" category: "NicoNicoAppearance"
property string mainBackground: "#9C000000" property string mainBackground: "#9C000000"
property string progressBackgroundColor: "#444" property string progressBackgroundColor: "#444"
property string progressCachedColor: "white" property string progressCachedColor: "#66FFFFFF"
property string buttonColor: "white" property string buttonColor: "white"
property string buttonHoverColor: "white" property string buttonHoverColor: "white"
property string progressSliderColor: "#007cff" property string progressSliderColor: "#007cff"