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

Add browser window in Community tab

Add Community tab background
This commit is contained in:
Elias 2018-12-17 20:55:13 +01:00
parent 60e3049e77
commit 620a34baf3
6 changed files with 268 additions and 181 deletions

View File

@ -123,6 +123,7 @@
<file>qml/Screen/Screen.qml</file> <file>qml/Screen/Screen.qml</file>
<file>assets/icons/icon_screen.svg</file> <file>assets/icons/icon_screen.svg</file>
<file>qml/Background.qml</file> <file>qml/Background.qml</file>
<file>qml/Community/XMLNewsfeed.qml</file>
<file>qml/Workshop/WorkshopAvailableTest.qml</file> <file>qml/Workshop/WorkshopAvailableTest.qml</file>
<file>qml/Workshop/WorkshopLoader.qml</file> <file>qml/Workshop/WorkshopLoader.qml</file>
</qresource> </qresource>

View File

@ -20,6 +20,7 @@
#include <QWindow> #include <QWindow>
#include <QtGlobal> #include <QtGlobal>
#include <QtQuick/QQuickItem> #include <QtQuick/QQuickItem>
#include <QtWebEngine>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <qt_windows.h> #include <qt_windows.h>
@ -52,6 +53,8 @@ int main(int argc, char* argv[])
trsl.load(":/translations/ScreenPlay_de.qm"); trsl.load(":/translations/ScreenPlay_de.qm");
app.installTranslator(&trsl); app.installTranslator(&trsl);
QtWebEngine::initialize();
QFontDatabase::addApplicationFont(":/assets/fonts/LibreBaskerville-Italic.ttf"); QFontDatabase::addApplicationFont(":/assets/fonts/LibreBaskerville-Italic.ttf");
QFontDatabase::addApplicationFont(":/assets/fonts/Roboto-Light.ttf"); QFontDatabase::addApplicationFont(":/assets/fonts/Roboto-Light.ttf");
QFontDatabase::addApplicationFont(":/assets/fonts/Roboto-Regular.ttf"); QFontDatabase::addApplicationFont(":/assets/fonts/Roboto-Regular.ttf");

View File

@ -5,6 +5,7 @@ import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import Qt.labs.platform 1.0 import Qt.labs.platform 1.0
import "qml/" import "qml/"
import "qml/Installed" import "qml/Installed"
@ -29,16 +30,23 @@ ApplicationWindow {
if (name === "Create") { if (name === "Create") {
bg.state = "create" bg.state = "create"
pageLoader.visible = false pageLoader.visible = false
pageLoaderCreate.setSource("qrc:/qml/Create/Create.qml")
pageLoaderCreate.visible = true pageLoaderCreate.visible = true
pageLoaderWorkshop.visible = false pageLoaderWorkshop.visible = false
pageLoaderCreate.setSource("qrc:/qml/Create/Create.qml")
sidebar.state = "inactive" sidebar.state = "inactive"
} else if (name === "Workshop") { } else if (name === "Workshop") {
bg.state = "init" bg.state = "init"
pageLoader.visible = false pageLoader.visible = false
pageLoaderCreate.visible = false pageLoaderCreate.visible = false
pageLoaderWorkshop.setSource("qrc:/qml/Workshop/Workshop.qml")
pageLoaderWorkshop.visible = true pageLoaderWorkshop.visible = true
pageLoaderWorkshop.setSource("qrc:/qml/Workshop/Workshop.qml")
sidebar.state = "inactive"
} else if (name === "Community") {
bg.state = "community"
pageLoader.visible = true
pageLoaderCreate.visible = false
pageLoaderWorkshop.visible = false
pageLoader.setSource("qrc:/qml/Community/Community.qml")
sidebar.state = "inactive" sidebar.state = "inactive"
} else { } else {
bg.state = "init" bg.state = "init"
@ -50,7 +58,6 @@ ApplicationWindow {
} }
} }
Background { Background {
id: bg id: bg
anchors.fill: parent anchors.fill: parent

View File

@ -15,6 +15,11 @@ Item {
} }
} }
Rectangle {
id: bgCommunity
anchors.fill: parent
}
property var myDate: new Date() property var myDate: new Date()
Timer { Timer {
@ -42,6 +47,10 @@ Item {
target: colorShaderCreate target: colorShaderCreate
shaderOpacity: 0 shaderOpacity: 0
} }
PropertyChanges {
target: bgCommunity
opacity: 0
}
}, },
State { State {
name: "create" name: "create"
@ -49,6 +58,21 @@ Item {
target: colorShaderCreate target: colorShaderCreate
shaderOpacity: 1 shaderOpacity: 1
} }
PropertyChanges {
target: bgCommunity
opacity: 0
}
},
State {
name: "community"
PropertyChanges {
target: colorShaderCreate
shaderOpacity: 0
}
PropertyChanges {
target: bgCommunity
opacity: 1
}
} }
] ]
@ -73,6 +97,18 @@ Item {
property: "shaderOpacity" property: "shaderOpacity"
duration: 0 duration: 0
} }
},
Transition {
from: "*"
to: "community"
PropertyAnimation {
target: bgCommunity
property: "opacity"
duration: 400
easing.type: Easing.InOutQuart
}
} }
] ]
} }

View File

@ -3,13 +3,13 @@ import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.2 import QtQuick.Controls.Material 2.2
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtQuick.XmlListModel 2.0 //import QtQuick.XmlListModel 2.0
import QtWebEngine 1.8
Item { Item {
id: community id: community
anchors.fill: parent anchors.fill: parent
Rectangle { Rectangle {
id: stomtWrapper id: stomtWrapper
width: 500 width: 500
@ -55,10 +55,10 @@ Item {
} }
} }
Text { Text {
id:txtStomtDescription id: txtStomtDescription
font.pointSize: 14 font.pointSize: 14
color: "white" color: "white"
height:100 height: 100
text: qsTr("We use Stomt because it provides quick and easy feedback via I like/I wish. So you can easily give us feedback and speak your mind. We will read these wishes on a daily basis!") text: qsTr("We use Stomt because it provides quick and easy feedback via I like/I wish. So you can easily give us feedback and speak your mind. We will read these wishes on a daily basis!")
font.family: "Roboto" font.family: "Roboto"
font.weight: Font.Normal font.weight: Font.Normal
@ -75,7 +75,7 @@ Item {
} }
} }
Component { Component {
id: component_feedback id: component_feedback
Feedback { Feedback {
id: feedback id: feedback
@ -93,15 +93,14 @@ Item {
} }
Timer { Timer {
interval: 200; running: true; repeat: false interval: 200
running: true
repeat: false
onTriggered: { onTriggered: {
feedModel.source = "https://screen-play.app/index.php?option=com_content&view=category&layout=blog&id=10&format=feed&type=rss"
loader_feedback.sourceComponent = component_feedback loader_feedback.sourceComponent = component_feedback
} }
} }
Button { Button {
id: btnStomt id: btnStomt
text: qsTr("Open ScreenPlay Stomt page") text: qsTr("Open ScreenPlay Stomt page")
@ -147,179 +146,38 @@ Item {
} }
} }
XmlListModel { // XMLNewsfeed {
id: feedModel // id: changelogFlickableWrapper
// anchors {
query: "/rss/channel/item" // bottom: footer.top
XmlRole { // left: stomtWrapper.right
name: "title" // leftMargin: 90
query: "title/string()" // right: parent.right
// rightMargin: 20
// top: parent.top
// topMargin: 20
// }
// }
WebEngineView {
id: we
url:"https://forum.screen-play.app/"
onUrlChanged: {
var tmp = we.url.toString()
if(!tmp.includes("https://forum.screen-play.app/")) {
we.url = "https://forum.screen-play.app/"
}
} }
XmlRole {
name: "backgroundImage"
query: "description/string()"
}
XmlRole {
name: "link"
query: "link/string()"
}
XmlRole {
name: "pubDate"
query: "pubDate/string()"
}
XmlRole {
name: "category"
query: "category/string()"
}
}
GridView {
id: changelogFlickableWrapper
flickableDirection: Flickable.VerticalFlick
maximumFlickVelocity: 5000
flickDeceleration: 5000
cellHeight: 205
cellWidth: 360
model: feedModel
anchors { anchors {
top: parent.top
topMargin: 20
right: parent.right
rightMargin: 20
bottom: footer.top bottom: footer.top
left: stomtWrapper.right left: stomtWrapper.right
leftMargin: 90 leftMargin: 0
right: parent.right
rightMargin: 0
top: parent.top
topMargin:0
} }
header: Item {
height: 100
width: parent.width
Text {
id: name
text: qsTr("News & Patchnotes")
wrapMode: Text.WordWrap
color: "#626262"
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
font.pixelSize: 32
font.family: "Roboto"
anchors {
top: parent.top
topMargin: 30
horizontalCenter: parent.horizontalCenter
}
}
}
delegate: Item {
id: root
width: 352
height: 197
RectangularGlow {
id: effectchangelogWrapper
anchors {
top: parent.top
topMargin: 3
}
height: parent.height
width: parent.width
cached: true
glowRadius: 3
spread: 0.2
color: "black"
opacity: 0.2
cornerRadius: 15
}
Rectangle {
anchors.fill: parent
anchors.margins: 5
radius: 4
Image {
fillMode: Image.PreserveAspectCrop
anchors.fill: parent
source: {
var a = backgroundImage
var r = new RegExp(/<img[^>]+src="([^">]+)"/)
var url = r.exec(a)
return url[1].toString()
}
}
LinearGradient {
visible: true
opacity: .5
anchors.fill: parent
start: Qt.point(0, parent.height)
end: Qt.point(0, parent.height - 150)
gradient: Gradient {
GradientStop {
position: 0.0
color: "#BB000000"
}
GradientStop {
position: 1.0
color: "#00000000"
}
}
}
Text {
id: txtTitle
text: title
renderType: Text.NativeRendering
anchors {
right: parent.right
bottom: parent.bottom
left: parent.left
margins: 20
}
color: "white"
font.family: "Roboto"
font.weight: Font.Normal
font.pixelSize: 18
wrapMode: Text.WordWrap
}
Text {
id: txtPubDate
text: {
return pubDate.replace("+0000", "")
}
anchors {
right: parent.right
rightMargin: 20
bottom: txtTitle.top
bottomMargin: 10
left: parent.left
leftMargin: 20
}
color: "white"
font.family: "Roboto"
renderType: Text.NativeRendering
font.weight: Font.Normal
font.pixelSize: 14
wrapMode: Text.WordWrap
}
MouseArea {
anchors.fill: parent
onClicked: Qt.openUrlExternally(link)
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
}
}
}
ScrollBar.vertical: ScrollBar {
snapMode: ScrollBar.SnapOnRelease
policy: ScrollBar.AlwaysOn
}
} }
Rectangle { Rectangle {
@ -338,7 +196,8 @@ Item {
text: qsTr("Forums") text: qsTr("Forums")
Material.background: Material.Blue Material.background: Material.Blue
Material.foreground: "white" Material.foreground: "white"
onClicked: Qt.openUrlExternally("https://forum.screen-play.app/") onClicked: Qt.openUrlExternally(
"https://forum.screen-play.app/")
icon.source: "qrc:/assets/icons/icon_people.svg" icon.source: "qrc:/assets/icons/icon_people.svg"
icon.color: "white" icon.color: "white"
icon.width: 16 icon.width: 16
@ -352,7 +211,8 @@ Item {
icon.color: "white" icon.color: "white"
icon.width: 16 icon.width: 16
icon.height: 16 icon.height: 16
onClicked: Qt.openUrlExternally("https://screen-play.app/index.php/blog") onClicked: Qt.openUrlExternally(
"https://screen-play.app/index.php/blog")
} }
Button { Button {
text: qsTr("Source Code") text: qsTr("Source Code")
@ -363,7 +223,8 @@ Item {
icon.color: "white" icon.color: "white"
icon.width: 16 icon.width: 16
icon.height: 16 icon.height: 16
onClicked: Qt.openUrlExternally("https://gitlab.com/aimber/ScreenPlay/") onClicked: Qt.openUrlExternally(
"https://gitlab.com/aimber/ScreenPlay/")
} }
Button { Button {
text: qsTr("Workshop") text: qsTr("Workshop")

View File

@ -0,0 +1,179 @@
import QtQuick 2.9
import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.2
import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.3
import QtQuick.XmlListModel 2.0
GridView {
id: changelogFlickableWrapper
flickableDirection: Flickable.VerticalFlick
maximumFlickVelocity: 5000
flickDeceleration: 5000
cellHeight: 205
cellWidth: 360
model: feedModel
Timer {
interval: 200
running: true
repeat: false
onTriggered: {
feedModel.source = "https://screen-play.app/index.php?option=com_content&view=category&layout=blog&id=10&format=feed&type=rss"
}
}
XmlListModel {
id: feedModel
query: "/rss/channel/item"
XmlRole {
name: "title"
query: "title/string()"
}
XmlRole {
name: "backgroundImage"
query: "description/string()"
}
XmlRole {
name: "link"
query: "link/string()"
}
XmlRole {
name: "pubDate"
query: "pubDate/string()"
}
XmlRole {
name: "category"
query: "category/string()"
}
}
header: Item {
height: 100
width: parent.width
Text {
id: name
text: qsTr("News & Patchnotes")
wrapMode: Text.WordWrap
color: "#626262"
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft
font.pixelSize: 32
font.family: "Roboto"
anchors {
top: parent.top
topMargin: 30
horizontalCenter: parent.horizontalCenter
}
}
}
delegate: Item {
id: root
width: 352
height: 197
RectangularGlow {
id: effectchangelogWrapper
anchors {
top: parent.top
topMargin: 3
}
height: parent.height
width: parent.width
cached: true
glowRadius: 3
spread: 0.2
color: "black"
opacity: 0.2
cornerRadius: 15
}
Rectangle {
anchors.fill: parent
anchors.margins: 5
radius: 4
Image {
fillMode: Image.PreserveAspectCrop
anchors.fill: parent
source: {
var a = backgroundImage
var r = new RegExp(/<img[^>]+src="([^">]+)"/)
var url = r.exec(a)
return url[1].toString()
}
}
LinearGradient {
visible: true
opacity: .5
anchors.fill: parent
start: Qt.point(0, parent.height)
end: Qt.point(0, parent.height - 150)
gradient: Gradient {
GradientStop {
position: 0.0
color: "#BB000000"
}
GradientStop {
position: 1.0
color: "#00000000"
}
}
}
Text {
id: txtTitle
text: title
renderType: Text.NativeRendering
anchors {
right: parent.right
bottom: parent.bottom
left: parent.left
margins: 20
}
color: "white"
font.family: "Roboto"
font.weight: Font.Normal
font.pixelSize: 18
wrapMode: Text.WordWrap
}
Text {
id: txtPubDate
text: {
return pubDate.replace("+0000", "")
}
anchors {
right: parent.right
rightMargin: 20
bottom: txtTitle.top
bottomMargin: 10
left: parent.left
leftMargin: 20
}
color: "white"
font.family: "Roboto"
renderType: Text.NativeRendering
font.weight: Font.Normal
font.pixelSize: 14
wrapMode: Text.WordWrap
}
MouseArea {
anchors.fill: parent
onClicked: Qt.openUrlExternally(link)
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
}
}
}
ScrollBar.vertical: ScrollBar {
snapMode: ScrollBar.SnapOnRelease
policy: ScrollBar.AlwaysOn
}
}