mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-23 03:02:30 +01:00
Big update
This commit is contained in:
parent
a49221eb00
commit
ed43963358
@ -12,7 +12,10 @@ SOURCES += main.cpp \
|
||||
src/wallpaper.cpp \
|
||||
src/profilelistmodel.cpp \
|
||||
src/profile.cpp \
|
||||
src/projectfile.cpp
|
||||
src/projectfile.cpp \
|
||||
src/widget.cpp \
|
||||
src/steamworkshoplistmodel.cpp \
|
||||
src/workshopitem.cpp
|
||||
|
||||
RESOURCES += qml.qrc
|
||||
|
||||
@ -25,7 +28,10 @@ HEADERS += \
|
||||
src/wallpaper.h \
|
||||
src/profilelistmodel.h \
|
||||
src/profile.h \
|
||||
src/projectfile.h
|
||||
src/projectfile.h \
|
||||
src/widget.h \
|
||||
src/steamworkshoplistmodel.h \
|
||||
src/workshopitem.h
|
||||
|
||||
INCLUDEPATH += \
|
||||
$$PWD/ThirdParty/ \
|
||||
@ -81,8 +87,8 @@ contains(QT_ARCH, i386) {
|
||||
win32:CONFIG(release, debug|release): LIBS += -L"C:\msys64\mingw64\lib" -llibz.dll
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L"C:\msys64\mingw64\lib" -llibz.dll
|
||||
#quazip
|
||||
win32:CONFIG(release, debug|release): LIBS += -L"C:\msys64\mingw64\lib" -llibquazip.dll
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L"C:\msys64\mingw64\lib" -llibquazip.dll
|
||||
win32:CONFIG(release, debug|release): LIBS += -L"C:\msys64\mingw64\lib" -llibquazip5.dll
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L"C:\msys64\mingw64\lib" -llibquazip5.dll
|
||||
}
|
||||
|
||||
|
||||
|
16
main.cpp
16
main.cpp
@ -22,11 +22,12 @@
|
||||
#include "monitorlistmodel.h"
|
||||
#include "packagefilehandler.h"
|
||||
#include "profilelistmodel.h"
|
||||
#include "quazip/quazip.h"
|
||||
#include "quazip5/quazip.h"
|
||||
#include "settings.h"
|
||||
#include "steam/steam_api.h"
|
||||
#include "steamworkshop.h"
|
||||
|
||||
#include "steamworkshoplistmodel.h"
|
||||
#include "widget.h"
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
@ -49,9 +50,9 @@ int main(int argc, char* argv[])
|
||||
qWarning() << "Could not init steam sdk!";
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
SteamWorkshop steamWorkshop(steamID);
|
||||
SteamWorkshopListModel swlm;
|
||||
SteamWorkshop steamWorkshop(steamID,&swlm);
|
||||
//Widget wg;
|
||||
|
||||
QCoreApplication::setOrganizationName("Aimber");
|
||||
QCoreApplication::setOrganizationDomain("aimber.net");
|
||||
@ -64,7 +65,7 @@ int main(int argc, char* argv[])
|
||||
PackageFileHandler packageFileHandler;
|
||||
ProfileListModel profileListModel;
|
||||
|
||||
// Create settings at the end because for now it depends on
|
||||
// Create settings in the end because for now it depends on
|
||||
// such things as the profile list model to complete
|
||||
// It will also set the m_absoluteStoragePath in profileListModel and installedListModel
|
||||
Settings settings(&profileListModel, &monitorListModel, &installedListModel, steamID);
|
||||
@ -76,6 +77,7 @@ int main(int argc, char* argv[])
|
||||
settings.loadActiveProfiles();
|
||||
|
||||
QQmlApplicationEngine mainWindowEngine;
|
||||
mainWindowEngine.rootContext()->setContextProperty("workshopListModel", &swlm);
|
||||
mainWindowEngine.rootContext()->setContextProperty("monitorListModel", &monitorListModel);
|
||||
mainWindowEngine.rootContext()->setContextProperty("installedListModel", &installedListModel);
|
||||
mainWindowEngine.rootContext()->setContextProperty("settings", &settings);
|
||||
@ -96,7 +98,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
int status = app.exec();
|
||||
|
||||
SteamAPI_Shutdown();
|
||||
//Shutdown
|
||||
return status;
|
||||
SteamAPI_Shutdown();
|
||||
}
|
||||
|
1
qml.qrc
1
qml.qrc
@ -41,5 +41,6 @@
|
||||
<file>assets/icons/icon_plus.svg</file>
|
||||
<file>qml/Components/MonitorSelection.qml</file>
|
||||
<file>qml/Components/CustomPage.qml</file>
|
||||
<file>qml/Components/MonitorSelectionItem.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -7,9 +7,12 @@ CustomPage {
|
||||
id: page
|
||||
pageName: ""
|
||||
|
||||
|
||||
|
||||
Connections {
|
||||
target: steamWorkshop
|
||||
onWorkshopItemCreated: {
|
||||
print("created")
|
||||
if (userNeedsToAcceptWorkshopLegalAgreement) {
|
||||
checkDelegate.opacity = 1
|
||||
} else {
|
||||
@ -18,6 +21,7 @@ CustomPage {
|
||||
page.state = "StartItemUpdate"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CheckDelegate {
|
||||
@ -52,7 +56,6 @@ CustomPage {
|
||||
Column {
|
||||
id: column
|
||||
anchors.fill: parent
|
||||
opacity: 0
|
||||
anchors.margins: 30
|
||||
|
||||
Row {
|
||||
@ -205,25 +208,5 @@ CustomPage {
|
||||
}
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "StartItemUpdate"
|
||||
|
||||
PropertyChanges {
|
||||
target: btnCreateWallpaper
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: busyIndicator
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
PropertyChanges {
|
||||
target: column
|
||||
opacity: 1
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick 2.7
|
||||
import QtGraphicalEffects 1.0
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Controls.Material 2.0
|
||||
|
@ -3,11 +3,25 @@ import QtGraphicalEffects 1.0
|
||||
|
||||
Rectangle {
|
||||
id: rect
|
||||
color: "gray"
|
||||
|
||||
|
||||
// Width of the Sidebar or Space that should be used
|
||||
property real availableWidth: 0
|
||||
property real availableHeight: 0
|
||||
|
||||
property int activeMonitorIndex: 0
|
||||
|
||||
function setActiveMonitorIndex(newIndex){
|
||||
for(var i = 0; i < rp.count; i++){
|
||||
if(i == newIndex){
|
||||
rp.itemAt(i).isSelected = true
|
||||
} else {
|
||||
rp.itemAt(i).isSelected = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Repeater {
|
||||
id: rp
|
||||
anchors.fill: parent
|
||||
@ -18,60 +32,54 @@ Rectangle {
|
||||
|
||||
// Absolute availableVirtualGeometry
|
||||
var absoluteDesktopSize = monitorListModel.getAbsoluteDesktopSize()
|
||||
var isWidthGreaterThanHeight = false;
|
||||
var windowsDelta = 0;
|
||||
|
||||
if(absoluteDesktopSize.width < absoluteDesktopSize.height){
|
||||
windowsDelta = absoluteDesktopSize.width / absoluteDesktopSize.height
|
||||
isWidthGreaterThanHeight = false
|
||||
} else {
|
||||
windowsDelta = absoluteDesktopSize.height / absoluteDesktopSize.width
|
||||
isWidthGreaterThanHeight = true
|
||||
}
|
||||
|
||||
var dynamicHeight = availableWidth * windowsDelta
|
||||
var dynamicWidth = availableHeight * windowsDelta
|
||||
|
||||
// Delta (height/width)
|
||||
var monitorHeightRationDelta = availableHeight / absoluteDesktopSize.height
|
||||
var monitorWidthRationDelta = availableWidth / absoluteDesktopSize.width
|
||||
print("DELTAS: " + monitorHeightRationDelta + ", " + monitorWidthRationDelta)
|
||||
|
||||
var monitorHeightRationDelta = 0;
|
||||
var monitorWidthRationDelta = 0;
|
||||
|
||||
if(isWidthGreaterThanHeight){
|
||||
monitorHeightRationDelta = dynamicHeight / absoluteDesktopSize.height
|
||||
monitorWidthRationDelta = availableWidth / absoluteDesktopSize.width
|
||||
} else {
|
||||
monitorHeightRationDelta = availableHeight / absoluteDesktopSize.height
|
||||
monitorWidthRationDelta = dynamicWidth / absoluteDesktopSize.width
|
||||
}
|
||||
|
||||
for (var i = 0; i < rp.count; i++) {
|
||||
|
||||
|
||||
print(rp.itemAt(i).height + " , " + rp.itemAt(i).width+ " , " +rp.itemAt(i).x+ " , " +rp.itemAt(i).y)
|
||||
var newHeight = rp.itemAt(i).height / monitorHeightRationDelta
|
||||
rp.itemAt(i).height = newHeight
|
||||
var newWidth = rp.itemAt(i).width / monitorWidthRationDelta
|
||||
rp.itemAt(i).width = newWidth
|
||||
rp.itemAt(i).x = rp.itemAt(i).x / monitorWidthRationDelta
|
||||
rp.itemAt(i).y = rp.itemAt(i).y / monitorHeightRationDelta
|
||||
|
||||
print(rp.itemAt(i).height + " , " + rp.itemAt(i).width+ " , " +rp.itemAt(i).x+ " , " +rp.itemAt(i).y)
|
||||
|
||||
|
||||
rp.itemAt(i).index = i
|
||||
rp.itemAt(i).height = rp.itemAt(i).height * monitorHeightRationDelta
|
||||
rp.itemAt(i).width = rp.itemAt(i).width * monitorWidthRationDelta
|
||||
rp.itemAt(i).x = rp.itemAt(i).x * monitorWidthRationDelta
|
||||
rp.itemAt(i).y = rp.itemAt(i).y * monitorHeightRationDelta
|
||||
}
|
||||
}
|
||||
|
||||
delegate: Rectangle {
|
||||
|
||||
color: "red"
|
||||
delegate: MonitorSelectionItem {
|
||||
id: delegate
|
||||
height: monitorAvailableGeometry.height
|
||||
width: monitorAvailableGeometry.width
|
||||
x: monitorAvailableGeometry.x
|
||||
y: monitorAvailableGeometry.y
|
||||
monitorSize: monitorAvailableGeometry
|
||||
|
||||
anchors.margins: 10
|
||||
|
||||
Column {
|
||||
spacing: 5
|
||||
|
||||
Text {
|
||||
text: monitorNumber
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
text: monitorName
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
text: monitorSize.width + " " + monitorSize.height
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
text: monitorAvailableGeometry.x + " " + monitorAvailableGeometry.y
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
Connections{
|
||||
target: delegate
|
||||
onMonitorSelected: {
|
||||
setActiveMonitorIndex(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
36
qml/Components/MonitorSelectionItem.qml
Normal file
36
qml/Components/MonitorSelectionItem.qml
Normal file
@ -0,0 +1,36 @@
|
||||
import QtQuick 2.7
|
||||
|
||||
Rectangle {
|
||||
color: "steelblue"
|
||||
anchors.margins: 10
|
||||
|
||||
property rect monitorSize: Qt.rect(0,0,0,0)
|
||||
property int index: 0
|
||||
property bool isSelected: false
|
||||
|
||||
signal monitorSelected(var index)
|
||||
|
||||
onIsSelectedChanged: {
|
||||
if(isSelected){
|
||||
color = "orange"
|
||||
} else {
|
||||
color = "steelblue"
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
spacing: 5
|
||||
|
||||
Text {
|
||||
text: index + " - " + monitorSize.width + ", " + monitorSize.height
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
monitorSelected(index)
|
||||
}
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ Item {
|
||||
Rectangle {
|
||||
id: background
|
||||
color: "#80000000"
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
MouseArea {
|
||||
@ -23,12 +24,21 @@ Item {
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: monitorWrapper
|
||||
color: "white"
|
||||
width: 900
|
||||
height: 600
|
||||
|
||||
z: 98
|
||||
anchors.centerIn: parent
|
||||
|
||||
Rectangle {
|
||||
color: "gray"
|
||||
anchors.centerIn: parent
|
||||
id: monitorWrapper
|
||||
width: 200
|
||||
height: 100
|
||||
}
|
||||
|
||||
MonitorSelection {
|
||||
anchors.centerIn: parent
|
||||
anchors.fill: parent
|
||||
@ -37,14 +47,14 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
DropShadow {
|
||||
anchors.fill: monitorWrapper
|
||||
radius: 12.0
|
||||
cached: true
|
||||
samples: 17
|
||||
color: "#80000000"
|
||||
source: monitorWrapper
|
||||
}
|
||||
// DropShadow {
|
||||
// anchors.fill: monitorWrapper
|
||||
// radius: 12.0
|
||||
// cached: true
|
||||
// samples: 17
|
||||
// color: "#80000000"
|
||||
// source: monitorWrapper
|
||||
// }
|
||||
|
||||
states: [
|
||||
State {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import QtQuick 2.0
|
||||
import QtQuick 2.7
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
Item {
|
||||
@ -55,10 +55,7 @@ Item {
|
||||
|
||||
ScreenPlayItemImage {
|
||||
id: screenPlayItemImage
|
||||
|
||||
sourceImage: Qt.resolvedUrl(
|
||||
"file:///" + installedListModel.absoluteStoragePath + "/Wallpaper/"
|
||||
+ screenFolderId + "/" + screenPreview)
|
||||
sourceImage: Qt.resolvedUrl( "file:///" + installedListModel.absoluteStoragePath +"/" + screenFolderId + "/" + screenPreview)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,16 +10,18 @@ Rectangle {
|
||||
id: video
|
||||
anchors.fill: parent
|
||||
videoCodecPriority: ["CUDA", "D3D11", "DXVA","VAAPI","FFmpeg"]
|
||||
|
||||
onPlaybackStateChanged: {
|
||||
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
//video.source = Qt.resolvedUrl("file:///" + wallpaper.absoluteFilePath.toString())
|
||||
//video.play()
|
||||
//video.source = Qt.resolvedUrl("file:///" + "C:\\Users\\Eli\\Desktop\\vid.webm")
|
||||
video.play()
|
||||
}
|
||||
onStopped: {
|
||||
//video.play()
|
||||
video.play()
|
||||
}
|
||||
|
||||
|
||||
|
@ -120,12 +120,12 @@ Item {
|
||||
}
|
||||
|
||||
anchors.bottomMargin: 100
|
||||
// MonitorSelection {
|
||||
// anchors.centerIn: parent
|
||||
// anchors.fill: parent
|
||||
// availableWidth: sidebar.width
|
||||
// availableHeight: monitorSelectionWrapper.height
|
||||
// }
|
||||
MonitorSelection {
|
||||
anchors.centerIn: parent
|
||||
anchors.fill: parent
|
||||
availableWidth: sidebar.width
|
||||
availableHeight: monitorSelectionWrapper.height
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
|
@ -8,9 +8,10 @@ Window {
|
||||
id: mainWindow
|
||||
visible: true
|
||||
width: 640
|
||||
|
||||
height: 480
|
||||
color: "transparent"
|
||||
flags: Qt.SplashScreen
|
||||
//color: "transparent"
|
||||
flags: Qt.SplashScreen | Qt.ToolTip | Qt.WindowStaysOnBottomHint
|
||||
|
||||
|
||||
Rectangle {
|
||||
|
@ -34,5 +34,4 @@ CustomPage {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -70,11 +70,12 @@ void InstalledListModel::loadScreens()
|
||||
QJsonDocument jsonProject;
|
||||
QJsonParseError parseError;
|
||||
|
||||
QFileInfoList list = QDir(m_absoluteStoragePath.toString() + "/Wallpaper").entryInfoList(QDir::NoDotAndDotDot | QDir::AllDirs);
|
||||
QFileInfoList list = QDir(m_absoluteStoragePath.toString()).entryInfoList(QDir::NoDotAndDotDot | QDir::AllDirs);
|
||||
QString tmpPath;
|
||||
|
||||
for (auto&& item : list) {
|
||||
tmpPath = m_absoluteStoragePath.toString() + "/Wallpaper/" + item.baseName() + "/project.json";
|
||||
tmpPath = m_absoluteStoragePath.toString() +"/" +item.baseName() + "/project.json";
|
||||
qDebug() << tmpPath;
|
||||
if (!QFile(tmpPath).exists())
|
||||
continue;
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef INSTALLEDLISTMODEL_H
|
||||
#define INSTALLEDLISTMODEL_H
|
||||
|
||||
#include "profilelistmodel.h"
|
||||
#include "projectfile.h"
|
||||
#include <QAbstractListModel>
|
||||
#include <QByteArray>
|
||||
#include <QDebug>
|
||||
@ -15,10 +17,6 @@
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include "profilelistmodel.h"
|
||||
#include "projectfile.h"
|
||||
|
||||
|
||||
|
||||
class InstalledListModel : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
@ -37,7 +35,6 @@ public:
|
||||
Q_INVOKABLE QVariantMap get(QString folderId);
|
||||
Q_PROPERTY(QUrl absoluteStoragePath READ absoluteStoragePath WRITE setabsoluteStoragePath NOTIFY absoluteStoragePathChanged)
|
||||
|
||||
|
||||
enum InstalledRole {
|
||||
TitleRole,
|
||||
PreviewRole,
|
||||
@ -46,7 +43,6 @@ public:
|
||||
};
|
||||
Q_ENUM(InstalledRole)
|
||||
|
||||
|
||||
QUrl absoluteStoragePath() const
|
||||
{
|
||||
return m_absoluteStoragePath;
|
||||
|
@ -1,16 +1,18 @@
|
||||
#include "settings.h"
|
||||
|
||||
Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListModel* ilm, QObject* parent)
|
||||
Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListModel* ilm, AppId_t steamID, QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
|
||||
m_plm = plm;
|
||||
m_mlm = mlm;
|
||||
m_ilm = ilm;
|
||||
m_steamID = steamID;
|
||||
|
||||
QFile configTmp;
|
||||
QString appConfigLocation = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
|
||||
|
||||
|
||||
if (!QDir(appConfigLocation).exists()) {
|
||||
if (!QDir().mkdir(appConfigLocation)) {
|
||||
qWarning("ERROR: Cloud not create install dir");
|
||||
@ -53,8 +55,21 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
|
||||
return;
|
||||
}
|
||||
|
||||
//If empty use steam workshop location
|
||||
if (QString(configObj.value("absoluteStoragePath").toString()).isEmpty()) {
|
||||
m_absoluteStoragePath = appConfigLocation;
|
||||
uint32 size = 5000;
|
||||
char folder[size];
|
||||
SteamApps()->GetAppInstallDir(m_steamID,folder,5000);
|
||||
QDir steamTmpUrl = QDir(QString(QByteArray(folder).data()));
|
||||
steamTmpUrl.cdUp();
|
||||
steamTmpUrl.cdUp();
|
||||
steamTmpUrl.cd("workshop");
|
||||
steamTmpUrl.cd("content");
|
||||
steamTmpUrl.cd("672870");
|
||||
|
||||
qDebug() << steamTmpUrl.path();
|
||||
|
||||
m_absoluteStoragePath = steamTmpUrl.path();
|
||||
} else {
|
||||
m_absoluteStoragePath = configObj.value("absoluteStoragePath").toString();
|
||||
}
|
||||
@ -62,6 +77,7 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
|
||||
m_ilm->setabsoluteStoragePath(m_absoluteStoragePath);
|
||||
m_plm->m_absoluteStoragePath = m_absoluteStoragePath;
|
||||
|
||||
/*
|
||||
//Create default folders
|
||||
if (!QDir(m_absoluteStoragePath.toString() + "/ProfilePackages").exists()) {
|
||||
if (!QDir().mkdir(appConfigLocation + "/ProfilePackages")) {
|
||||
@ -86,7 +102,7 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
|
||||
qWarning("ERROR: Cloud not create Widgets dir");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
m_autostart = configObj.value("autostart").toBool();
|
||||
m_highPriorityStart = configObj.value("highPriorityStart").toBool();
|
||||
@ -104,9 +120,15 @@ void Settings::createNewProfile(int screenNumber)
|
||||
|
||||
void Settings::constructWallpaper(Profile profile, QString monitorID, ProjectFile pf)
|
||||
{
|
||||
|
||||
m_wallpapers.append(QSharedPointer<Wallpaper>(new Wallpaper(profile,pf)));
|
||||
}
|
||||
|
||||
void Settings::setWallpaper(int monitorIndex, QString wallpaperID)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Settings::loadActiveProfiles()
|
||||
{
|
||||
QJsonDocument configJsonDocument;
|
||||
@ -136,8 +158,6 @@ void Settings::loadActiveProfiles()
|
||||
continue;
|
||||
|
||||
|
||||
|
||||
|
||||
constructWallpaper(profile, monitorID, spf);
|
||||
}
|
||||
}
|
||||
@ -145,10 +165,14 @@ void Settings::loadActiveProfiles()
|
||||
|
||||
void Settings::removeAll()
|
||||
{
|
||||
qDebug() << "destruct settings";
|
||||
m_wallpapers.clear();
|
||||
}
|
||||
|
||||
void Settings::updateSettinsValue(QString newValue)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Settings::createDefaultConfig()
|
||||
{
|
||||
|
||||
|
@ -25,13 +25,14 @@
|
||||
#include "profilelistmodel.h"
|
||||
#include "profile.h"
|
||||
#include "wallpaper.h"
|
||||
#include "steam/steam_api.h"
|
||||
|
||||
class ActiveProfiles;
|
||||
|
||||
class Settings : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListModel* ilm, QObject* parent = nullptr);
|
||||
explicit Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListModel* ilm, AppId_t steamID, QObject* parent = nullptr);
|
||||
~Settings();
|
||||
Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged)
|
||||
Q_PROPERTY(bool highPriorityStart READ highPriorityStart WRITE setHighPriorityStart NOTIFY highPriorityStartChanged)
|
||||
@ -39,11 +40,12 @@ public:
|
||||
Q_PROPERTY(bool sendStatistics READ sendStatistics WRITE setSendStatistics NOTIFY sendStatisticsChanged)
|
||||
Q_PROPERTY(Version version READ version)
|
||||
|
||||
Q_INVOKABLE void createNewProfile(int screenNumber);
|
||||
Q_INVOKABLE void constructWallpaper(Profile profile, QString monitorID, ProjectFile spf);
|
||||
|
||||
void loadActiveProfiles();
|
||||
void removeAll();
|
||||
|
||||
void updateSettinsValue(QString newValue);
|
||||
|
||||
|
||||
enum Renderer {
|
||||
OpenGL,
|
||||
@ -139,6 +141,12 @@ public slots:
|
||||
emit sendStatisticsChanged(m_sendStatistics);
|
||||
}
|
||||
|
||||
void createNewProfile(int screenNumber);
|
||||
|
||||
void constructWallpaper(Profile profile, QString monitorID, ProjectFile spf);
|
||||
|
||||
void setWallpaper(int monitorIndex, QString wallpaperID);
|
||||
|
||||
private:
|
||||
void createDefaultConfig();
|
||||
void createProfileConfig();
|
||||
@ -148,6 +156,7 @@ private:
|
||||
bool m_sendStatistics;
|
||||
|
||||
QUrl m_absoluteStoragePath;
|
||||
AppId_t m_steamID;
|
||||
|
||||
Renderer m_renderer = Renderer::OpenGL;
|
||||
Version m_version;
|
||||
|
@ -5,9 +5,10 @@ SteamWorkshop::SteamWorkshop(QObject* parent)
|
||||
{
|
||||
}
|
||||
|
||||
SteamWorkshop::SteamWorkshop(AppId_t nConsumerAppId)
|
||||
SteamWorkshop::SteamWorkshop(AppId_t nConsumerAppId, SteamWorkshopListModel* wlm)
|
||||
{
|
||||
m_AppId = nConsumerAppId;
|
||||
m_workshopListModel = wlm;
|
||||
}
|
||||
|
||||
void SteamWorkshop::createWorkshopItem()
|
||||
@ -22,13 +23,14 @@ void SteamWorkshop::submitWorkshopItem(QString title, QString description, QStri
|
||||
QString tmpVideoPath = QFileInfo(absoluteContentPath.toString()).path();
|
||||
QString video = QString(tmpVideoPath).remove(0, 8);
|
||||
QString thumb = QString(absolutePreviewPath.toString()).remove(0, 8);
|
||||
|
||||
qDebug() << video << thumb;
|
||||
SteamUGC()->SetItemTitle(m_UGCUpdateHandle, QByteArray(title.toLatin1()).data());
|
||||
SteamUGC()->SetItemDescription(m_UGCUpdateHandle, QByteArray(description.toLatin1()).data());
|
||||
SteamUGC()->SetItemUpdateLanguage(m_UGCUpdateHandle, QByteArray(language.toLatin1()).data());
|
||||
auto visibility = static_cast<ERemoteStoragePublishedFileVisibility>(remoteStoragePublishedFileVisibility);
|
||||
SteamUGC()->SetItemContent(m_UGCUpdateHandle, QByteArray(video.toLatin1()).data());
|
||||
//SteamUGC()->SetItemPreview(m_UGCUpdateHandle, QByteArray(thumb.toLatin1()).data());
|
||||
SteamUGC()->SetItemPreview(m_UGCUpdateHandle, QByteArray(thumb.toLatin1()).data());
|
||||
SteamUGC()->SetItemVisibility(m_UGCUpdateHandle, visibility);
|
||||
SteamUGC()->SubmitItemUpdate(m_UGCUpdateHandle, nullptr);
|
||||
}
|
||||
@ -42,26 +44,58 @@ int SteamWorkshop::getItemUpdateProcess()
|
||||
return status;
|
||||
}
|
||||
|
||||
void SteamWorkshop::getAPICallInfo()
|
||||
{
|
||||
qDebug() << SteamUtils()->GetAPICallFailureReason(m_searchCall);
|
||||
}
|
||||
|
||||
void SteamWorkshop::onWorkshopItemCreated(CreateItemResult_t* pCallback, bool bIOFailure)
|
||||
{
|
||||
if (bIOFailure)
|
||||
return;
|
||||
|
||||
emit workshopItemCreated(pCallback->m_bUserNeedsToAcceptWorkshopLegalAgreement, pCallback->m_eResult, pCallback->m_nPublishedFileId);
|
||||
m_UGCUpdateHandle = SteamUGC()->StartItemUpdate(m_AppId, pCallback->m_nPublishedFileId);
|
||||
}
|
||||
|
||||
void SteamWorkshop::searchWorkshop()
|
||||
{
|
||||
qDebug() << "search";
|
||||
UGCQueryHandle_t hUGCQueryHandle = SteamUGC()->CreateQueryAllUGCRequest(EUGCQuery::k_EUGCQuery_RankedByTrend,
|
||||
EUGCMatchingUGCType::k_EUGCMatchingUGCType_All,
|
||||
m_UGCSearchHandle = SteamUGC()->CreateQueryAllUGCRequest(EUGCQuery::k_EUGCQuery_RankedByVote,
|
||||
EUGCMatchingUGCType::k_EUGCMatchingUGCType_Items,
|
||||
m_AppId,
|
||||
m_AppId,
|
||||
1);
|
||||
m_steamUGCQueryResult.Set(hUGCQueryHandle, this, &SteamWorkshop::onWorkshopSearched);
|
||||
SteamUGC()->SendQueryUGCRequest(hUGCQueryHandle);
|
||||
|
||||
//Important: First send the request to get the Steam API Call
|
||||
// then set the handler
|
||||
m_searchCall = SteamUGC()->SendQueryUGCRequest(m_UGCSearchHandle);
|
||||
m_steamUGCQueryResult.Set(m_searchCall, this, &SteamWorkshop::onWorkshopSearched);
|
||||
}
|
||||
|
||||
void SteamWorkshop::onWorkshopSearched(SteamUGCQueryCompleted_t* pCallback, bool bIOFailure)
|
||||
{
|
||||
qDebug() << "searchend";
|
||||
|
||||
if (bIOFailure)
|
||||
return;
|
||||
|
||||
SteamUGCDetails_t details;
|
||||
int urlLength = 200;
|
||||
char url[urlLength];
|
||||
uint32 previews = 0;
|
||||
uint32 results = pCallback->m_unTotalMatchingResults;
|
||||
|
||||
for (uint32 i = 0; i < results; i++) {
|
||||
if (SteamUGC()->GetQueryUGCResult(pCallback->m_handle, i, &details)) {
|
||||
if (SteamUGC()->GetQueryUGCPreviewURL(pCallback->m_handle, i, url, static_cast<uint32>(urlLength))) {
|
||||
QByteArray urlData(url);
|
||||
qDebug()<< details.m_rgchTitle;
|
||||
previews = SteamUGC()->GetQueryUGCNumAdditionalPreviews(pCallback->m_handle, i);
|
||||
m_workshopListModel->append(QString(details.m_rgchTitle),QUrl(urlData));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SteamUGC()->ReleaseQueryUGCRequest(pCallback->m_handle);
|
||||
|
||||
emit workshopSearched();
|
||||
}
|
||||
|
@ -1,27 +1,28 @@
|
||||
#ifndef STEAMWORKSHOP_H
|
||||
#define STEAMWORKSHOP_H
|
||||
#pragma once
|
||||
|
||||
|
||||
#include <QDebug>
|
||||
#include <QObject>
|
||||
#include <QDir>
|
||||
#include <QUrl>
|
||||
#include <QByteArray>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QObject>
|
||||
#include <QUrl>
|
||||
|
||||
#include "steam/steam_api.h"
|
||||
#include "steamworkshoplistmodel.h"
|
||||
|
||||
class SteamWorkshop : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SteamWorkshop(QObject* parent = nullptr);
|
||||
SteamWorkshop(AppId_t nConsumerAppId);
|
||||
SteamWorkshop(AppId_t nConsumerAppId, SteamWorkshopListModel* wlm);
|
||||
|
||||
public slots:
|
||||
void searchWorkshop();
|
||||
void createWorkshopItem();
|
||||
void submitWorkshopItem(QString title, QString description, QString language, int remoteStoragePublishedFileVisibility, QUrl absoluteContentPath, QUrl absolutePreviewPath);
|
||||
int getItemUpdateProcess();
|
||||
void getAPICallInfo();
|
||||
|
||||
signals:
|
||||
void workshopItemCreated(bool userNeedsToAcceptWorkshopLegalAgreement, int eResult, int publishedFileId);
|
||||
void workshopSearched();
|
||||
@ -35,7 +36,7 @@ private:
|
||||
|
||||
AppId_t m_AppId;
|
||||
UGCUpdateHandle_t m_UGCUpdateHandle;
|
||||
UGCQueryHandle_t m_UGCSearchHandle;
|
||||
SteamAPICall_t m_searchCall;
|
||||
SteamWorkshopListModel* m_workshopListModel;
|
||||
};
|
||||
|
||||
#endif // STEAMWORKSHOP_H
|
||||
#
|
||||
|
76
src/steamworkshoplistmodel.cpp
Normal file
76
src/steamworkshoplistmodel.cpp
Normal file
@ -0,0 +1,76 @@
|
||||
#include "steamworkshoplistmodel.h"
|
||||
|
||||
SteamWorkshopListModel::SteamWorkshopListModel(QObject *parent)
|
||||
: QAbstractListModel(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QVariant SteamWorkshopListModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
// FIXME: Implement me!
|
||||
}
|
||||
|
||||
bool SteamWorkshopListModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role)
|
||||
{
|
||||
if (value != headerData(section, orientation, role)) {
|
||||
// FIXME: Implement me!
|
||||
emit headerDataChanged(orientation, section, section);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int SteamWorkshopListModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
if (parent.isValid())
|
||||
return 0;
|
||||
|
||||
return m_workshopItemList.count();
|
||||
}
|
||||
|
||||
QVariant SteamWorkshopListModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
// FIXME: Implement me!
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
void SteamWorkshopListModel::append(QString title, QUrl imgUrl)
|
||||
{
|
||||
qDebug() << title << imgUrl;
|
||||
m_workshopItemList.append(QSharedPointer<WorkshopItem>(new WorkshopItem(title,imgUrl)));
|
||||
}
|
||||
|
||||
bool SteamWorkshopListModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if (data(index, role) != value) {
|
||||
// FIXME: Implement me!
|
||||
emit dataChanged(index, index, QVector<int>() << role);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::ItemFlags SteamWorkshopListModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return Qt::NoItemFlags;
|
||||
|
||||
return Qt::ItemIsEditable; // FIXME: Implement me!
|
||||
}
|
||||
|
||||
bool SteamWorkshopListModel::insertRows(int row, int count, const QModelIndex &parent)
|
||||
{
|
||||
beginInsertRows(parent, row, row + count - 1);
|
||||
// FIXME: Implement me!
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
bool SteamWorkshopListModel::removeRows(int row, int count, const QModelIndex &parent)
|
||||
{
|
||||
beginRemoveRows(parent, row, row + count - 1);
|
||||
// FIXME: Implement me!
|
||||
endRemoveRows();
|
||||
}
|
42
src/steamworkshoplistmodel.h
Normal file
42
src/steamworkshoplistmodel.h
Normal file
@ -0,0 +1,42 @@
|
||||
#pragma once
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QVector>
|
||||
#include <QSharedPointer>
|
||||
#include <QDebug>
|
||||
|
||||
#include "workshopitem.h"
|
||||
|
||||
class SteamWorkshopListModel : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SteamWorkshopListModel(QObject* parent = nullptr);
|
||||
|
||||
// Header:
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
|
||||
|
||||
bool setHeaderData(int section, Qt::Orientation orientation, const QVariant& value, int role = Qt::EditRole) override;
|
||||
|
||||
// Basic functionality:
|
||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||
|
||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
Q_INVOKABLE void append(QString title, QUrl imgUrl);
|
||||
|
||||
// Editable:
|
||||
bool setData(const QModelIndex& index, const QVariant& value,
|
||||
int role = Qt::EditRole) override;
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex& index) const override;
|
||||
|
||||
// Add data:
|
||||
bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
|
||||
|
||||
// Remove data:
|
||||
bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()) override;
|
||||
|
||||
private:
|
||||
QVector<QSharedPointer<WorkshopItem>> m_workshopItemList;
|
||||
};
|
@ -65,3 +65,8 @@ Wallpaper::Wallpaper(Profile profile, ProjectFile projf)
|
||||
m_quickRenderer->setSource(QUrl("qrc:/qml/Components/Screens/ScreenVideo.qml"));
|
||||
m_quickRenderer->show();
|
||||
}
|
||||
|
||||
Wallpaper::~Wallpaper()
|
||||
{
|
||||
ShowWindow(m_hwnd, SW_HIDE);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ class Wallpaper : public QWindow {
|
||||
public:
|
||||
explicit Wallpaper(QWindow* parent = 0);
|
||||
Wallpaper(Profile profile, ProjectFile projf);
|
||||
~Wallpaper();
|
||||
Q_PROPERTY(QString absoluteFilePath READ absoluteFilePath WRITE setAbsoluteFilePath NOTIFY absoluteFilePathChanged)
|
||||
|
||||
|
||||
|
8
src/widget.cpp
Normal file
8
src/widget.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include "widget.h"
|
||||
|
||||
Widget::Widget(QWindow *parent) : QWindow(parent)
|
||||
{
|
||||
m_quickView = new QQuickView(this);
|
||||
m_quickView->setSource(QUrl("qrc:/qml/Components/Widgets/Window.qml"));
|
||||
m_quickView->show();
|
||||
}
|
24
src/widget.h
Normal file
24
src/widget.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef WIDGET_H
|
||||
#define WIDGET_H
|
||||
|
||||
#include <QQuickItem>
|
||||
#include <QQuickView>
|
||||
#include <QWindow>
|
||||
#include <QUrl>
|
||||
|
||||
class Widget : public QWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Widget(QWindow* parent = nullptr);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
QQuickItem* m_quickItem;
|
||||
QQuickView* m_quickView;
|
||||
QUrl m_source;
|
||||
};
|
||||
|
||||
#endif // WIDGET_H
|
7
src/workshopitem.cpp
Normal file
7
src/workshopitem.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
#include "workshopitem.h"
|
||||
|
||||
|
||||
WorkshopItem::WorkshopItem(QString title, QUrl previewImageUrl)
|
||||
{
|
||||
|
||||
}
|
15
src/workshopitem.h
Normal file
15
src/workshopitem.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef WORKSHOPITEM_H
|
||||
#define WORKSHOPITEM_H
|
||||
|
||||
#include <QUrl>
|
||||
#include <QString>
|
||||
|
||||
class WorkshopItem
|
||||
{
|
||||
public:
|
||||
WorkshopItem(QString title, QUrl previewImageUrl);
|
||||
QUrl m_previewImageUrl;
|
||||
QString m_title;
|
||||
};
|
||||
|
||||
#endif // WORKSHOPITEM_H
|
Loading…
Reference in New Issue
Block a user