1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00

Cleanup UI into separate components

This commit is contained in:
Elias Steurer 2020-08-26 13:30:05 +02:00
parent a8e3f6131d
commit dd4cc217a4
20 changed files with 830 additions and 999 deletions

View File

@ -10,23 +10,17 @@ import ScreenPlay 1.0
import Settings 1.0
import "qml/"
import "qml/Monitors"
import "qml/Common"
import "qml/Installed"
import "qml/Navigation"
import "qml/Workshop"
import "qml/Community"
import "qml/Monitors" as Monitors
import "qml/Common" as Common
import "qml/Installed" as Installed
import "qml/Navigation" as Navigation
import "qml/Workshop" as Workshop
import "qml/Community" as Community
ApplicationWindow {
id: window
color: {
if (Material.theme === Material.Dark) {
return Qt.darker(Material.background)
} else {
return Material.background
}
}
color: Material.theme === Material.Dark ? Qt.darker(
Material.background) : Material.background
// Set visible if the -silent parameter was not set (see app.cpp end of constructor).
visible: false
width: 1400
@ -40,8 +34,40 @@ ApplicationWindow {
}
}
Material.accent: {
return Material.color(Material.Orange)
// Partial workaround for
// https://bugreports.qt.io/browse/QTBUG-86047
Material.accent: Material.color(Material.Orange)
Component.onCompleted: {
setTheme(ScreenPlay.settings.theme)
if (!ScreenPlay.settings.silentStart) {
window.show()
ScreenPlay.setTrackerSendEvent("navigation", "Installed")
} else {
ScreenPlay.setTrackerSendEvent("navigation", "Silent")
}
}
Connections {
target: ScreenPlay.settings
function onThemeChanged(theme) {
setTheme(theme)
}
}
Connections {
target: ScreenPlay.util
function onRequestNavigation(nav) {
switchPage(nav)
}
}
Connections {
target: ScreenPlay.screenPlayManager
function onRequestRaise() {
window.show()
}
}
function setTheme(theme) {
@ -57,23 +83,6 @@ ApplicationWindow {
break
}
}
Connections {
target: ScreenPlay.settings
function onThemeChanged(theme) {
setTheme(theme)
}
}
Component.onCompleted: {
setTheme(ScreenPlay.settings.theme)
if (!ScreenPlay.settings.silentStart) {
window.show()
ScreenPlay.setTrackerSendEvent("navigation", "Installed")
} else {
ScreenPlay.setTrackerSendEvent("navigation", "Silent")
}
}
function switchPage(name) {
if (name === "Create") {
@ -109,121 +118,13 @@ ApplicationWindow {
sidebar.state = "inactive"
}
Background {
Common.TrayIcon {}
Common.Background {
id: bg
anchors.fill: parent
}
Connections {
target: ScreenPlay.util
function onRequestNavigation(nav) {
switchPage(nav)
}
}
Connections {
target: ScreenPlay.screenPlayManager
function onRequestRaise() {
window.show()
}
}
LinearGradient {
id: tabShadow
height: 4
visible: true
z: 500
cached: true
anchors {
top: nav.bottom
right: parent.right
left: parent.left
}
start: Qt.point(0, 0)
end: Qt.point(0, 4)
gradient: Gradient {
GradientStop {
position: 0.0
color: "#33000000"
}
GradientStop {
position: 1.0
color: "#00000000"
}
}
}
SystemTrayIcon {
id: sti
visible: true
iconSource: "qrc:/assets/icons/app.ico"
tooltip: qsTr("ScreenPlay - Double click to change you settings.")
onActivated: {
switch (reason) {
case SystemTrayIcon.Unknown:
break
case SystemTrayIcon.Context:
break
case SystemTrayIcon.DoubleClick:
window.show()
break
case SystemTrayIcon.Trigger:
break
case SystemTrayIcon.MiddleClick:
break
}
}
menu: Menu {
MenuItem {
text: qsTr("Open ScreenPlay")
onTriggered: {
window.show()
}
}
MenuItem {
id: miMuteAll
property bool isMuted: true
text: qsTr("Mute all")
onTriggered: {
if (miMuteAll.isMuted) {
isMuted = false
miMuteAll.text = qsTr("Mute all")
ScreenPlay.screenPlayManager.setAllWallpaperValue(
"muted", "true")
} else {
isMuted = true
miMuteAll.text = qsTr("Unmute all")
ScreenPlay.screenPlayManager.setAllWallpaperValue(
"muted", "false")
}
}
}
MenuItem {
id: miStopAll
property bool isPlaying: false
text: qsTr("Pause all")
onTriggered: {
if (miStopAll.isPlaying) {
isPlaying = false
miStopAll.text = qsTr("Pause all")
ScreenPlay.screenPlayManager.setAllWallpaperValue(
"isPlaying", "true")
} else {
isPlaying = true
miStopAll.text = qsTr("Play all")
ScreenPlay.screenPlayManager.setAllWallpaperValue(
"isPlaying", "false")
}
}
}
MenuItem {
text: qsTr("Quit")
onTriggered: ScreenPlay.exit()
}
}
}
Loader {
id: pageLoader
@ -296,7 +197,7 @@ ApplicationWindow {
}
}
Sidebar {
Installed.Sidebar {
id: sidebar
navHeight: nav.height
@ -307,7 +208,7 @@ ApplicationWindow {
}
}
Navigation {
Navigation.Navigation {
id: nav
anchors {
top: parent.top
@ -320,7 +221,7 @@ ApplicationWindow {
}
}
Monitors {
Monitors.Monitors {
id: monitors
}
}

View File

@ -58,19 +58,20 @@
<file>assets/icons/icon_forum.svg</file>
<file>qml/Workshop/ScreenPlayItem.qml</file>
<file>qml/Workshop/ScreenPlayItemImage.qml</file>
<file>qml/Workshop/WorkshopAlertBanner.qml</file>
<file>qml/Workshop/WorkshopBackground.qml</file>
<file>qml/Workshop/WorkshopBanner.qml</file>
<file>qml/Workshop/Background.qml</file>
<file>qml/Workshop/WorkshopInstalled.qml</file>
<file>qml/Workshop/WorkshopItem.qml</file>
<file>qml/Workshop/WorkshopItemDetail.qml</file>
<file>qml/Workshop/WorkshopNavigation.qml</file>
<file>qml/Workshop/WorkshopPopupOffline.qml</file>
<file>qml/Workshop/WorkshopWrapper.qml</file>
<file>qml/Workshop/Sidebar.qml</file>
<file>qml/Workshop/Navigation.qml</file>
<file>qml/Workshop/PopupOffline.qml</file>
<file>qml/Workshop/upload/PopupSteamWorkshopAgreement.qml</file>
<file>qml/Workshop/upload/UploadProject.qml</file>
<file>qml/Workshop/upload/UploadProjectBigItem.qml</file>
<file>qml/Workshop/upload/UploadProjectItem.qml</file>
<file>qml/Monitors/SaveNotification.qml</file>
<file>qml/Common/TrayIcon.qml</file>
<file>qml/Installed/Navigation.qml</file>
<file>qml/Common/Search.qml</file>
<file>qml/Common/MouseHoverBlocker.qml</file>
</qresource>
</RCC>

View File

@ -0,0 +1,10 @@
import QtQuick 2.0
MouseArea {
anchors.fill: parent
enabled: true
hoverEnabled: true
propagateComposedEvents: false
}

View File

@ -0,0 +1,47 @@
import QtQuick 2.0
import QtQuick.Controls 2.0
import QtQuick.Controls.Material 2.0
import ScreenPlay 1.0
Item {
width: 300
ToolButton {
id: icnSearch
icon.source: "qrc:/assets/icons/icon_search.svg"
height: 30
width: 30
icon.width: 30
icon.height: 30
icon.color: Material.iconColor
anchors {
right: parent.right
verticalCenter: parent.verticalCenter
}
}
TextField {
id: txtSearch
width: 250
height: 40
font.family: ScreenPlay.settings.font
leftPadding: 10
color: Material.secondaryTextColor
anchors {
right: icnSearch.left
rightMargin: 10
top: parent.top
topMargin: 10
}
onTextChanged: {
if (txtSearch.text.length === 0) {
ScreenPlay.installedListFilter.resetFilter()
} else {
ScreenPlay.installedListFilter.sortByName(txtSearch.text)
}
}
selectByMouse: true
placeholderText: qsTr("Search for Wallpaper & Widgets")
}
}

View File

@ -0,0 +1,74 @@
import QtQuick 2.0
import Qt.labs.platform 1.0
import ScreenPlay 1.0
SystemTrayIcon {
id: sti
visible: true
iconSource: "qrc:/assets/icons/app.ico"
tooltip: qsTr("ScreenPlay - Double click to change you settings.")
onActivated: {
switch (reason) {
case SystemTrayIcon.Unknown:
break
case SystemTrayIcon.Context:
break
case SystemTrayIcon.DoubleClick:
window.show()
break
case SystemTrayIcon.Trigger:
break
case SystemTrayIcon.MiddleClick:
break
}
}
menu: Menu {
MenuItem {
text: qsTr("Open ScreenPlay")
onTriggered: {
window.show()
}
}
MenuItem {
id: miMuteAll
property bool isMuted: true
text: qsTr("Mute all")
onTriggered: {
if (miMuteAll.isMuted) {
isMuted = false
miMuteAll.text = qsTr("Mute all")
ScreenPlay.screenPlayManager.setAllWallpaperValue(
"muted", "true")
} else {
isMuted = true
miMuteAll.text = qsTr("Unmute all")
ScreenPlay.screenPlayManager.setAllWallpaperValue(
"muted", "false")
}
}
}
MenuItem {
id: miStopAll
property bool isPlaying: false
text: qsTr("Pause all")
onTriggered: {
if (miStopAll.isPlaying) {
isPlaying = false
miStopAll.text = qsTr("Pause all")
ScreenPlay.screenPlayManager.setAllWallpaperValue(
"isPlaying", "true")
} else {
isPlaying = true
miStopAll.text = qsTr("Play all")
ScreenPlay.screenPlayManager.setAllWallpaperValue(
"isPlaying", "false")
}
}
}
MenuItem {
text: qsTr("Quit")
onTriggered: ScreenPlay.exit()
}
}
}

View File

@ -3,6 +3,7 @@ import QtQuick.Controls 2.14
import QtQuick.Controls.Material 2.12
import QtQuick.Controls.Styles 1.4
import QtGraphicalEffects 1.0
import QtQuick.Controls.Material.impl 2.12
import ScreenPlay 1.0
import ScreenPlay.Enums.InstalledType 1.0
@ -10,7 +11,6 @@ import ScreenPlay.Enums.SearchType 1.0
Item {
id: pageInstalled
state: "out"
signal setNavigationItem(var pos)
signal setSidebarActive(var active)
@ -19,7 +19,7 @@ Item {
property bool enabled: true
Component.onCompleted: {
pageInstalled.state = "in"
navWrapper.state = "in"
ScreenPlay.installedListFilter.sortBySearchType(SearchType.All)
checkIsContentInstalled()
}
@ -35,6 +35,7 @@ Item {
setNavigationItem(pos)
}
}
Connections {
target: ScreenPlay.installedListModel
function onInstalledLoadingFinished() {
@ -191,183 +192,14 @@ Item {
}
}
Item {
Navigation {
id: navWrapper
height: 115
z: 999
width: parent.width
anchors {
top: parent.top
right: parent.right
left: parent.left
}
RectangularGlow {
id: effect
anchors {
fill: nav
}
cached: true
glowRadius: 2
spread: 0.15
color: "black"
opacity: 0.3
cornerRadius: 15
}
Rectangle {
id: nav
color: Material.theme === Material.Light ? "white" : Material.background
height: 50
anchors {
top: parent.top
right: parent.right
left: parent.left
}
MouseArea {
anchors.fill: parent
}
TabBar {
height: parent.height
background: Item {}
anchors {
top: parent.top
topMargin: 5
left: parent.left
leftMargin: 20
bottom: parent.bottom
}
TabButton {
text: qsTr("All")
font.family: ScreenPlay.settings.font
icon.height: 16
icon.width: 16
height: parent.height
width: implicitWidth
background: Item {}
font.weight: Font.Thin
icon.source: "qrc:/assets/icons/icon_installed.svg"
onClicked: {
setSidebarActive(false)
ScreenPlay.installedListFilter.sortBySearchType(SearchType.All)
}
}
TabButton {
text: qsTr("Scenes")
icon.height: 16
icon.width: 16
font.family: ScreenPlay.settings.font
width: implicitWidth
height: parent.height
background: Item {}
font.weight: Font.Thin
icon.source: "qrc:/assets/icons/icon_code.svg"
onClicked: {
setSidebarActive(false)
ScreenPlay.installedListFilter.sortBySearchType(SearchType.Scene)
}
}
TabButton {
text: qsTr("Videos")
icon.height: 16
icon.width: 16
font.family: ScreenPlay.settings.font
height: parent.height
width: implicitWidth
background: Item {}
font.weight: Font.Thin
icon.source: "qrc:/assets/icons/icon_movie.svg"
onClicked: {
setSidebarActive(false)
ScreenPlay.installedListFilter.sortBySearchType(SearchType.Wallpaper)
}
}
TabButton {
text: qsTr("Widgets")
icon.height: 16
icon.width: 16
font.family: ScreenPlay.settings.font
height: parent.height
width: implicitWidth
background: Item {}
font.weight: Font.Thin
icon.source: "qrc:/assets/icons/icon_widgets.svg"
onClicked: {
setSidebarActive(false)
ScreenPlay.installedListFilter.sortBySearchType(SearchType.Widget)
}
}
}
Image {
id: icnSearch
source: "qrc:/assets/icons/icon_search.svg"
height: 15
width: 15
sourceSize: Qt.size(15, 15)
anchors {
right: parent.right
rightMargin: 30
bottom: parent.bottom
bottomMargin: 15
}
}
TextField {
id: txtSearch
width: 250
height: 40
font.family: ScreenPlay.settings.font
leftPadding: 10
anchors {
right: icnSearch.right
rightMargin: 20
top: parent.top
topMargin: 10
}
onTextChanged: {
if (txtSearch.text.length === 0) {
ScreenPlay.installedListFilter.resetFilter()
} else {
ScreenPlay.installedListFilter.sortByName(
txtSearch.text)
}
}
selectByMouse: true
placeholderText: qsTr("Search for Wallpaper & Widgets")
}
}
}
states: [
State {
name: "out"
PropertyChanges {
target: navWrapper
anchors.topMargin: -115
}
},
State {
name: "in"
PropertyChanges {
target: navWrapper
anchors.topMargin: 0
}
}
]
transitions: [
Transition {
from: "out"
to: "in"
NumberAnimation {
target: navWrapper
property: "anchors.topMargin"
duration: 400
easing.type: Easing.InOutQuart
}
}
]
}

View File

@ -0,0 +1,162 @@
import QtQuick 2.0
import QtQuick.Controls 2.14
import QtQuick.Controls.Material 2.12
import QtQuick.Controls.Styles 1.4
import QtGraphicalEffects 1.0
import QtQuick.Controls.Material.impl 2.12
import ScreenPlay 1.0
import ScreenPlay.Enums.InstalledType 1.0
import ScreenPlay.Enums.SearchType 1.0
import "../Common" as Common
Item {
id: navWrapper
state: "out"
Rectangle {
id: nav
color: Material.theme === Material.Light ? "white" : Material.background
height: 50
anchors {
top: parent.top
right: parent.right
left: parent.left
}
layer.enabled: true
layer.effect: ElevationEffect {
elevation: 2
}
}
Common.MouseHoverBlocker {}
Item {
height: nav.height
anchors {
top: parent.top
left: parent.left
right: parent.right
}
TabBar {
height: parent.height
background: Item {}
anchors {
top: parent.top
topMargin: 5
left: parent.left
leftMargin: 20
bottom: parent.bottom
}
TabButton {
text: qsTr("All")
font.family: ScreenPlay.settings.font
icon.height: 16
icon.width: 16
height: parent.height
width: implicitWidth
background: Item {}
font.weight: Font.Thin
icon.source: "qrc:/assets/icons/icon_installed.svg"
onClicked: {
setSidebarActive(false)
ScreenPlay.installedListFilter.sortBySearchType(
SearchType.All)
}
}
TabButton {
text: qsTr("Scenes")
icon.height: 16
icon.width: 16
font.family: ScreenPlay.settings.font
width: implicitWidth
height: parent.height
background: Item {}
font.weight: Font.Thin
icon.source: "qrc:/assets/icons/icon_code.svg"
onClicked: {
setSidebarActive(false)
ScreenPlay.installedListFilter.sortBySearchType(
SearchType.Scene)
}
}
TabButton {
text: qsTr("Videos")
icon.height: 16
icon.width: 16
font.family: ScreenPlay.settings.font
height: parent.height
width: implicitWidth
background: Item {}
font.weight: Font.Thin
icon.source: "qrc:/assets/icons/icon_movie.svg"
onClicked: {
setSidebarActive(false)
ScreenPlay.installedListFilter.sortBySearchType(
SearchType.Wallpaper)
}
}
TabButton {
text: qsTr("Widgets")
icon.height: 16
icon.width: 16
font.family: ScreenPlay.settings.font
height: parent.height
width: implicitWidth
background: Item {}
font.weight: Font.Thin
icon.source: "qrc:/assets/icons/icon_widgets.svg"
onClicked: {
setSidebarActive(false)
ScreenPlay.installedListFilter.sortBySearchType(
SearchType.Widget)
}
}
}
Common.Search {
height: parent.height
anchors {
right: parent.right
rightMargin: 30
top: parent.top
}
}
}
states: [
State {
name: "out"
PropertyChanges {
target: navWrapper
anchors.topMargin: -115
}
},
State {
name: "in"
PropertyChanges {
target: navWrapper
anchors.topMargin: 0
}
}
]
transitions: [
Transition {
from: "out"
to: "in"
NumberAnimation {
target: navWrapper
property: "anchors.topMargin"
duration: 400
easing.type: Easing.InOutQuart
}
}
]
}

View File

@ -4,13 +4,14 @@ import QtQuick.Controls 2.12
import QtQuick.Extras 1.4
import QtQuick.Layouts 1.12
import QtQuick.Controls.Material 2.12
import QtQuick.Controls.Material.impl 2.12
import ScreenPlay 1.0
import ScreenPlay.Enums.FillMode 1.0
import ScreenPlay.Enums.InstalledType 1.0
import "../Monitors"
import "../Common" as SP
import "../Common" as Common
Item {
id: root
@ -100,16 +101,23 @@ Item {
}
}
Common.MouseHoverBlocker {}
Rectangle {
anchors.fill: parent
color: Material.theme === Material.Light ? "white" : Material.background
opacity: 0.95
layer.enabled: true
layer.effect: ElevationEffect {
elevation: 4
}
}
Item {
id: sidebarWrapper
anchors.fill: parent
MouseArea {
id: mouseAreaHelper
anchors.fill: parent
enabled: true
hoverEnabled: true
propagateComposedEvents: false
}
Item {
id: navBackground
height: navHeight
@ -148,13 +156,6 @@ Item {
right: parent.right
bottom: parent.bottom
left: parent.left
leftMargin: 5
}
Rectangle {
anchors.fill: parent
color: Material.theme === Material.Light ? "white" : Material.background
opacity: 0.95
}
Rectangle {
@ -280,7 +281,7 @@ Item {
}
}
SP.Slider {
Common.Slider {
id: sliderVolume
slider {
stepSize: 0.01
@ -397,44 +398,12 @@ Item {
}
}
}
Item {
id: shadow
width: 5
anchors {
top: parent.top
right: sidebarBackground.left
bottom: parent.bottom
left: parent.left
}
LinearGradient {
anchors.fill: parent
start: Qt.point(0, 0)
end: Qt.point(5, 0)
gradient: Gradient {
GradientStop {
position: 0.0
color: "#00000000"
}
GradientStop {
position: 1.0
color: "#22000000"
}
}
}
}
}
states: [
State {
name: "inactive"
PropertyChanges {
target: mouseAreaHelper
enabled: false
}
PropertyChanges {
target: root
@ -448,10 +417,6 @@ Item {
},
State {
name: "activeWidget"
PropertyChanges {
target: mouseAreaHelper
enabled: true
}
PropertyChanges {
target: sliderVolume
@ -476,10 +441,7 @@ Item {
},
State {
name: "activeWallpaper"
PropertyChanges {
target: mouseAreaHelper
enabled: true
}
PropertyChanges {
target: image
@ -505,10 +467,6 @@ Item {
},
State {
name: "activeScene"
PropertyChanges {
target: mouseAreaHelper
enabled: true
}
PropertyChanges {
target: image

View File

@ -3,6 +3,7 @@ import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtGraphicalEffects 1.0
import QtQuick.Controls.Material.impl 2.12
import ScreenPlay 1.0
import "../Workshop"
@ -14,11 +15,13 @@ Rectangle {
clip: true
width: 1366
color: Material.theme === Material.Light ? "white" : Material.background
MouseArea {
anchors.fill: parent
layer.enabled: true
layer.effect: ElevationEffect {
elevation: 2
}
MouseHoverBlocker {}
signal changePage(string name)
property var navArray: [navCreate, navWorkshop, navInstalled, navSettings, navCommunity]
@ -29,7 +32,7 @@ Rectangle {
function onRequestNavigationActive(isActive) {
setActive(isActive)
}
function onRequestNavigation(nav){
function onRequestNavigation(nav) {
onPageChanged(nav)
}
}
@ -62,7 +65,6 @@ Rectangle {
}
}
Row {
id: row
anchors.fill: parent

View File

@ -3,6 +3,8 @@ import QtQuick.Controls 2.13
import QtQuick.Controls.Material 2.13
import QtGraphicalEffects 1.0
import QtQuick.Controls.Material.impl 2.12
import ScreenPlay.Workshop 1.0
import ScreenPlay.Workshop.SteamEnums 1.0
import SteamQMLImageProvider 1.0
@ -21,6 +23,10 @@ Item {
opacity: .9
radius: 3
anchors.fill: wrapper
layer.enabled: true
layer.effect: ElevationEffect {
elevation: 4
}
}
Item {

View File

@ -1,14 +1,417 @@
import QtQuick 2.12
import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.2
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Controls.Material 2.13
import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.12
import ScreenPlay.Workshop 1.0
import ScreenPlay.Workshop.SteamEnums 1.0
import ScreenPlay 1.0
import "upload/"
Item {
id: workshop
state: "base"
anchors.fill: parent
onVisibleChanged: {
if (!visible)
sidebar.close()
}
WorkshopWrapper {
Component.onCompleted: {
if (Workshop.steamWorkshop.online) {
Workshop.steamWorkshop.workshopListModel.searchWorkshop(
SteamEnums.K_EUGCQuery_RankedByTrend)
} else {
popupOffline.open()
}
}
Connections {
target: Workshop.steamWorkshop.workshopListModel
function onWorkshopSearched() {
bannerTxt.text = Workshop.steamWorkshop.workshopListModel.getBannerText()
background.backgroundImage = Workshop.steamWorkshop.workshopListModel.getBannerUrl()
banner.bannerWorkshopID = Workshop.steamWorkshop.workshopListModel.getBannerID()
bannerTxtUnderline.numberSubscriber
= Workshop.steamWorkshop.workshopListModel.getBannerAmountSubscriber()
}
}
Background {
id: background
anchors.fill: parent
}
PopupOffline {
id: popupOffline
}
UploadProject {
id: popupUploadProject
anchors.centerIn: Overlay.overlay
}
Flickable {
id: scrollView
anchors.fill: parent
contentWidth: parent.width
contentHeight: gridView.height + header.height + 300
onContentYChanged: {
// Calculate parallax scrolling
if (contentY >= 0) {
background.imageOffsetTop = (contentY * -.4)
} else {
background.imageOffsetTop = 0
}
if (contentY >= (header.height)) {
workshop.state = "scrolling"
} else {
workshop.state = "base"
}
}
transitions: Transition {
PropertyAnimation {
properties: "y"
easing.type: Easing.InOutQuad
duration: 300
}
}
// This wrapper is needed for the parent change
// of the nav. Otherwhise it wont work. Dunno why
Item {
id: wrapper
width: parent.width
height: nav.height + header.height + gridView.height
Navigation {
id: nav
anchors.horizontalCenter: parent.horizontalCenter
onUploadPressed: popupUploadProject.open()
}
Item {
id: header
height: 440
anchors {
right: parent.right
left: parent.left
}
Item {
id: banner
height: 350
z: 5
property int bannerWorkshopID
anchors {
top: parent.top
right: parent.right
left: parent.left
}
Image {
id: bannerImg2
anchors {
right: parent.right
left: parent.left
bottom: parent.bottom
}
height: {
}
asynchronous: true
fillMode: Image.PreserveAspectCrop
}
ColumnLayout {
anchors {
top: parent.top
topMargin: 100
right: parent.right
left: parent.left
leftMargin: 100
}
Text {
id: bannerTxtUnderline
property int numberSubscriber: 0
text: numberSubscriber + " SUBSCRIBED TO:"
font.pointSize: 12
color: "white"
font.family: ScreenPlay.settings.font
font.weight: Font.Thin
}
Text {
id: bannerTxt
text: qsTr("Loading")
font.pointSize: 42
color: "white"
font.family: ScreenPlay.settings.font
font.weight: Font.Thin
width: 400
}
RowLayout {
spacing: 10
Button {
text: qsTr("Download now!")
Material.background: Material.accent
Material.foreground: "white"
icon.source: "qrc:/assets/icons/icon_download.svg"
onClicked: {
text = qsTr("Downloading...")
Workshop.steamWorkshop.subscribeItem(
Workshop.steamWorkshop.workshopListModel.getBannerID(
))
}
}
Button {
text: qsTr("Details")
Material.background: Material.accent
Material.foreground: "white"
icon.source: "qrc:/assets/icons/icon_info.svg"
visible: false
onClicked: {
sidebar.setWorkshopItem(
workshopID, imgUrl,
additionalPreviewUrl,
subscriptionCount)
}
}
}
MouseArea {
onClicked: Qt.openUrlExternally(
"steam://url/CommunityFilePage/"
+ banner.bannerWorkshopID)
height: 30
width: bannerTxtOpenInSteam.paintedWidth
cursorShape: Qt.PointingHandCursor
Text {
id: bannerTxtOpenInSteam
opacity: .7
text: qsTr("Open In Steam")
font.pointSize: 10
color: "white"
font.underline: true
font.family: ScreenPlay.settings.font
font.weight: Font.Thin
}
}
}
}
}
GridView {
id: gridView
maximumFlickVelocity: 7000
flickDeceleration: 5000
cellWidth: 330
cellHeight: 190
height: contentHeight
interactive: false
model: Workshop.steamWorkshop.workshopListModel
anchors {
top: header.bottom
topMargin: 100
left: parent.left
right: parent.right
leftMargin: 50
}
header: Item {
height: 70
width: parent.width
Item {
id: searchWrapper
width: 400
height: 45
anchors {
top: parent.top
left: parent.left
}
Rectangle {
anchors.fill: parent
color: Material.theme === Material.Light ? "white" : Qt.darker(
Material.background)
opacity: .95
radius: 3
}
TextField {
id: tiSearch
anchors {
top: parent.top
right: parent.right
rightMargin: 10
bottom: parent.bottom
left: parent.left
leftMargin: 10
}
placeholderText: qsTr("Search for Wallpaper and Widgets...")
placeholderTextColor: "#666666"
font.pointSize: 10
font.family: ScreenPlay.settings.font
color: "white"
onTextChanged: timerSearch.restart()
Timer {
id: timerSearch
interval: 300
onTriggered: Workshop.steamWorkshop.workshopListModel.searchWorkshopByText(
tiSearch.text)
}
}
}
ComboBox {
id: cbQuerySort
width: 250
height: searchWrapper.height
anchors {
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: 50
}
textRole: "text"
valueRole: "value"
currentIndex: 2
Layout.preferredHeight: searchWrapper.height
font.family: ScreenPlay.settings.font
onActivated: {
Workshop.steamWorkshop.workshopListModel.searchWorkshop(
cbQuerySort.currentValue)
}
model: [{
"value": SteamEnums.k_EUGCQuery_RankedByVote,
"text": qsTr("Ranked By Vote")
}, {
"value": SteamEnums.K_EUGCQuery_RankedByPublicationDate,
"text": qsTr("Publication Date")
}, {
"value": SteamEnums.K_EUGCQuery_RankedByTrend,
"text": qsTr("Ranked By Trend")
}, {
"value": SteamEnums.K_EUGCQuery_FavoritedByFriendsRankedByPublicationDate,
"text": qsTr("Favorited By Friends")
}, {
"value": SteamEnums.K_EUGCQuery_CreatedByFriendsRankedByPublicationDate,
"text": qsTr("Created By Friends")
}, {
"value": SteamEnums.K_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate,
"text": qsTr("Created By Followed Users")
}, {
"value": SteamEnums.K_EUGCQuery_NotYetRated,
"text": qsTr("Not Yet Rated")
}, {
"value": SteamEnums.K_EUGCQuery_RankedByTotalVotesAsc,
"text": qsTr("Total VotesAsc")
}, {
"value": SteamEnums.K_EUGCQuery_RankedByVotesUp,
"text": qsTr("Votes Up")
}, {
"value": SteamEnums.K_EUGCQuery_RankedByTotalUniqueSubscriptions,
"text": qsTr("Total Unique Subscriptions")
}]
}
}
boundsBehavior: Flickable.StopAtBounds
delegate: WorkshopItem {
imgUrl: m_workshopPreview
name: m_workshopTitle
workshopID: m_workshopID
additionalPreviewUrl: m_additionalPreviewUrl
subscriptionCount: m_subscriptionCount
itemIndex: index
onClicked: {
sidebar.setWorkshopItem(
workshopID, imgUrl, additionalPreviewUrl,
subscriptionCount)
}
}
ScrollBar.vertical: ScrollBar {
id: workshopScrollBar
snapMode: ScrollBar.SnapOnRelease
}
}
}
}
Sidebar {
id: sidebar
topMargin: 60
}
states: [
State {
name: "base"
ParentChange {
target: nav
parent: wrapper
}
PropertyChanges {
target: nav
anchors.top: wrapper.top
anchors.topMargin: header.height
width: 800
state: "base"
}
},
State {
name: "scrolling"
ParentChange {
target: nav
parent: workshop
}
PropertyChanges {
target: nav
anchors.topMargin: 0
anchors.top: workshop.top
width: wrapper.width
state: "scrolling"
}
}
]
transitions: [
Transition {
from: "base"
to: "scrolling"
PropertyAnimation {
target: nav
properties: "width"
duration: 100
}
},
Transition {
from: "scrolling"
to: "base"
PropertyAnimation {
target: nav
properties: "width,x,y"
duration: 300
}
}
]
}
/*##^## Designer {
D{i:0;autoSize:true;height:800;width:1366}
}
##^##*/

View File

@ -1,114 +0,0 @@
import QtQuick 2.12
import QtGraphicalEffects 1.0
Item {
id: workshopAltertBannerWrapper
height: 50
state: "out"
anchors {
bottom: parent.bottom
right: parent.right
left: parent.left
}
Rectangle {
id: workshopAltertBanner
height: 50
color: "#3498db"
anchors {
top: parent.top
right: parent.right
left: parent.left
}
Image {
id: icoFrown
source: "qrc:/assets/icons/font-awsome/frown-o.svg"
sourceSize: Qt.size(18, 18)
anchors {
left: parent.left
leftMargin: 20
verticalCenter: parent.verticalCenter
}
}
Text {
id: name
text: qsTr("Oh No! Looks like there a only a few wallpapers and widgets! Help us by creating your own wallpapers and Widgets :)")
color: "white"
font.pointSize: 11
font.family: ScreenPlay.settings.font
anchors {
left: icoFrown.right
leftMargin: 20
verticalCenter: parent.verticalCenter
}
}
MouseArea {
anchors {
top: parent.top
right: closeWrapper.left
bottom: parent.bottom
left: parent.left
}
cursorShape: Qt.PointingHandCursor
onClicked: {
screenPlaySettings.setHasWorkshopBannerSeen(true)
ScreenPlay.ut.setNavigation("Create")
}
}
Item {
id: closeWrapper
height: 50
width: 50
anchors {
top: parent.top
right: parent.right
}
Image {
id: icoClose
source: "qrc:/assets/icons/font-awsome/close.svg"
sourceSize: Qt.size(15, 15)
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
z: 99
onClicked: {
screenPlaySettings.setHasWorkshopBannerSeen(true)
workshopAltertBannerWrapper.state = "out"
}
}
}
}
states: [
State {
name: "out"
PropertyChanges {
target: workshopAltertBanner
anchors.bottomMargin: -50
}
},
State {
name: "in"
PropertyChanges {
target: workshopAltertBanner
anchors.bottomMargin: 0
}
}
]
transitions: [
Transition {
from: "out"
to: "in"
reversible: true
NumberAnimation {
target: footer
property: "anchors.bottomMargin"
duration: 300
easing.type: Easing.InOutQuad
}
}
]
}

View File

@ -1,51 +0,0 @@
import QtQuick 2.12
import QtQuick.Controls 2.3
Item {
Connections {
target: steamWorkshop
function onWorkshopSearched() {
bannerTxt.text = workshopListModel.getBannerText()
bannerImg.source = workshopListModel.getBannerUrl()
}
}
Rectangle {
id: banner
color: "#44131313"
height: 350
anchors {
top: parent.top
right: parent.right
left: parent.left
}
Image {
id: bannerImg
anchors {
right: parent.right
left: parent.left
bottom: parent.bottom
}
asynchronous: true
fillMode: Image.PreserveAspectCrop
}
Text {
id: bannerTxt
text: "loading"
font.pointSize: 36
color: "white"
}
}
Item {
id: searchBar
height: 70
anchors {
top: banner.bottom
right: parent.right
left: parent.left
}
}
}

View File

@ -1,417 +0,0 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Controls.Material 2.13
import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.12
import ScreenPlay.Workshop 1.0
import ScreenPlay.Workshop.SteamEnums 1.0
import ScreenPlay 1.0
import "upload/"
Item {
id: workshop
state: "base"
anchors.fill: parent
onVisibleChanged: {
if (!visible)
workshopItemDetail.close()
}
Component.onCompleted: {
if (Workshop.steamWorkshop.online) {
Workshop.steamWorkshop.workshopListModel.searchWorkshop(
SteamEnums.K_EUGCQuery_RankedByTrend)
} else {
popupOffline.open()
}
}
Connections {
target: Workshop.steamWorkshop.workshopListModel
function onWorkshopSearched() {
bannerTxt.text = Workshop.steamWorkshop.workshopListModel.getBannerText()
background.backgroundImage = Workshop.steamWorkshop.workshopListModel.getBannerUrl()
banner.bannerWorkshopID = Workshop.steamWorkshop.workshopListModel.getBannerID()
bannerTxtUnderline.numberSubscriber
= Workshop.steamWorkshop.workshopListModel.getBannerAmountSubscriber()
}
}
WorkshopBackground {
id: background
anchors.fill: parent
}
WorkshopPopupOffline {
id: popupOffline
}
UploadProject {
id: popupUploadProject
anchors.centerIn: Overlay.overlay
}
Flickable {
id: scrollView
anchors.fill: parent
contentWidth: parent.width
contentHeight: gridView.height + header.height + 300
onContentYChanged: {
// Calculate parallax scrolling
if (contentY >= 0) {
background.imageOffsetTop = (contentY * -.4)
} else {
background.imageOffsetTop = 0
}
if (contentY >= (header.height)) {
workshop.state = "scrolling"
} else {
workshop.state = "base"
}
}
transitions: Transition {
PropertyAnimation {
properties: "y"
easing.type: Easing.InOutQuad
duration: 300
}
}
// This wrapper is needed for the parent change
// of the nav. Otherwhise it wont work. Dunno why
Item {
id: wrapper
width: parent.width
height: nav.height + header.height + gridView.height
WorkshopNavigation {
id: nav
anchors.horizontalCenter: parent.horizontalCenter
onUploadPressed: popupUploadProject.open()
}
Item {
id: header
height: 440
anchors {
right: parent.right
left: parent.left
}
Item {
id: banner
height: 350
z: 5
property int bannerWorkshopID
anchors {
top: parent.top
right: parent.right
left: parent.left
}
Image {
id: bannerImg2
anchors {
right: parent.right
left: parent.left
bottom: parent.bottom
}
height: {
}
asynchronous: true
fillMode: Image.PreserveAspectCrop
}
ColumnLayout {
anchors {
top: parent.top
topMargin: 100
right: parent.right
left: parent.left
leftMargin: 100
}
Text {
id: bannerTxtUnderline
property int numberSubscriber: 0
text: numberSubscriber + " SUBSCRIBED TO:"
font.pointSize: 12
color: "white"
font.family: ScreenPlay.settings.font
font.weight: Font.Thin
}
Text {
id: bannerTxt
text: qsTr("Loading")
font.pointSize: 42
color: "white"
font.family: ScreenPlay.settings.font
font.weight: Font.Thin
width: 400
}
RowLayout {
spacing: 10
Button {
text: qsTr("Download now!")
Material.background: Material.accent
Material.foreground: "white"
icon.source: "qrc:/assets/icons/icon_download.svg"
onClicked: {
text = qsTr("Downloading...")
Workshop.steamWorkshop.subscribeItem(
Workshop.steamWorkshop.workshopListModel.getBannerID(
))
}
}
Button {
text: qsTr("Details")
Material.background: Material.accent
Material.foreground: "white"
icon.source: "qrc:/assets/icons/icon_info.svg"
visible: false
onClicked: {
workshopItemDetail.setWorkshopItem(
workshopID, imgUrl,
additionalPreviewUrl,
subscriptionCount)
}
}
}
MouseArea {
onClicked: Qt.openUrlExternally(
"steam://url/CommunityFilePage/"
+ banner.bannerWorkshopID)
height: 30
width: bannerTxtOpenInSteam.paintedWidth
cursorShape: Qt.PointingHandCursor
Text {
id: bannerTxtOpenInSteam
opacity: .7
text: qsTr("Open In Steam")
font.pointSize: 10
color: "white"
font.underline: true
font.family: ScreenPlay.settings.font
font.weight: Font.Thin
}
}
}
}
}
GridView {
id: gridView
maximumFlickVelocity: 7000
flickDeceleration: 5000
cellWidth: 330
cellHeight: 190
height: contentHeight
interactive: false
model: Workshop.steamWorkshop.workshopListModel
anchors {
top: header.bottom
topMargin: 100
left: parent.left
right: parent.right
leftMargin: 50
}
header: Item {
height: 70
width: parent.width
Item {
id: searchWrapper
width: 400
height: 45
anchors {
top: parent.top
left: parent.left
}
Rectangle {
anchors.fill: parent
color: Material.theme === Material.Light ? "white" : Qt.darker(
Material.background)
opacity: .95
radius: 3
}
TextField {
id: tiSearch
anchors {
top: parent.top
right: parent.right
rightMargin: 10
bottom: parent.bottom
left: parent.left
leftMargin: 10
}
placeholderText: qsTr("Search for Wallpaper and Widgets...")
placeholderTextColor: "#666666"
font.pointSize: 10
font.family: ScreenPlay.settings.font
color: "white"
onTextChanged: timerSearch.restart()
Timer {
id: timerSearch
interval: 300
onTriggered: Workshop.steamWorkshop.workshopListModel.searchWorkshopByText(
tiSearch.text)
}
}
}
ComboBox {
id: cbQuerySort
width: 250
height: searchWrapper.height
anchors {
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: 50
}
textRole: "text"
valueRole: "value"
currentIndex: 2
Layout.preferredHeight: searchWrapper.height
font.family: ScreenPlay.settings.font
onActivated: {
Workshop.steamWorkshop.workshopListModel.searchWorkshop(
cbQuerySort.currentValue)
}
model: [{
"value": SteamEnums.k_EUGCQuery_RankedByVote,
"text": qsTr("Ranked By Vote")
}, {
"value": SteamEnums.K_EUGCQuery_RankedByPublicationDate,
"text": qsTr("Publication Date")
}, {
"value": SteamEnums.K_EUGCQuery_RankedByTrend,
"text": qsTr("Ranked By Trend")
}, {
"value": SteamEnums.K_EUGCQuery_FavoritedByFriendsRankedByPublicationDate,
"text": qsTr("Favorited By Friends")
}, {
"value": SteamEnums.K_EUGCQuery_CreatedByFriendsRankedByPublicationDate,
"text": qsTr("Created By Friends")
}, {
"value": SteamEnums.K_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate,
"text": qsTr("Created By Followed Users")
}, {
"value": SteamEnums.K_EUGCQuery_NotYetRated,
"text": qsTr("Not Yet Rated")
}, {
"value": SteamEnums.K_EUGCQuery_RankedByTotalVotesAsc,
"text": qsTr("Total VotesAsc")
}, {
"value": SteamEnums.K_EUGCQuery_RankedByVotesUp,
"text": qsTr("Votes Up")
}, {
"value": SteamEnums.K_EUGCQuery_RankedByTotalUniqueSubscriptions,
"text": qsTr("Total Unique Subscriptions")
}]
}
}
boundsBehavior: Flickable.StopAtBounds
delegate: WorkshopItem {
imgUrl: m_workshopPreview
name: m_workshopTitle
workshopID: m_workshopID
additionalPreviewUrl: m_additionalPreviewUrl
subscriptionCount: m_subscriptionCount
itemIndex: index
onClicked: {
workshopItemDetail.setWorkshopItem(
workshopID, imgUrl, additionalPreviewUrl,
subscriptionCount)
}
}
ScrollBar.vertical: ScrollBar {
id: workshopScrollBar
snapMode: ScrollBar.SnapOnRelease
}
}
}
}
WorkshopItemDetail {
id: workshopItemDetail
topMargin: 60
}
states: [
State {
name: "base"
ParentChange {
target: nav
parent: wrapper
}
PropertyChanges {
target: nav
anchors.top: wrapper.top
anchors.topMargin: header.height
width: 800
state: "base"
}
},
State {
name: "scrolling"
ParentChange {
target: nav
parent: workshop
}
PropertyChanges {
target: nav
anchors.topMargin: 0
anchors.top: workshop.top
width: wrapper.width
state: "scrolling"
}
}
]
transitions: [
Transition {
from: "base"
to: "scrolling"
PropertyAnimation {
target: nav
properties: "width"
duration: 100
}
},
Transition {
from: "scrolling"
to: "base"
PropertyAnimation {
target: nav
properties: "width,x,y"
duration: 300
}
}
]
}
/*##^## Designer {
D{i:0;autoSize:true;height:800;width:1366}
}
##^##*/

View File

@ -13,7 +13,6 @@ Popup {
modal: true
dim: true
closePolicy: Popup.NoAutoClose
// anchors.centerIn: Overlay.overlay
onAboutToShow: uploadLoader.sourceComponent = com
onAboutToHide: uploadLoader.sourceComponent = undefined
background: Rectangle {

View File

@ -3,6 +3,8 @@ import QtGraphicalEffects 1.0
import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls.Material.impl 2.12
import ScreenPlay 1.0
import "../"
@ -32,23 +34,31 @@ Item {
icnType.source = "icons/icon_code.svg"
}
}
// Component.onCompleted: {
// print("root.preview",root.preview)
// if (root.preview == undefined) {
// print("invalid")
// } else {
// root.isProjectValid = true
// }
// if (!isProjectValid) {
// root.state = "invalid"
// }
// }
// Component.onCompleted: {
// print("root.preview",root.preview)
// if (root.preview == undefined) {
// print("invalid")
// } else {
// root.isProjectValid = true
// }
// if (!isProjectValid) {
// root.state = "invalid"
// }
// }
Rectangle {
anchors.fill: screenPlayItemWrapper
radius: 4
layer.enabled: true
layer.effect: ElevationEffect {
elevation: 6
}
color: Material.theme === Material.Light ? "white" : Material.background
}
Item {
id: screenPlayItemWrapper
color: Material.theme === Material.Light ? "white" : Qt.darker(
Material.background)
anchors.fill: parent
anchors.margins: 20

View File

@ -7,17 +7,24 @@ import QtQuick.Controls.Material 2.12
import ScreenPlay.Workshop.SteamEnums 1.0
import QtQuick.Layouts 1.12
import QtQuick.Controls.Material.impl 2.12
Page {
id: root
width: 800
height: 240
anchors.centerIn: parent
background: Rectangle {
color: "#333333"
// color: Material.theme === Material.Light ? Material.background : Qt.darker(
// Material.background)
radius: 3
radius: 4
anchors.fill: parent
layer.enabled: true
layer.effect: ElevationEffect {
elevation: 6
}
color: Material.theme === Material.Light ? "white" : Material.background
}
padding: 20
height: 240
property string previewImagePath
onPreviewImagePathChanged: img.source = Qt.resolvedUrl(
@ -382,6 +389,7 @@ Page {
contentItem: Item {
anchors.fill: parent
state: "base"
Image {
id: img
width: 300
@ -426,7 +434,7 @@ Page {
text: root.name
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
color: "white"
color: Material.primaryTextColor
font.pointSize: 18
Layout.preferredHeight: 30
Layout.fillWidth: true
@ -439,7 +447,7 @@ Page {
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
color: "white"
color: Material.primaryTextColor
font.pointSize: 14
Layout.preferredHeight: 30
}
@ -458,7 +466,7 @@ Page {
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
color: "white"
color: Material.primaryTextColor
font.pointSize: 14
height: 50
}