1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-06 19:12:30 +01:00
ScreenPlay/ScreenPlayWorkshop/qml/SteamProfile.qml

151 lines
4.5 KiB
QML
Raw Permalink Normal View History

import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Material
2021-07-15 12:07:39 +02:00
import Qt5Compat.GraphicalEffects
import QtQuick.Layouts
import ScreenPlayWorkshop
2021-06-25 12:07:28 +02:00
import "upload/"
Item {
id: root
2023-06-02 10:19:12 +02:00
objectName: "WorkshopProfilePage"
2021-06-25 12:07:28 +02:00
property ScreenPlayWorkshop screenPlayWorkshop
property SteamWorkshop steamWorkshop
2023-06-02 10:19:12 +02:00
property StackView stackView
StackView.onActivated: steamWorkshop.requestUserItems()
2021-06-25 12:07:28 +02:00
Flickable {
id: scrollView
anchors.fill: parent
contentWidth: root.width
contentHeight: gridView.height + header.height + 150
Item {
id: header
height: 200
anchors {
top: parent.top
left: parent.left
right: parent.right
leftMargin: 45
}
RowLayout {
anchors {
left: parent.left
leftMargin: 20
verticalCenter: parent.verticalCenter
}
spacing: 20
2023-06-02 10:19:12 +02:00
SteamProfilePicture {
2021-06-25 12:07:28 +02:00
id: avatar
width: 70
height: 70
}
Text {
text: root.steamWorkshop.steamAccount.username
2021-06-25 12:07:28 +02:00
font.pointSize: 12
color: "white"
}
Button {
text: qsTr("Back")
2023-06-02 10:19:12 +02:00
onClicked: {
stackView.pop();
}
2021-06-25 12:07:28 +02:00
}
}
}
GridView {
id: gridView
maximumFlickVelocity: 7000
flickDeceleration: 5000
cellWidth: 330
cellHeight: 190
height: contentHeight
interactive: false
model: root.steamWorkshop.workshopProfileListModel
2021-06-25 12:07:28 +02:00
boundsBehavior: Flickable.StopAtBounds
anchors {
top: header.bottom
topMargin: 40
left: parent.left
right: parent.right
leftMargin: 45
}
delegate: WorkshopItem {
imgUrl: m_workshopPreview
name: m_workshopTitle
publishedFileID: m_publishedFileID
additionalPreviewUrl: m_additionalPreviewUrl
subscriptionCount: m_subscriptionCount
itemIndex: index
steamWorkshop: root.steamWorkshop
2021-06-25 12:07:28 +02:00
// onClicked: {
// sidebar.setWorkshopItem(publishedFileID, imgUrl,
// additionalPreviewUrl,
// subscriptionCount)
// }
}
ScrollBar.vertical: ScrollBar {
id: workshopScrollBar
snapMode: ScrollBar.SnapOnRelease
}
footer: RowLayout {
height: 150
width: parent.width
spacing: 10
Item {
Layout.fillWidth: true
}
Button {
id: btnBack
Layout.alignment: Qt.AlignVCenter
text: qsTr("Back")
enabled: root.steamWorkshop.workshopProfileListModel.currentPage > 1
2021-06-25 12:07:28 +02:00
onClicked: {
2023-02-02 15:25:26 +01:00
root.steamWorkshop.workshopProfileListModel.setCurrentPage(root.steamWorkshop.workshopProfileListModel.currentPage - 1);
2021-06-25 12:07:28 +02:00
}
}
Text {
id: txtPage
Layout.alignment: Qt.AlignVCenter
2023-02-02 15:25:26 +01:00
text: root.steamWorkshop.workshopProfileListModel.currentPage + "/" + root.steamWorkshop.workshopProfileListModel.pages
2021-06-25 12:07:28 +02:00
color: Material.primaryTextColor
}
Button {
id: btnForward
Layout.alignment: Qt.AlignVCenter
text: qsTr("Forward")
2023-02-02 15:25:26 +01:00
enabled: root.steamWorkshop.workshopProfileListModel.currentPage <= root.steamWorkshop.workshopProfileListModel.pages - 1
2021-06-25 12:07:28 +02:00
onClicked: {
2023-02-02 15:25:26 +01:00
root.steamWorkshop.workshopProfileListModel.setCurrentPage(root.steamWorkshop.workshopProfileListModel.currentPage + 1);
2021-06-25 12:07:28 +02:00
}
}
Item {
Layout.fillWidth: true
}
}
}
}
}