mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Cleanup
This commit is contained in:
parent
86c3a453c4
commit
185ddb45e9
@ -1,5 +1,4 @@
|
|||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
|
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
import QtQuick.Particles 2.0
|
import QtQuick.Particles 2.0
|
||||||
|
|
||||||
@ -19,6 +18,11 @@ Item {
|
|||||||
id: bgCommunity
|
id: bgCommunity
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
}
|
}
|
||||||
|
Rectangle {
|
||||||
|
id: bgWorkshop
|
||||||
|
color: "#161C1D"
|
||||||
|
anchors.fill: parent
|
||||||
|
}
|
||||||
|
|
||||||
property var myDate: new Date()
|
property var myDate: new Date()
|
||||||
|
|
||||||
@ -51,6 +55,10 @@ Item {
|
|||||||
target: bgCommunity
|
target: bgCommunity
|
||||||
opacity: 0
|
opacity: 0
|
||||||
}
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: bgWorkshop
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "create"
|
name: "create"
|
||||||
@ -62,6 +70,10 @@ Item {
|
|||||||
target: bgCommunity
|
target: bgCommunity
|
||||||
opacity: 0
|
opacity: 0
|
||||||
}
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: bgWorkshop
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
},
|
},
|
||||||
State {
|
State {
|
||||||
name: "community"
|
name: "community"
|
||||||
@ -73,42 +85,46 @@ Item {
|
|||||||
target: bgCommunity
|
target: bgCommunity
|
||||||
opacity: 1
|
opacity: 1
|
||||||
}
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: bgWorkshop
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
State {
|
||||||
|
name: "workshop"
|
||||||
|
PropertyChanges {
|
||||||
|
target: colorShaderCreate
|
||||||
|
shaderOpacity: 0
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: bgCommunity
|
||||||
|
opacity: 0
|
||||||
|
}
|
||||||
|
PropertyChanges {
|
||||||
|
target: bgWorkshop
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
transitions: [
|
transitions: [
|
||||||
Transition {
|
|
||||||
from: "init"
|
|
||||||
to: "create"
|
|
||||||
|
|
||||||
PropertyAnimation {
|
|
||||||
target: colorShaderCreate
|
|
||||||
property: "shaderOpacity"
|
|
||||||
duration: 400
|
|
||||||
easing.type: Easing.OutQuart
|
|
||||||
}
|
|
||||||
},
|
|
||||||
Transition {
|
Transition {
|
||||||
from: "create"
|
from: "*"
|
||||||
to: "*"
|
to: "*"
|
||||||
|
|
||||||
|
PropertyAnimation {
|
||||||
|
targets: [bgCommunity, bgWorkshop]
|
||||||
|
property: "opacity"
|
||||||
|
duration: 400
|
||||||
|
easing.type: Easing.InOutQuart
|
||||||
|
}
|
||||||
PropertyAnimation {
|
PropertyAnimation {
|
||||||
target: colorShaderCreate
|
target: colorShaderCreate
|
||||||
property: "shaderOpacity"
|
property: "shaderOpacity"
|
||||||
duration: 0
|
duration: 0
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
Transition {
|
|
||||||
from: "*"
|
|
||||||
to: "community"
|
|
||||||
|
|
||||||
PropertyAnimation {
|
|
||||||
target: bgCommunity
|
|
||||||
property: "opacity"
|
|
||||||
duration: 400
|
|
||||||
easing.type: Easing.InOutQuart
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,8 @@ import QtGraphicalEffects 1.0
|
|||||||
import Qt.labs.platform 1.0
|
import Qt.labs.platform 1.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id:createWidget
|
id: createWidget
|
||||||
state: "out"
|
state: "out"
|
||||||
|
|
||||||
Component.onCompleted: state = "in"
|
Component.onCompleted: state = "in"
|
||||||
|
|
||||||
signal buttonPressed(var type, var title, var iconSource)
|
signal buttonPressed(var type, var title, var iconSource)
|
||||||
@ -20,7 +19,7 @@ Item {
|
|||||||
|
|
||||||
color: "white"
|
color: "white"
|
||||||
font.pointSize: 21
|
font.pointSize: 21
|
||||||
|
|
||||||
font.family: "Roboto"
|
font.family: "Roboto"
|
||||||
font.weight: Font.Thin
|
font.weight: Font.Thin
|
||||||
}
|
}
|
||||||
@ -52,14 +51,14 @@ Item {
|
|||||||
id: txtExamples
|
id: txtExamples
|
||||||
text: qsTr("Examples Widgets and Scenes")
|
text: qsTr("Examples Widgets and Scenes")
|
||||||
font.family: "Roboto"
|
font.family: "Roboto"
|
||||||
|
|
||||||
font.pointSize: 16
|
font.pointSize: 16
|
||||||
color: "white"
|
color: "white"
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: btnCreateEmptyWidget.bottom
|
top: btnCreateEmptyWidget.bottom
|
||||||
topMargin: 30
|
topMargin: 30
|
||||||
left:parent.left
|
left: parent.left
|
||||||
leftMargin: 30
|
leftMargin: 30
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,7 +74,7 @@ Item {
|
|||||||
CreateWidgetButton {
|
CreateWidgetButton {
|
||||||
id: btnEmpty1
|
id: btnEmpty1
|
||||||
text: qsTr("Simple clock widget")
|
text: qsTr("Simple clock widget")
|
||||||
buttonActive: true
|
|
||||||
animOffset: 150
|
animOffset: 150
|
||||||
state: createWidget.state
|
state: createWidget.state
|
||||||
imgSource: "qrc:/assets/icons/icon_time.svg"
|
imgSource: "qrc:/assets/icons/icon_time.svg"
|
||||||
@ -86,7 +85,7 @@ Item {
|
|||||||
CreateWidgetButton {
|
CreateWidgetButton {
|
||||||
id: btnEmpty2
|
id: btnEmpty2
|
||||||
text: qsTr("Musik scene wallpaper visualizer")
|
text: qsTr("Musik scene wallpaper visualizer")
|
||||||
buttonActive: true
|
|
||||||
animOffset: 200
|
animOffset: 200
|
||||||
state: createWidget.state
|
state: createWidget.state
|
||||||
imgSource: "qrc:/assets/icons/icon_library_music.svg"
|
imgSource: "qrc:/assets/icons/icon_library_music.svg"
|
||||||
@ -98,7 +97,7 @@ Item {
|
|||||||
id: btnEmpty3
|
id: btnEmpty3
|
||||||
text: qsTr("Changing scene wallpaper via unsplash.com")
|
text: qsTr("Changing scene wallpaper via unsplash.com")
|
||||||
imgSource: "qrc:/assets/icons/icon_scene.svg"
|
imgSource: "qrc:/assets/icons/icon_scene.svg"
|
||||||
buttonActive: true
|
|
||||||
animOffset: 250
|
animOffset: 250
|
||||||
state: createWidget.state
|
state: createWidget.state
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -164,6 +163,16 @@ Item {
|
|||||||
to: "in"
|
to: "in"
|
||||||
reversible: true
|
reversible: true
|
||||||
|
|
||||||
|
ScriptAction {
|
||||||
|
script: {
|
||||||
|
if (state === "out") {
|
||||||
|
btnEmpty1.state = "out"
|
||||||
|
btnEmpty2.state = "out"
|
||||||
|
btnEmpty3.state = "out"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PropertyAnimation {
|
PropertyAnimation {
|
||||||
target: txtCreate
|
target: txtCreate
|
||||||
properties: "opacity,anchors.topMargin"
|
properties: "opacity,anchors.topMargin"
|
||||||
@ -187,14 +196,8 @@ Item {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*##^## Designer {
|
/*##^## Designer {
|
||||||
D{i:0;autoSize:true;height:480;width:640}
|
D{i:0;autoSize:true;height:480;width:640}
|
||||||
}
|
}
|
||||||
##^##*/
|
##^##*/
|
||||||
|
|
||||||
|
@ -12,12 +12,12 @@ Item {
|
|||||||
|
|
||||||
Component.onCompleted: btnEmpty.state = "in"
|
Component.onCompleted: btnEmpty.state = "in"
|
||||||
property int animOffset: 0
|
property int animOffset: 0
|
||||||
|
|
||||||
property string text
|
property string text
|
||||||
signal clicked
|
property bool buttonActive: false
|
||||||
property bool buttonActive: true
|
|
||||||
property string imgSource: "qrc:/assets/icons/icon_library_music.svg"
|
property string imgSource: "qrc:/assets/icons/icon_library_music.svg"
|
||||||
|
|
||||||
|
signal clicked
|
||||||
|
|
||||||
RectangularGlow {
|
RectangularGlow {
|
||||||
id: effect
|
id: effect
|
||||||
anchors {
|
anchors {
|
||||||
@ -52,6 +52,7 @@ Item {
|
|||||||
height: 30
|
height: 30
|
||||||
sourceSize: Qt.size(30, 30)
|
sourceSize: Qt.size(30, 30)
|
||||||
source: imgSource
|
source: imgSource
|
||||||
|
opacity: buttonActive ? 1 : .25
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
leftMargin: 20
|
leftMargin: 20
|
||||||
@ -61,6 +62,7 @@ Item {
|
|||||||
ColorOverlay {
|
ColorOverlay {
|
||||||
color: "gray"
|
color: "gray"
|
||||||
source: imgIcon
|
source: imgIcon
|
||||||
|
opacity: buttonActive ? 1 : .25
|
||||||
anchors.fill: imgIcon
|
anchors.fill: imgIcon
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +70,7 @@ Item {
|
|||||||
id: name
|
id: name
|
||||||
text: btnEmpty.text
|
text: btnEmpty.text
|
||||||
font.family: "Roboto"
|
font.family: "Roboto"
|
||||||
|
opacity: buttonActive ? 1 : .25
|
||||||
font.pointSize: 14
|
font.pointSize: 14
|
||||||
color: "gray"
|
color: "gray"
|
||||||
anchors {
|
anchors {
|
||||||
@ -78,11 +80,10 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
|
|
||||||
text: ">"
|
text: ">"
|
||||||
font.family: "Roboto"
|
font.family: "Roboto"
|
||||||
|
|
||||||
font.pointSize: 18
|
font.pointSize: 18
|
||||||
|
opacity: buttonActive ? 1 : .25
|
||||||
color: "#b9b9b9"
|
color: "#b9b9b9"
|
||||||
anchors {
|
anchors {
|
||||||
right: parent.right
|
right: parent.right
|
||||||
@ -182,14 +183,14 @@ Item {
|
|||||||
ParallelAnimation {
|
ParallelAnimation {
|
||||||
ParallelAnimation {
|
ParallelAnimation {
|
||||||
|
|
||||||
NumberAnimation {
|
PropertyAnimation {
|
||||||
target: bg
|
target: bg
|
||||||
property: "opacity"
|
property: "opacity"
|
||||||
duration: 400
|
duration: 400
|
||||||
easing.type: Easing.InOutQuart
|
easing.type: Easing.InOutQuart
|
||||||
}
|
}
|
||||||
|
|
||||||
NumberAnimation {
|
PropertyAnimation {
|
||||||
target: bg
|
target: bg
|
||||||
property: "anchors.topMargin"
|
property: "anchors.topMargin"
|
||||||
easing.type: Easing.InOutQuart
|
easing.type: Easing.InOutQuart
|
||||||
@ -200,7 +201,7 @@ Item {
|
|||||||
PauseAnimation {
|
PauseAnimation {
|
||||||
duration: 200
|
duration: 200
|
||||||
}
|
}
|
||||||
NumberAnimation {
|
PropertyAnimation {
|
||||||
target: effect
|
target: effect
|
||||||
property: "opacity"
|
property: "opacity"
|
||||||
duration: 400
|
duration: 400
|
||||||
|
@ -19,11 +19,11 @@ Item {
|
|||||||
property string screenId: ""
|
property string screenId: ""
|
||||||
|
|
||||||
onTypeChanged: {
|
onTypeChanged: {
|
||||||
if (type === "widget") {
|
if(type.endsWith("Widget"))
|
||||||
icnType.source = "qrc:/assets/icons/icon_widgets.svg"
|
icnType.source = "qrc:/assets/icons/icon_widgets.svg"
|
||||||
} else if (type === "qmlScene") {
|
|
||||||
icnType.source = "qrc:/assets/icons/icon_code.svg"
|
if(type.endsWith("Wallpaper"))
|
||||||
}
|
icnType.source = "qrc:/assets/icons/icon_movie.svg"
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
@ -15,7 +15,6 @@ Item {
|
|||||||
property string type
|
property string type
|
||||||
property string activeScreen
|
property string activeScreen
|
||||||
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: utility
|
target: utility
|
||||||
|
|
||||||
@ -23,46 +22,36 @@ Item {
|
|||||||
activeScreen = screenId
|
activeScreen = screenId
|
||||||
sidebar.type = type
|
sidebar.type = type
|
||||||
|
|
||||||
|
// Toggle sidebar if clicked on the same content twice
|
||||||
|
if (activeScreen == screenId && state == "active") {
|
||||||
|
state = "inactive"
|
||||||
|
} else {
|
||||||
|
state = "active"
|
||||||
|
}
|
||||||
|
|
||||||
if ((type === "video")) {
|
switch (type) {
|
||||||
if (activeScreen == screenId
|
case "videoWallpaper":
|
||||||
&& state == "active") {
|
state = "activeScene"
|
||||||
state = "inactive"
|
return
|
||||||
} else {
|
case "htmlWallpaper":
|
||||||
state = "active"
|
state = "activeScene"
|
||||||
}
|
return
|
||||||
|
case "qmlWallpaper":
|
||||||
|
state = "activeScene"
|
||||||
|
return
|
||||||
|
case "godotWallpaper":
|
||||||
|
state = "activeScene"
|
||||||
|
return
|
||||||
|
case "qmlWidget":
|
||||||
|
state = "activeWidget"
|
||||||
|
return
|
||||||
|
case "htmlWidget":
|
||||||
|
state = "activeWidget"
|
||||||
|
return
|
||||||
|
case "standaloneWidget":
|
||||||
|
state = "activeWidget"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === "widget") {
|
|
||||||
if (activeScreen == screenId
|
|
||||||
&& state == "activeWidget") {
|
|
||||||
state = "inactive"
|
|
||||||
} else {
|
|
||||||
state = "activeWidget"
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type === "qmlScene") {
|
|
||||||
if (activeScreen == screenId
|
|
||||||
&& state == "activeScene") {
|
|
||||||
state = "inactive"
|
|
||||||
} else {
|
|
||||||
state = "activeScene"
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type === "html") {
|
|
||||||
if (activeScreen == screenId
|
|
||||||
&& state == "activeScene") {
|
|
||||||
state = "inactive"
|
|
||||||
} else {
|
|
||||||
state = "activeScene"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,9 +64,8 @@ Item {
|
|||||||
onActiveScreenChanged: {
|
onActiveScreenChanged: {
|
||||||
txtHeadline.text = installedListModel.get(activeScreen).screenTitle
|
txtHeadline.text = installedListModel.get(activeScreen).screenTitle
|
||||||
image.source = Qt.resolvedUrl(
|
image.source = Qt.resolvedUrl(
|
||||||
installedListModel.absoluteStoragePath + "/"
|
installedListModel.absoluteStoragePath + "/" + activeScreen
|
||||||
+ activeScreen + "/" + installedListModel.get(
|
+ "/" + installedListModel.get(activeScreen).screenPreview)
|
||||||
activeScreen).screenPreview)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -212,7 +200,7 @@ Item {
|
|||||||
id: txtHeadline
|
id: txtHeadline
|
||||||
text: qsTr("Headline")
|
text: qsTr("Headline")
|
||||||
height: 60
|
height: 60
|
||||||
|
|
||||||
font.family: "Roboto"
|
font.family: "Roboto"
|
||||||
font.weight: Font.Thin
|
font.weight: Font.Thin
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
@ -233,7 +221,7 @@ Item {
|
|||||||
id: txtHeadlineMonitor
|
id: txtHeadlineMonitor
|
||||||
text: qsTr("Select a Monitor to display the content")
|
text: qsTr("Select a Monitor to display the content")
|
||||||
height: 50
|
height: 50
|
||||||
|
|
||||||
horizontalAlignment: Qt.AlignHCenter
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
font.family: "Roboto"
|
font.family: "Roboto"
|
||||||
font.pointSize: 14
|
font.pointSize: 14
|
||||||
@ -257,18 +245,18 @@ Item {
|
|||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
|
|
||||||
MonitorSelection {
|
MonitorSelection {
|
||||||
id: monitorSelection
|
id: monitorSelection
|
||||||
width: 360
|
width: 360
|
||||||
height: parent.height
|
height: parent.height
|
||||||
availableWidth: 360
|
availableWidth: 360
|
||||||
fontSize: 11
|
fontSize: 11
|
||||||
availableHeight: 50
|
availableHeight: 50
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: parent.horizontalCenter
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -287,7 +275,7 @@ Item {
|
|||||||
id: txtSliderVolume
|
id: txtSliderVolume
|
||||||
text: qsTr("Volume")
|
text: qsTr("Volume")
|
||||||
height: 30
|
height: 30
|
||||||
|
|
||||||
font.family: "Roboto"
|
font.family: "Roboto"
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
font.pointSize: 10
|
font.pointSize: 10
|
||||||
@ -342,7 +330,7 @@ Item {
|
|||||||
id: txtComboBoxFillMode
|
id: txtComboBoxFillMode
|
||||||
text: qsTr("Fill Mode")
|
text: qsTr("Fill Mode")
|
||||||
height: 30
|
height: 30
|
||||||
|
|
||||||
font.family: "Roboto"
|
font.family: "Roboto"
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
font.pointSize: 10
|
font.pointSize: 10
|
||||||
@ -398,15 +386,15 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (type === "video" || type === "qmlScene" || type === "html") {
|
|
||||||
|
if (type.endsWith("Wallpaper")) {
|
||||||
screenPlay.createWallpaper(
|
screenPlay.createWallpaper(
|
||||||
monitorSelection.activeMonitorIndex, installedListModel.absoluteStoragePath + "/" + activeScreen,
|
monitorSelection.activeMonitorIndex, installedListModel.absoluteStoragePath + "/" + activeScreen,
|
||||||
installedListModel.get(activeScreen).screenPreview,
|
installedListModel.get(activeScreen).screenPreview,
|
||||||
(Math.round(sliderVolume.value * 100) / 100),
|
(Math.round(sliderVolume.value * 100) / 100),
|
||||||
settingsComboBox.model.get(settingsComboBox.currentIndex).text.toString(
|
settingsComboBox.model.get(settingsComboBox.currentIndex).text.toString(
|
||||||
), type)
|
), type)
|
||||||
|
} else {
|
||||||
} else if (type === "widget" ) {
|
|
||||||
screenPlay.createWidget(
|
screenPlay.createWidget(
|
||||||
installedListModel.absoluteStoragePath + "/" + activeScreen,
|
installedListModel.absoluteStoragePath + "/" + activeScreen,
|
||||||
installedListModel.get(
|
installedListModel.get(
|
||||||
|
@ -26,10 +26,10 @@ void InstalledListFilter::sortByRoleType(QString type)
|
|||||||
setFilterWildcard("*");
|
setFilterWildcard("*");
|
||||||
} else if (type == "Wallpaper") {
|
} else if (type == "Wallpaper") {
|
||||||
setFilterRole(InstalledListModel::InstalledRole::TypeRole);
|
setFilterRole(InstalledListModel::InstalledRole::TypeRole);
|
||||||
setFilterFixedString("video");
|
setFilterWildcard("*Wallpaper");
|
||||||
} else if (type == "Widgets") {
|
} else if (type == "Widgets") {
|
||||||
setFilterRole(InstalledListModel::InstalledRole::TypeRole);
|
setFilterRole(InstalledListModel::InstalledRole::TypeRole);
|
||||||
setFilterFixedString("widget");
|
setFilterWildcard("*Widget");
|
||||||
}
|
}
|
||||||
if (type == "Scenes") {
|
if (type == "Scenes") {
|
||||||
setFilterRole(InstalledListModel::InstalledRole::TypeRole);
|
setFilterRole(InstalledListModel::InstalledRole::TypeRole);
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
#include "installedlistmodel.h"
|
#include "installedlistmodel.h"
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class Installed List Model
|
\class Installed List Model
|
||||||
\brief Lists all installed wallpapers, widgets etc. from a given Path
|
\brief Lists all installed wallpapers, widgets etc. from a given Path
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
namespace ScreenPlay {
|
namespace ScreenPlay {
|
||||||
|
|
||||||
InstalledListModel::InstalledListModel(QObject* parent)
|
InstalledListModel::InstalledListModel(QObject* parent)
|
||||||
@ -85,13 +83,12 @@ bool InstalledListModel::getProjectByAbsoluteStoragePath(QUrl* path, ProjectFile
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstalledListModel::append(const QJsonObject obj, const QString folderName)
|
void InstalledListModel::append(const QJsonObject& obj, const QString& folderName)
|
||||||
{
|
{
|
||||||
|
|
||||||
beginInsertRows(QModelIndex(), m_screenPlayFiles.size(), m_screenPlayFiles.size());
|
beginInsertRows(QModelIndex(), m_screenPlayFiles.size(), m_screenPlayFiles.size());
|
||||||
|
|
||||||
ProjectFile tmpFile(obj, folderName, m_absoluteStoragePath);
|
m_screenPlayFiles.append(ProjectFile(obj, folderName, m_absoluteStoragePath));
|
||||||
m_screenPlayFiles.append(tmpFile);
|
|
||||||
|
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
@ -122,34 +119,29 @@ void InstalledListModel::loadInstalledContent()
|
|||||||
if (!(parseError.error == QJsonParseError::NoError))
|
if (!(parseError.error == QJsonParseError::NoError))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (jsonProject.object().value("type").toString() == "scene")
|
if (jsonProject.isEmpty() || jsonProject.object().empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (jsonProject.isEmpty())
|
if (!obj.contains("file") || !obj.contains("type"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (jsonProject.object().empty())
|
QStringList availableTypes {
|
||||||
continue;
|
"qmlWallpaper",
|
||||||
|
"htmlWallpaper",
|
||||||
|
"videoWallpaper",
|
||||||
|
"godotWallpaper",
|
||||||
|
|
||||||
//Some settings dont have a file type
|
"qmlWidget",
|
||||||
QString fileEnding;
|
"htmlWidget",
|
||||||
if (obj.contains("file")) {
|
"standaloneWidget"
|
||||||
fileEnding = obj.value("file").toString();
|
};
|
||||||
if (!obj.contains("type")) {
|
|
||||||
obj.insert("type", "video");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fileEnding.endsWith(".webm") || (obj.value("type").toString() == "qmlScene" || fileEnding.endsWith(".html")))
|
if (availableTypes.contains(obj.value("type").toString()))
|
||||||
emit addInstalledItem(obj, item.baseName());
|
emit addInstalledItem(obj, item.baseName());
|
||||||
|
|
||||||
if (obj.value("type") == "qmlWidget" || obj.value("type") == "standalonewidget")
|
|
||||||
emit addInstalledItem(obj, item.baseName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
emit installedLoadingFinished();
|
emit installedLoadingFinished();
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap InstalledListModel::get(QString folderId)
|
QVariantMap InstalledListModel::get(QString folderId)
|
||||||
|
@ -56,7 +56,7 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void loadInstalledContent();
|
void loadInstalledContent();
|
||||||
void append(const QJsonObject, const QString);
|
void append(const QJsonObject &, const QString &);
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
int getAmountItemLoaded();
|
int getAmountItemLoaded();
|
||||||
|
@ -13,12 +13,11 @@
|
|||||||
*/
|
*/
|
||||||
namespace ScreenPlay {
|
namespace ScreenPlay {
|
||||||
|
|
||||||
|
|
||||||
struct ProjectFile {
|
struct ProjectFile {
|
||||||
|
|
||||||
ProjectFile(const QJsonObject& obj,
|
ProjectFile(const QJsonObject& obj,
|
||||||
const QString& folderName,
|
const QString& folderName,
|
||||||
const QUrl& absolutePath)
|
const QUrl& absolutePath)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (obj.contains("description"))
|
if (obj.contains("description"))
|
||||||
@ -36,18 +35,8 @@ struct ProjectFile {
|
|||||||
if (obj.contains("title"))
|
if (obj.contains("title"))
|
||||||
m_title = obj.value("title");
|
m_title = obj.value("title");
|
||||||
|
|
||||||
if (obj.contains("type")) {
|
if (obj.contains("type"))
|
||||||
QString tmp = obj.value("type").toString().toLower();
|
m_type = obj.value("type").toString();
|
||||||
if (tmp == "video") {
|
|
||||||
m_type = "video";
|
|
||||||
} else if (tmp == "qmlwidget" || tmp == "standalonewidget") {
|
|
||||||
m_type = "widget";
|
|
||||||
} else if (tmp == "qmlscene") {
|
|
||||||
m_type = "qmlScene";
|
|
||||||
} else if (tmp == "html") {
|
|
||||||
m_type = "html";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj.contains("workshopid")) {
|
if (obj.contains("workshopid")) {
|
||||||
m_workshopID = obj.value("workshopid").toInt();
|
m_workshopID = obj.value("workshopid").toInt();
|
||||||
|
@ -121,7 +121,7 @@ Settings::Settings(const shared_ptr<InstalledListModel>& ilm,
|
|||||||
m_localStoragePath = QUrl::fromUserInput(configObj.value("absoluteStoragePath").toString());
|
m_localStoragePath = QUrl::fromUserInput(configObj.value("absoluteStoragePath").toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_qSettings.value("ScreenPlayInstalledPath").isNull()) {
|
if (m_qSettings.value("ScreenPlayInstalledPath").toUrl() != m_localStoragePath) {
|
||||||
m_qSettings.setValue("ScreenPlayInstalledPath", QDir::toNativeSeparators(m_localStoragePath.toString().remove("file:///")));
|
m_qSettings.setValue("ScreenPlayInstalledPath", QDir::toNativeSeparators(m_localStoragePath.toString().remove("file:///")));
|
||||||
m_qSettings.sync();
|
m_qSettings.sync();
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ ScreenPlaySDK::ScreenPlaySDK(QQuickItem* parent)
|
|||||||
|
|
||||||
ScreenPlaySDK::~ScreenPlaySDK()
|
ScreenPlaySDK::~ScreenPlaySDK()
|
||||||
{
|
{
|
||||||
|
m_socket.disconnectFromServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenPlaySDK::connected()
|
void ScreenPlaySDK::connected()
|
||||||
|
Loading…
Reference in New Issue
Block a user