1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-25 20:22:39 +01:00
This commit is contained in:
Elias 2019-07-18 21:51:10 +02:00
parent 86c3a453c4
commit 185ddb45e9
11 changed files with 143 additions and 153 deletions

View File

@ -1,5 +1,4 @@
import QtQuick 2.12
import QtGraphicalEffects 1.0
import QtQuick.Particles 2.0
@ -19,6 +18,11 @@ Item {
id: bgCommunity
anchors.fill: parent
}
Rectangle {
id: bgWorkshop
color: "#161C1D"
anchors.fill: parent
}
property var myDate: new Date()
@ -51,6 +55,10 @@ Item {
target: bgCommunity
opacity: 0
}
PropertyChanges {
target: bgWorkshop
opacity: 0
}
},
State {
name: "create"
@ -62,6 +70,10 @@ Item {
target: bgCommunity
opacity: 0
}
PropertyChanges {
target: bgWorkshop
opacity: 0
}
},
State {
name: "community"
@ -73,42 +85,46 @@ Item {
target: bgCommunity
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: [
Transition {
from: "init"
to: "create"
PropertyAnimation {
target: colorShaderCreate
property: "shaderOpacity"
duration: 400
easing.type: Easing.OutQuart
}
},
Transition {
from: "create"
from: "*"
to: "*"
PropertyAnimation {
targets: [bgCommunity, bgWorkshop]
property: "opacity"
duration: 400
easing.type: Easing.InOutQuart
}
PropertyAnimation {
target: colorShaderCreate
property: "shaderOpacity"
duration: 0
}
},
Transition {
from: "*"
to: "community"
PropertyAnimation {
target: bgCommunity
property: "opacity"
duration: 400
easing.type: Easing.InOutQuart
}
}
]
}

View File

@ -3,9 +3,8 @@ import QtGraphicalEffects 1.0
import Qt.labs.platform 1.0
Item {
id:createWidget
id: createWidget
state: "out"
Component.onCompleted: state = "in"
signal buttonPressed(var type, var title, var iconSource)
@ -20,7 +19,7 @@ Item {
color: "white"
font.pointSize: 21
font.family: "Roboto"
font.weight: Font.Thin
}
@ -52,14 +51,14 @@ Item {
id: txtExamples
text: qsTr("Examples Widgets and Scenes")
font.family: "Roboto"
font.pointSize: 16
color: "white"
anchors {
top: btnCreateEmptyWidget.bottom
topMargin: 30
left:parent.left
left: parent.left
leftMargin: 30
}
}
@ -75,7 +74,7 @@ Item {
CreateWidgetButton {
id: btnEmpty1
text: qsTr("Simple clock widget")
buttonActive: true
animOffset: 150
state: createWidget.state
imgSource: "qrc:/assets/icons/icon_time.svg"
@ -86,7 +85,7 @@ Item {
CreateWidgetButton {
id: btnEmpty2
text: qsTr("Musik scene wallpaper visualizer")
buttonActive: true
animOffset: 200
state: createWidget.state
imgSource: "qrc:/assets/icons/icon_library_music.svg"
@ -98,7 +97,7 @@ Item {
id: btnEmpty3
text: qsTr("Changing scene wallpaper via unsplash.com")
imgSource: "qrc:/assets/icons/icon_scene.svg"
buttonActive: true
animOffset: 250
state: createWidget.state
onClicked: {
@ -164,6 +163,16 @@ Item {
to: "in"
reversible: true
ScriptAction {
script: {
if (state === "out") {
btnEmpty1.state = "out"
btnEmpty2.state = "out"
btnEmpty3.state = "out"
}
}
}
PropertyAnimation {
target: txtCreate
properties: "opacity,anchors.topMargin"
@ -187,14 +196,8 @@ Item {
]
}
/*##^## Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/

View File

@ -12,12 +12,12 @@ Item {
Component.onCompleted: btnEmpty.state = "in"
property int animOffset: 0
property string text
signal clicked
property bool buttonActive: true
property bool buttonActive: false
property string imgSource: "qrc:/assets/icons/icon_library_music.svg"
signal clicked
RectangularGlow {
id: effect
anchors {
@ -52,6 +52,7 @@ Item {
height: 30
sourceSize: Qt.size(30, 30)
source: imgSource
opacity: buttonActive ? 1 : .25
anchors {
left: parent.left
leftMargin: 20
@ -61,6 +62,7 @@ Item {
ColorOverlay {
color: "gray"
source: imgIcon
opacity: buttonActive ? 1 : .25
anchors.fill: imgIcon
}
@ -68,7 +70,7 @@ Item {
id: name
text: btnEmpty.text
font.family: "Roboto"
opacity: buttonActive ? 1 : .25
font.pointSize: 14
color: "gray"
anchors {
@ -78,11 +80,10 @@ Item {
}
}
Text {
text: ">"
font.family: "Roboto"
font.pointSize: 18
opacity: buttonActive ? 1 : .25
color: "#b9b9b9"
anchors {
right: parent.right
@ -182,14 +183,14 @@ Item {
ParallelAnimation {
ParallelAnimation {
NumberAnimation {
PropertyAnimation {
target: bg
property: "opacity"
duration: 400
easing.type: Easing.InOutQuart
}
NumberAnimation {
PropertyAnimation {
target: bg
property: "anchors.topMargin"
easing.type: Easing.InOutQuart
@ -200,7 +201,7 @@ Item {
PauseAnimation {
duration: 200
}
NumberAnimation {
PropertyAnimation {
target: effect
property: "opacity"
duration: 400

View File

@ -19,11 +19,11 @@ Item {
property string screenId: ""
onTypeChanged: {
if (type === "widget") {
if(type.endsWith("Widget"))
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: {

View File

@ -15,7 +15,6 @@ Item {
property string type
property string activeScreen
Connections {
target: utility
@ -23,46 +22,36 @@ Item {
activeScreen = screenId
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")) {
if (activeScreen == screenId
&& state == "active") {
state = "inactive"
} else {
state = "active"
}
switch (type) {
case "videoWallpaper":
state = "activeScene"
return
case "htmlWallpaper":
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
}
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: {
txtHeadline.text = installedListModel.get(activeScreen).screenTitle
image.source = Qt.resolvedUrl(
installedListModel.absoluteStoragePath + "/"
+ activeScreen + "/" + installedListModel.get(
activeScreen).screenPreview)
installedListModel.absoluteStoragePath + "/" + activeScreen
+ "/" + installedListModel.get(activeScreen).screenPreview)
}
Item {
@ -212,7 +200,7 @@ Item {
id: txtHeadline
text: qsTr("Headline")
height: 60
font.family: "Roboto"
font.weight: Font.Thin
verticalAlignment: Text.AlignVCenter
@ -233,7 +221,7 @@ Item {
id: txtHeadlineMonitor
text: qsTr("Select a Monitor to display the content")
height: 50
horizontalAlignment: Qt.AlignHCenter
font.family: "Roboto"
font.pointSize: 14
@ -257,18 +245,18 @@ Item {
left: parent.left
}
MonitorSelection {
id: monitorSelection
width: 360
height: parent.height
availableWidth: 360
fontSize: 11
availableHeight: 50
anchors {
top: parent.top
horizontalCenter: parent.horizontalCenter
}
MonitorSelection {
id: monitorSelection
width: 360
height: parent.height
availableWidth: 360
fontSize: 11
availableHeight: 50
anchors {
top: parent.top
horizontalCenter: parent.horizontalCenter
}
}
}
Item {
@ -287,7 +275,7 @@ Item {
id: txtSliderVolume
text: qsTr("Volume")
height: 30
font.family: "Roboto"
verticalAlignment: Text.AlignVCenter
font.pointSize: 10
@ -342,7 +330,7 @@ Item {
id: txtComboBoxFillMode
text: qsTr("Fill Mode")
height: 30
font.family: "Roboto"
verticalAlignment: Text.AlignVCenter
font.pointSize: 10
@ -398,15 +386,15 @@ Item {
}
onClicked: {
if (type === "video" || type === "qmlScene" || type === "html") {
if (type.endsWith("Wallpaper")) {
screenPlay.createWallpaper(
monitorSelection.activeMonitorIndex, installedListModel.absoluteStoragePath + "/" + activeScreen,
installedListModel.get(activeScreen).screenPreview,
(Math.round(sliderVolume.value * 100) / 100),
settingsComboBox.model.get(settingsComboBox.currentIndex).text.toString(
), type)
} else if (type === "widget" ) {
} else {
screenPlay.createWidget(
installedListModel.absoluteStoragePath + "/" + activeScreen,
installedListModel.get(

View File

@ -26,10 +26,10 @@ void InstalledListFilter::sortByRoleType(QString type)
setFilterWildcard("*");
} else if (type == "Wallpaper") {
setFilterRole(InstalledListModel::InstalledRole::TypeRole);
setFilterFixedString("video");
setFilterWildcard("*Wallpaper");
} else if (type == "Widgets") {
setFilterRole(InstalledListModel::InstalledRole::TypeRole);
setFilterFixedString("widget");
setFilterWildcard("*Widget");
}
if (type == "Scenes") {
setFilterRole(InstalledListModel::InstalledRole::TypeRole);

View File

@ -1,13 +1,11 @@
#include "installedlistmodel.h"
/*!
\class Installed List Model
\brief Lists all installed wallpapers, widgets etc. from a given Path
*/
namespace ScreenPlay {
InstalledListModel::InstalledListModel(QObject* parent)
@ -85,13 +83,12 @@ bool InstalledListModel::getProjectByAbsoluteStoragePath(QUrl* path, ProjectFile
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());
ProjectFile tmpFile(obj, folderName, m_absoluteStoragePath);
m_screenPlayFiles.append(tmpFile);
m_screenPlayFiles.append(ProjectFile(obj, folderName, m_absoluteStoragePath));
endInsertRows();
}
@ -122,34 +119,29 @@ void InstalledListModel::loadInstalledContent()
if (!(parseError.error == QJsonParseError::NoError))
continue;
if (jsonProject.object().value("type").toString() == "scene")
if (jsonProject.isEmpty() || jsonProject.object().empty())
continue;
if (jsonProject.isEmpty())
if (!obj.contains("file") || !obj.contains("type"))
continue;
if (jsonProject.object().empty())
continue;
QStringList availableTypes {
"qmlWallpaper",
"htmlWallpaper",
"videoWallpaper",
"godotWallpaper",
//Some settings dont have a file type
QString fileEnding;
if (obj.contains("file")) {
fileEnding = obj.value("file").toString();
if (!obj.contains("type")) {
obj.insert("type", "video");
}
"qmlWidget",
"htmlWidget",
"standaloneWidget"
};
if (fileEnding.endsWith(".webm") || (obj.value("type").toString() == "qmlScene" || fileEnding.endsWith(".html")))
emit addInstalledItem(obj, item.baseName());
if (obj.value("type") == "qmlWidget" || obj.value("type") == "standalonewidget")
emit addInstalledItem(obj, item.baseName());
}
if (availableTypes.contains(obj.value("type").toString()))
emit addInstalledItem(obj, item.baseName());
}
emit installedLoadingFinished();
});
}
QVariantMap InstalledListModel::get(QString folderId)

View File

@ -56,7 +56,7 @@ public:
public slots:
void loadInstalledContent();
void append(const QJsonObject, const QString);
void append(const QJsonObject &, const QString &);
void reset();
int getAmountItemLoaded();

View File

@ -13,12 +13,11 @@
*/
namespace ScreenPlay {
struct ProjectFile {
ProjectFile(const QJsonObject& obj,
const QString& folderName,
const QUrl& absolutePath)
const QString& folderName,
const QUrl& absolutePath)
{
if (obj.contains("description"))
@ -36,18 +35,8 @@ struct ProjectFile {
if (obj.contains("title"))
m_title = obj.value("title");
if (obj.contains("type")) {
QString tmp = obj.value("type").toString().toLower();
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("type"))
m_type = obj.value("type").toString();
if (obj.contains("workshopid")) {
m_workshopID = obj.value("workshopid").toInt();

View File

@ -121,7 +121,7 @@ Settings::Settings(const shared_ptr<InstalledListModel>& ilm,
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.sync();
}

View File

@ -53,6 +53,7 @@ ScreenPlaySDK::ScreenPlaySDK(QQuickItem* parent)
ScreenPlaySDK::~ScreenPlaySDK()
{
m_socket.disconnectFromServer();
}
void ScreenPlaySDK::connected()