mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-07 03:22:33 +01:00
Very big code cleanup to match the naming convention. Change projectfile comparison from a id to a path so we can have multiple projects with the same name in different dirs for later features
This commit is contained in:
parent
35c7ad47e9
commit
4694ebc407
@ -1,10 +1,11 @@
|
|||||||
import QtQuick 2.7
|
import QtQuick 2.9
|
||||||
import QtQuick.Controls 2.2
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Dialogs 1.2
|
import QtQuick.Dialogs 1.2
|
||||||
import Qt.labs.platform 1.0
|
import Qt.labs.platform 1.0
|
||||||
|
|
||||||
|
|
||||||
CustomPage {
|
CustomPage {
|
||||||
id: page
|
id: create
|
||||||
pageName: ""
|
pageName: ""
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
@ -19,17 +20,23 @@ CustomPage {
|
|||||||
busyIndicator.running = false
|
busyIndicator.running = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onLocalFileCopyCompleted:{
|
||||||
|
create.state = ""
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: leftArea
|
target: leftArea
|
||||||
onHasEmptyField:{
|
onHasEmptyField: {
|
||||||
if(fieldNumber === 0){
|
if (fieldNumber === 0) {
|
||||||
fileDropperVideo.state = "error"
|
fileDropperVideo.state = "error"
|
||||||
} else if (fieldNumber === 1) {
|
} else if (fieldNumber === 1) {
|
||||||
fileDropperPreview.state = "error"
|
fileDropperPreview.state = "error"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
onCreateLocalWallpaperStarted: {
|
||||||
|
create.state = "createLocalWallpaper"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FontLoader {
|
FontLoader {
|
||||||
@ -54,7 +61,6 @@ CustomPage {
|
|||||||
left: parent.left
|
left: parent.left
|
||||||
margins: 10
|
margins: 10
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -78,14 +84,15 @@ CustomPage {
|
|||||||
width: parent.width * .48
|
width: parent.width * .48
|
||||||
height: parent.height
|
height: parent.height
|
||||||
FileDropperSingleFile {
|
FileDropperSingleFile {
|
||||||
id:fileDropperVideo
|
id: fileDropperVideo
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
z: 99
|
z: 99
|
||||||
descriptionTitle: "Drop your video here"
|
descriptionTitle: "Drop your video here"
|
||||||
helpText: "Supportet Video formats: mp4 for older devices and VP9 for newer like NVidia 1000 or AMD VEGA"
|
helpText: "Supportet Video formats: mp4 for older devices and VP9 for newer like NVidia 1000 or AMD VEGA"
|
||||||
isVideo: true
|
isVideo: true
|
||||||
imagePath: "qrc:/assets/icons/icon_tv.svg"
|
imagePath: "qrc:/assets/icons/icon_tv.svg"
|
||||||
onExternalFilePathChanged: leftArea.videoPath = fileDropperVideo.externalFilePath
|
onExternalFilePathChanged: leftArea.videoPath
|
||||||
|
= fileDropperVideo.externalFilePath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
@ -94,13 +101,14 @@ CustomPage {
|
|||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
||||||
FileDropperSingleFile {
|
FileDropperSingleFile {
|
||||||
id:fileDropperPreview
|
id: fileDropperPreview
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
z: 99
|
z: 99
|
||||||
descriptionTitle: "Set Preview Image"
|
descriptionTitle: "Set Preview Image"
|
||||||
helpText: "Use PNG for best results. The image ratio should be 21:9. Preffered resulution 123x123."
|
helpText: "Use PNG for best results. The image ratio should be 21:9. Preffered resulution 123x123."
|
||||||
imagePath: "qrc:/assets/icons/icon_single_image.svg"
|
imagePath: "qrc:/assets/icons/icon_single_image.svg"
|
||||||
onExternalFilePathChanged: leftArea.previewPath = fileDropperPreview.externalFilePath
|
onExternalFilePathChanged: leftArea.previewPath
|
||||||
|
= fileDropperPreview.externalFilePath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +126,6 @@ CustomPage {
|
|||||||
z: 99
|
z: 99
|
||||||
descriptionTitle: "Add additional images"
|
descriptionTitle: "Add additional images"
|
||||||
imagePath: "qrc:/assets/icons/icon_multiple_images.svg"
|
imagePath: "qrc:/assets/icons/icon_multiple_images.svg"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,8 +163,9 @@ CustomPage {
|
|||||||
Transition {
|
Transition {
|
||||||
from: "*"
|
from: "*"
|
||||||
to: "*"
|
to: "*"
|
||||||
PropertyAnimation{
|
PropertyAnimation {
|
||||||
properties: "opacity"; easing.type: Easing.InOutQuad
|
properties: "opacity"
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -14,6 +14,7 @@ Rectangle {
|
|||||||
property url previewPath
|
property url previewPath
|
||||||
//Todo 5.10 ENUM
|
//Todo 5.10 ENUM
|
||||||
signal hasEmptyField(int fieldNumber)
|
signal hasEmptyField(int fieldNumber)
|
||||||
|
signal createLocalWallpaperStarted()
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: rowUseSteamWorkshop
|
id: rowUseSteamWorkshop
|
||||||
@ -125,6 +126,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
id: btnSubmit
|
id: btnSubmit
|
||||||
anchors {
|
anchors {
|
||||||
@ -157,7 +159,7 @@ Rectangle {
|
|||||||
previewPath)
|
previewPath)
|
||||||
tiItemUpdate.start()
|
tiItemUpdate.start()
|
||||||
} else {
|
} else {
|
||||||
|
createLocalWallpaperStarted()
|
||||||
steamWorkshop.createLocalWorkshopItem(
|
steamWorkshop.createLocalWorkshopItem(
|
||||||
txtTitle.text.toString(), videoPath,
|
txtTitle.text.toString(), videoPath,
|
||||||
previewPath)
|
previewPath)
|
||||||
|
@ -1,53 +1,50 @@
|
|||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtQuick.Controls 1.4
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Controls.Material 2.0
|
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: headline
|
id: headline
|
||||||
property string name: ""
|
property string name: "TEXT"
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 80
|
height: 50
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
height: 70
|
height: parent.height
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
right: parent.right
|
right: parent.right
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: txtName
|
||||||
|
text: headline.name
|
||||||
|
font.italic: true
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
anchors.bottom: line.top
|
||||||
|
anchors.bottomMargin: 5
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 10
|
||||||
|
font.pixelSize: 18
|
||||||
|
color: "#818181"
|
||||||
|
anchors.margins: 10
|
||||||
|
font.family: font_LibreBaskerville_Italic.name
|
||||||
|
|
||||||
Text {
|
FontLoader {
|
||||||
id:txtName
|
id: font_LibreBaskerville_Italic
|
||||||
text: headline.name
|
source: "qrc:/assets/fonts/LibreBaskerville-Italic.ttf"
|
||||||
font.italic: true
|
}
|
||||||
renderType: Text.NativeRendering
|
}
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
horizontalAlignment: Text.AlignLeft
|
|
||||||
anchors.bottom: line.top
|
|
||||||
anchors.bottomMargin: 5
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: 10
|
|
||||||
font.pixelSize: 18
|
|
||||||
color: "#818181"
|
|
||||||
anchors.margins: 10
|
|
||||||
font.family: font_LibreBaskerville_Italic.name
|
|
||||||
|
|
||||||
FontLoader {
|
Rectangle {
|
||||||
id: font_LibreBaskerville_Italic
|
id: line
|
||||||
source: "qrc:/assets/fonts/LibreBaskerville-Italic.ttf"
|
height: 1
|
||||||
|
width: parent.width
|
||||||
|
color: "#BBBBBB"
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id:line
|
|
||||||
height: 1
|
|
||||||
width: parent.width
|
|
||||||
color: "#BBBBBB"
|
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
import QtQuick.Controls 2.0
|
import QtQuick.Controls 2.2
|
||||||
import QtQuick.Extras 1.4
|
import QtQuick.Extras 1.4
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -101,16 +101,14 @@ Item {
|
|||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.bottomMargin: 18
|
anchors.bottomMargin: 18
|
||||||
onClicked: {
|
onClicked: {
|
||||||
installedListModel.setScreenToVideoFromQml(
|
screenPlaySettings.constructWallpaper(
|
||||||
Qt.resolvedUrl(
|
activeScreen,
|
||||||
"file:///" + installedListModel._screensPath
|
monitorSelection.activeMonitorIndex)
|
||||||
+ activeScreen + "/" + installedListModel.get(
|
|
||||||
activeScreen).screenFile))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id:monitorSelectionWrapper
|
id: monitorSelectionWrapper
|
||||||
color: "gray"
|
color: "gray"
|
||||||
height: 200
|
height: 200
|
||||||
anchors {
|
anchors {
|
||||||
@ -121,6 +119,7 @@ Item {
|
|||||||
|
|
||||||
anchors.bottomMargin: 100
|
anchors.bottomMargin: 100
|
||||||
MonitorSelection {
|
MonitorSelection {
|
||||||
|
id: monitorSelection
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
availableWidth: sidebar.width
|
availableWidth: sidebar.width
|
||||||
|
@ -25,6 +25,8 @@ QVariant InstalledListModel::data(const QModelIndex& index, int role) const
|
|||||||
return m_screenPlayFiles.at(index.row()).m_folderId;
|
return m_screenPlayFiles.at(index.row()).m_folderId;
|
||||||
case FileIdRole:
|
case FileIdRole:
|
||||||
return m_screenPlayFiles.at(index.row()).m_file;
|
return m_screenPlayFiles.at(index.row()).m_file;
|
||||||
|
case AbsoluteFilePathRole:
|
||||||
|
return m_screenPlayFiles.at(index.row()).m_absolutePath;
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@ -38,18 +40,21 @@ QHash<int, QByteArray> InstalledListModel::roleNames() const
|
|||||||
{ PreviewRole, "screenPreview" },
|
{ PreviewRole, "screenPreview" },
|
||||||
{ FolderIdRole, "screenFolderId" },
|
{ FolderIdRole, "screenFolderId" },
|
||||||
{ FileIdRole, "screenFile" },
|
{ FileIdRole, "screenFile" },
|
||||||
|
{ AbsoluteFilePathRole, "absoluteFilePath" },
|
||||||
};
|
};
|
||||||
return roles;
|
return roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InstalledListModel::getProjectByName(QString profileName, ProjectFile *spf)
|
|
||||||
|
bool InstalledListModel::getProjectByAbsoluteStoragePath(QUrl* path, ProjectFile* spf)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_screenPlayFiles.size(); i++) {
|
for (int i = 0; i < m_screenPlayFiles.count(); ++i) {
|
||||||
if (m_screenPlayFiles.at(i).m_folderId == profileName) {
|
if (m_screenPlayFiles.at(i).m_absolutePath == *path) {
|
||||||
*spf = m_screenPlayFiles.at(i);
|
*spf = m_screenPlayFiles.at(i);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +64,7 @@ void InstalledListModel::append(const QJsonObject obj, const QString folderName)
|
|||||||
|
|
||||||
beginInsertRows(QModelIndex(), row, row);
|
beginInsertRows(QModelIndex(), row, row);
|
||||||
|
|
||||||
ProjectFile tmpFile(obj, folderName);
|
ProjectFile tmpFile(obj, folderName, m_absoluteStoragePath);
|
||||||
m_screenPlayFiles.append(tmpFile);
|
m_screenPlayFiles.append(tmpFile);
|
||||||
|
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
@ -74,7 +79,7 @@ void InstalledListModel::loadScreens()
|
|||||||
QString tmpPath;
|
QString tmpPath;
|
||||||
|
|
||||||
for (auto&& item : list) {
|
for (auto&& item : list) {
|
||||||
tmpPath = m_absoluteStoragePath.toString() +"/" +item.baseName() + "/project.json";
|
tmpPath = m_absoluteStoragePath.toString() + "/" + item.baseName() + "/project.json";
|
||||||
if (!QFile(tmpPath).exists())
|
if (!QFile(tmpPath).exists())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -109,5 +114,3 @@ QVariantMap InstalledListModel::get(QString folderId)
|
|||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
#include <QList>
|
#include <QVector>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
@ -29,7 +29,8 @@ public:
|
|||||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
||||||
void append(const QJsonObject, const QString);
|
void append(const QJsonObject, const QString);
|
||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
bool getProjectByName(QString profileName, ProjectFile* spf);
|
|
||||||
|
bool getProjectByAbsoluteStoragePath(QUrl *path, ProjectFile* spf);
|
||||||
|
|
||||||
Q_INVOKABLE void loadScreens();
|
Q_INVOKABLE void loadScreens();
|
||||||
Q_INVOKABLE QVariantMap get(QString folderId);
|
Q_INVOKABLE QVariantMap get(QString folderId);
|
||||||
@ -40,6 +41,7 @@ public:
|
|||||||
PreviewRole,
|
PreviewRole,
|
||||||
FolderIdRole,
|
FolderIdRole,
|
||||||
FileIdRole,
|
FileIdRole,
|
||||||
|
AbsoluteFilePathRole,
|
||||||
};
|
};
|
||||||
Q_ENUM(InstalledRole)
|
Q_ENUM(InstalledRole)
|
||||||
|
|
||||||
@ -65,7 +67,7 @@ signals:
|
|||||||
void absoluteStoragePathChanged(QUrl absoluteStoragePath);
|
void absoluteStoragePathChanged(QUrl absoluteStoragePath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<ProjectFile> m_screenPlayFiles;
|
QVector<ProjectFile> m_screenPlayFiles;
|
||||||
QUrl m_absoluteStoragePath;
|
QUrl m_absoluteStoragePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ QHash<int, QByteArray> MonitorListModel::roleNames() const
|
|||||||
|
|
||||||
QRect MonitorListModel::getAbsoluteDesktopSize()
|
QRect MonitorListModel::getAbsoluteDesktopSize()
|
||||||
{
|
{
|
||||||
return _monitorList.at(0)._availableVirtualGeometry;
|
return m_monitorList.at(0).m_availableVirtualGeometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant MonitorListModel::headerData(int section, Qt::Orientation orientation, int role) const
|
QVariant MonitorListModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
@ -45,7 +45,7 @@ int MonitorListModel::rowCount(const QModelIndex& parent) const
|
|||||||
if (parent.isValid())
|
if (parent.isValid())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return _monitorList.count();
|
return m_monitorList.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant MonitorListModel::data(const QModelIndex& index, int role) const
|
QVariant MonitorListModel::data(const QModelIndex& index, int role) const
|
||||||
@ -56,15 +56,15 @@ QVariant MonitorListModel::data(const QModelIndex& index, int role) const
|
|||||||
if (index.row() < rowCount())
|
if (index.row() < rowCount())
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case NameRole:
|
case NameRole:
|
||||||
return _monitorList.at(index.row())._name;
|
return m_monitorList.at(index.row()).m_name;
|
||||||
case SizeRole:
|
case SizeRole:
|
||||||
return _monitorList.at(index.row())._size;
|
return m_monitorList.at(index.row()).m_size;
|
||||||
case AvailableGeometryRole:
|
case AvailableGeometryRole:
|
||||||
return _monitorList.at(index.row())._availableGeometry;
|
return m_monitorList.at(index.row()).m_availableGeometry;
|
||||||
case AvailableVirtualGeometryRole:
|
case AvailableVirtualGeometryRole:
|
||||||
return _monitorList.at(index.row())._availableVirtualGeometry;
|
return m_monitorList.at(index.row()).m_availableVirtualGeometry;
|
||||||
case NumberRole:
|
case NumberRole:
|
||||||
return _monitorList.at(index.row())._number;
|
return m_monitorList.at(index.row()).m_number;
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ void MonitorListModel::loadMonitors()
|
|||||||
for (int i = 0; i < QApplication::screens().count(); i++) {
|
for (int i = 0; i < QApplication::screens().count(); i++) {
|
||||||
QScreen* screen = QApplication::screens().at(i);
|
QScreen* screen = QApplication::screens().at(i);
|
||||||
|
|
||||||
_monitorList.append(Monitor(screen->manufacturer(),
|
m_monitorList.append(Monitor(screen->manufacturer(),
|
||||||
screen->model(),
|
screen->model(),
|
||||||
screen->name(),
|
screen->name(),
|
||||||
screen->size(),
|
screen->size(),
|
||||||
@ -120,14 +120,30 @@ void MonitorListModel::loadMonitors()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MonitorListModel::size()
|
||||||
|
{
|
||||||
|
return m_monitorList.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool MonitorListModel::getMonitorListItemAt(int position, Monitor* monitor)
|
||||||
|
{
|
||||||
|
if (position < 0 && position > m_monitorList.size()) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
*monitor = m_monitorList.at(position);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
float MonitorListModel::GetHighestMonitorYValue()
|
float MonitorListModel::GetHighestMonitorYValue()
|
||||||
{
|
{
|
||||||
/*for (int i = 0; i < vector.size(); ++i)
|
/*for (int i = 0; i < vector.size(); ++i)
|
||||||
{
|
{
|
||||||
_monitorList.at(i).screen->availableVirtualGeometry().x();
|
m_monitorList.at(i).screen->availableVirtualGeometry().x();
|
||||||
_monitorList.at(i).screen->availableGeometry().y();
|
m_monitorList.at(i).screen->availableGeometry().y();
|
||||||
}*/
|
}*/
|
||||||
// _monitorList.
|
// m_monitorList.
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,13 +154,13 @@ Monitor::Monitor()
|
|||||||
Monitor::Monitor(QString manufacturer, QString model, QString name, QSize size, QRect availableGeometry, int number, QRect availableVirtualGeometry)
|
Monitor::Monitor(QString manufacturer, QString model, QString name, QSize size, QRect availableGeometry, int number, QRect availableVirtualGeometry)
|
||||||
{
|
{
|
||||||
|
|
||||||
_name = name;
|
m_name = name;
|
||||||
_size = size;
|
m_size = size;
|
||||||
_availableGeometry = availableGeometry;
|
m_availableGeometry = availableGeometry;
|
||||||
|
|
||||||
_availableVirtualGeometry = availableVirtualGeometry;
|
m_availableVirtualGeometry = availableVirtualGeometry;
|
||||||
_number = number;
|
m_number = number;
|
||||||
// FIXME: Use a better way to create an id
|
// FIXME: Use a better way to create an id
|
||||||
// because name and manufacturer are allways empty
|
// because name and manufacturer are allways empty
|
||||||
_id = /*name + "_" +*/ QString::number(size.width()) + "x" + QString::number(size.height()) + "_" + QString::number(availableGeometry.x()) + "x" + QString::number(availableGeometry.y());
|
m_id = /*name + "_" +*/ QString::number(size.width()) + "x" + QString::number(size.height()) + "_" + QString::number(availableGeometry.x()) + "x" + QString::number(availableGeometry.y());
|
||||||
}
|
}
|
||||||
|
@ -57,10 +57,13 @@ public:
|
|||||||
|
|
||||||
void loadMonitors();
|
void loadMonitors();
|
||||||
|
|
||||||
|
int size();
|
||||||
|
bool getMonitorListItemAt(int position, Monitor *monitor);
|
||||||
|
|
||||||
float GetHighestMonitorYValue();
|
float GetHighestMonitorYValue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<Monitor> _monitorList;
|
QVector<Monitor> m_monitorList;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Monitor {
|
class Monitor {
|
||||||
@ -69,13 +72,13 @@ public:
|
|||||||
Monitor();
|
Monitor();
|
||||||
Monitor(QString manufacturer, QString model, QString name, QSize size, QRect availableGeometry, int number, QRect availableVirtualGeometry);
|
Monitor(QString manufacturer, QString model, QString name, QSize size, QRect availableGeometry, int number, QRect availableVirtualGeometry);
|
||||||
|
|
||||||
QString _id;
|
QString m_id;
|
||||||
QString _name;
|
QString m_name;
|
||||||
QSize _size;
|
QSize m_size;
|
||||||
QRect _availableGeometry;
|
QRect m_availableGeometry;
|
||||||
QRect _availableVirtualGeometry;
|
QRect m_availableVirtualGeometry;
|
||||||
int _number;
|
int m_number;
|
||||||
bool _isVirtualDesktop;
|
bool m_isVirtualDesktop;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif // MONITORLISTMODEL_H
|
#endif // MONITORLISTMODEL_H
|
||||||
|
@ -7,7 +7,7 @@ PackageFileHandler::PackageFileHandler(QObject* parent)
|
|||||||
qmlRegisterType<PackageFileHandler>("PackageFileHandler", 1, 0, "LoaderStatus");
|
qmlRegisterType<PackageFileHandler>("PackageFileHandler", 1, 0, "LoaderStatus");
|
||||||
}
|
}
|
||||||
|
|
||||||
int PackageFileHandler::loadPackageFromLocalZip(QList<QUrl> url, QString extractDir)
|
int PackageFileHandler::loadPackageFromLocalZip(QVector<QUrl> url, QString extractDir)
|
||||||
{
|
{
|
||||||
setCurrentLoaderStatus(LoaderStatus::Extracting);
|
setCurrentLoaderStatus(LoaderStatus::Extracting);
|
||||||
for(int i = 0; i < url.length(); i++) {
|
for(int i = 0; i < url.length(); i++) {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#define PACKAGEFILEHANDLER_H
|
#define PACKAGEFILEHANDLER_H
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QList>
|
#include <QVector>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
@ -15,7 +15,7 @@ class PackageFileHandler : public QObject {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit PackageFileHandler(QObject* parent = nullptr);
|
explicit PackageFileHandler(QObject* parent = nullptr);
|
||||||
Q_INVOKABLE int loadPackageFromLocalZip(QList<QUrl> url, QString extractDir);
|
Q_INVOKABLE int loadPackageFromLocalZip(QVector<QUrl> url, QString extractDir);
|
||||||
|
|
||||||
enum LoaderStatus {
|
enum LoaderStatus {
|
||||||
Idle,
|
Idle,
|
||||||
|
@ -48,14 +48,14 @@ void ProfileListModel::loadProfiles()
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
QFileInfoList list = QDir(m_absoluteStoragePath.toString()+ "/Profiles/").entryInfoList(QDir::NoDotAndDotDot | QDir::AllDirs);
|
QFileInfoList list = QDir(m_localStoragePath.toString()+ "/Profiles/").entryInfoList(QDir::NoDotAndDotDot | QDir::AllDirs);
|
||||||
QString tmpPath;
|
QString tmpPath;
|
||||||
QJsonDocument profileDoc;
|
QJsonDocument profileDoc;
|
||||||
QJsonParseError parseError;
|
QJsonParseError parseError;
|
||||||
QJsonObject profileObj;
|
QJsonObject profileObj;
|
||||||
|
|
||||||
for (auto&& item : list) {
|
for (auto&& item : list) {
|
||||||
tmpPath = m_absoluteStoragePath.toString() + "/Profiles/" + item.baseName() + "/profile.json";
|
tmpPath = m_localStoragePath.toString() + "/Profiles/" + item.baseName() + "/profile.json";
|
||||||
|
|
||||||
QFile settings;
|
QFile settings;
|
||||||
settings.setFileName(tmpPath);
|
settings.setFileName(tmpPath);
|
||||||
@ -94,7 +94,7 @@ void ProfileListModel::loadProfiles()
|
|||||||
if (profileObj.contains("isLooping"))
|
if (profileObj.contains("isLooping"))
|
||||||
tmpProfile.m_isLooping = profileObj.value("isLooping").toBool();
|
tmpProfile.m_isLooping = profileObj.value("isLooping").toBool();
|
||||||
|
|
||||||
tmpProfile.m_absolutePath = m_absoluteStoragePath;
|
tmpProfile.m_absolutePath = m_localStoragePath;
|
||||||
|
|
||||||
m_profileList.append(tmpProfile);
|
m_profileList.append(tmpProfile);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public:
|
|||||||
virtual QHash<int, QByteArray> roleNames() const override;
|
virtual QHash<int, QByteArray> roleNames() const override;
|
||||||
void loadProfiles();
|
void loadProfiles();
|
||||||
bool getProfileByName(QString id, Profile* profile);
|
bool getProfileByName(QString id, Profile* profile);
|
||||||
QUrl m_absoluteStoragePath;
|
QUrl m_localStoragePath;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QHash<int, QByteArray> m_roleNames;
|
QHash<int, QByteArray> m_roleNames;
|
||||||
|
@ -4,7 +4,7 @@ ProjectFile::ProjectFile()
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
ProjectFile::ProjectFile(QJsonObject obj, QString folderName)
|
ProjectFile::ProjectFile(QJsonObject obj, QString folderName, QUrl absolutePath)
|
||||||
{
|
{
|
||||||
if (obj.contains("description"))
|
if (obj.contains("description"))
|
||||||
m_description = obj.value("description");
|
m_description = obj.value("description");
|
||||||
@ -18,5 +18,7 @@ ProjectFile::ProjectFile(QJsonObject obj, QString folderName)
|
|||||||
if (obj.contains("title"))
|
if (obj.contains("title"))
|
||||||
m_title = obj.value("title");
|
m_title = obj.value("title");
|
||||||
|
|
||||||
|
m_absolutePath = absolutePath;
|
||||||
|
|
||||||
m_folderId = folderName;
|
m_folderId = folderName;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ class ProjectFile
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ProjectFile();
|
ProjectFile();
|
||||||
ProjectFile(QJsonObject obj, QString folderName);
|
ProjectFile(QJsonObject obj, QString folderName, QUrl absolutePath);
|
||||||
|
|
||||||
QVariant m_description;
|
QVariant m_description;
|
||||||
QVariant m_file;
|
QVariant m_file;
|
||||||
|
106
src/settings.cpp
106
src/settings.cpp
@ -12,7 +12,6 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
|
|||||||
QFile configTmp;
|
QFile configTmp;
|
||||||
QString appConfigLocation = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
|
QString appConfigLocation = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
|
||||||
|
|
||||||
|
|
||||||
if (!QDir(appConfigLocation).exists()) {
|
if (!QDir(appConfigLocation).exists()) {
|
||||||
if (!QDir().mkdir(appConfigLocation)) {
|
if (!QDir().mkdir(appConfigLocation)) {
|
||||||
qWarning("ERROR: Cloud not create install dir");
|
qWarning("ERROR: Cloud not create install dir");
|
||||||
@ -59,7 +58,7 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
|
|||||||
if (QString(configObj.value("absoluteStoragePath").toString()).isEmpty()) {
|
if (QString(configObj.value("absoluteStoragePath").toString()).isEmpty()) {
|
||||||
uint32 size = 5000;
|
uint32 size = 5000;
|
||||||
char folder[size];
|
char folder[size];
|
||||||
SteamApps()->GetAppInstallDir(m_steamID,folder,5000);
|
SteamApps()->GetAppInstallDir(m_steamID, folder, 5000);
|
||||||
QDir steamTmpUrl = QDir(QString(QByteArray(folder).data()));
|
QDir steamTmpUrl = QDir(QString(QByteArray(folder).data()));
|
||||||
steamTmpUrl.cdUp();
|
steamTmpUrl.cdUp();
|
||||||
steamTmpUrl.cdUp();
|
steamTmpUrl.cdUp();
|
||||||
@ -75,32 +74,7 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
|
|||||||
m_ilm->setabsoluteStoragePath(m_localStoragePath);
|
m_ilm->setabsoluteStoragePath(m_localStoragePath);
|
||||||
m_plm->m_localStoragePath = m_localStoragePath;
|
m_plm->m_localStoragePath = m_localStoragePath;
|
||||||
|
|
||||||
/*
|
|
||||||
//Create default folders
|
|
||||||
if (!QDir(m_absoluteStoragePath.toString() + "/ProfilePackages").exists()) {
|
|
||||||
if (!QDir().mkdir(appConfigLocation + "/ProfilePackages")) {
|
|
||||||
qWarning("ERROR: Cloud not create ProfilePackages dir");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!QDir(m_absoluteStoragePath.toString() + "/Profiles").exists()) {
|
|
||||||
if (!QDir().mkdir(appConfigLocation + "/Profiles")) {
|
|
||||||
qWarning("ERROR: Cloud not create Profiles dir");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!QDir(m_absoluteStoragePath.toString() + "/Wallpaper").exists()) {
|
|
||||||
if (!QDir().mkdir(appConfigLocation + "/Wallpaper")) {
|
|
||||||
qWarning("ERROR: Cloud not create Wallpaper dir");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!QDir(m_absoluteStoragePath.toString() + "/Widgets").exists()) {
|
|
||||||
if (!QDir().mkdir(appConfigLocation + "/Widgets")) {
|
|
||||||
qWarning("ERROR: Cloud not create Widgets dir");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
m_autostart = configObj.value("autostart").toBool();
|
m_autostart = configObj.value("autostart").toBool();
|
||||||
m_highPriorityStart = configObj.value("highPriorityStart").toBool();
|
m_highPriorityStart = configObj.value("highPriorityStart").toBool();
|
||||||
@ -112,19 +86,61 @@ Settings::~Settings()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::createNewProfile(int screenNumber)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Settings::constructWallpaper(Profile profile, QString monitorID, ProjectFile pf)
|
void Settings::constructWallpaper(Profile profile, QString monitorID, ProjectFile pf)
|
||||||
{
|
{
|
||||||
|
//m_wallpapers.append(QSharedPointer<Wallpaper>(new Wallpaper(profile, pf)));
|
||||||
m_wallpapers.append(QSharedPointer<Wallpaper>(new Wallpaper(profile,pf)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::setWallpaper(int monitorIndex, QString wallpaperID)
|
void Settings::constructWallpaper(QString folder, int monitorListAt)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setWallpaper(int monitorIndex, QString wallpaperID, QUrl absoluteStoragePath)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
ProjectFile project;
|
||||||
|
Monitor monitor;
|
||||||
|
|
||||||
|
if (!m_mlm->getMonitorListItemAt(monitorIndex, &monitor)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!m_ilm->getProjectByAbsoluteStoragePath(&absoluteStoragePath,&project)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search for active Wallpapers on the same monitor and delte it
|
||||||
|
for (int i = 0; i < m_wallpapers.length(); ++i) {
|
||||||
|
if (m_wallpapers.at(i).data()->monitor().m_id == monitor.m_id) {
|
||||||
|
removeWallpaperAt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Profile profile;
|
||||||
|
//Does the targeted monitor has a profile ?
|
||||||
|
// 1. Get the requested monitor
|
||||||
|
if(m_mlm->getMonitorListItemAt(monitorIndex,&monitor)){
|
||||||
|
// 2. When found search for
|
||||||
|
for (int i = 0; i < m_mlm->size(); ++i) {
|
||||||
|
if(m_mlm->getMonitorListItemAt(i,&tmpMonitor)){
|
||||||
|
for(int i = 0; i < m_activeProfiles.size(); ++i){
|
||||||
|
if(tmpMonitor._id == m_activeProfiles.at(i).data()->monitorId()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (m_ilm->getProjectByName(wallpaperID, &project)) {
|
||||||
|
if(m_mlm->getMonitorListItemAt(monitorIndex,&monitor)){
|
||||||
|
m_wallpapers.append(QSharedPointer<Wallpaper>(new Wallpaper(profile, monitor)));
|
||||||
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::loadActiveProfiles()
|
void Settings::loadActiveProfiles()
|
||||||
@ -152,10 +168,9 @@ void Settings::loadActiveProfiles()
|
|||||||
|
|
||||||
if (!m_plm->getProfileByName(profileName, &profile))
|
if (!m_plm->getProfileByName(profileName, &profile))
|
||||||
continue;
|
continue;
|
||||||
if (!m_ilm->getProjectByName(profile.m_wallpaperId, &spf))
|
if(!m_ilm->getProjectByAbsoluteStoragePath(&profile.m_absolutePath, &spf))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
||||||
constructWallpaper(profile, monitorID, spf);
|
constructWallpaper(profile, monitorID, spf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -166,9 +181,14 @@ void Settings::removeAll()
|
|||||||
m_wallpapers.clear();
|
m_wallpapers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::updateSettinsValue(QString newValue)
|
void Settings::createNewWallpaper(int monitorListPosition, Profile profile, ProjectFile projectFile)
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::removeWallpaperAt(int pos)
|
||||||
|
{
|
||||||
|
//Todo is this a memory leak?
|
||||||
|
m_wallpapers.removeAt(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::createDefaultConfig()
|
void Settings::createDefaultConfig()
|
||||||
@ -189,11 +209,6 @@ void Settings::createDefaultConfig()
|
|||||||
defaultSettings.close();
|
defaultSettings.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::updateSettingsLocalPath(QUrl newPath)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ActiveProfiles::ActiveProfiles()
|
ActiveProfiles::ActiveProfiles()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -203,3 +218,8 @@ ActiveProfiles::ActiveProfiles(QString wallpaperId, Profile profile)
|
|||||||
m_monitorId = wallpaperId;
|
m_monitorId = wallpaperId;
|
||||||
m_profile = profile;
|
m_profile = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ActiveProfiles::monitorId() const
|
||||||
|
{
|
||||||
|
return m_monitorId;
|
||||||
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#ifndef SCREENPLAYSETTINGS_H
|
#pragma once
|
||||||
#define SCREENPLAYSETTINGS_H
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@ -28,6 +27,9 @@
|
|||||||
|
|
||||||
class ActiveProfiles;
|
class ActiveProfiles;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Settings : public QObject {
|
class Settings : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@ -43,7 +45,13 @@ public:
|
|||||||
void loadActiveProfiles();
|
void loadActiveProfiles();
|
||||||
void removeAll();
|
void removeAll();
|
||||||
|
|
||||||
void updateSettinsValue(QString newValue);
|
enum LocalCopyResult {
|
||||||
|
NoError,
|
||||||
|
CopyError,
|
||||||
|
NotEnoughDiskSpace,
|
||||||
|
NameCollision,
|
||||||
|
};
|
||||||
|
Q_ENUM(LocalCopyResult)
|
||||||
|
|
||||||
enum Renderer {
|
enum Renderer {
|
||||||
OpenGL,
|
OpenGL,
|
||||||
@ -87,6 +95,7 @@ public:
|
|||||||
return m_localStoragePath;
|
return m_localStoragePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void autostartChanged(bool autostart);
|
void autostartChanged(bool autostart);
|
||||||
@ -95,7 +104,7 @@ signals:
|
|||||||
|
|
||||||
void rendererChanged(Renderer renderer);
|
void rendererChanged(Renderer renderer);
|
||||||
|
|
||||||
void sendStatisticsChanged(bool sendStatistics);
|
void sendStatisticsChanged(bool status);
|
||||||
|
|
||||||
void localStoragePathChanged(QUrl localStoragePath);
|
void localStoragePathChanged(QUrl localStoragePath);
|
||||||
|
|
||||||
@ -128,15 +137,6 @@ public slots:
|
|||||||
emit rendererChanged(m_renderer);
|
emit rendererChanged(m_renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setsendStatistics(bool sendStatistics)
|
|
||||||
{
|
|
||||||
if (m_sendStatistics == sendStatistics)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_sendStatistics = sendStatistics;
|
|
||||||
emit sendStatisticsChanged(m_sendStatistics);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setSendStatistics(bool sendStatistics)
|
void setSendStatistics(bool sendStatistics)
|
||||||
{
|
{
|
||||||
if (m_sendStatistics == sendStatistics)
|
if (m_sendStatistics == sendStatistics)
|
||||||
@ -146,18 +146,22 @@ public slots:
|
|||||||
emit sendStatisticsChanged(m_sendStatistics);
|
emit sendStatisticsChanged(m_sendStatistics);
|
||||||
}
|
}
|
||||||
|
|
||||||
void createNewProfile(int screenNumber);
|
void createNewWallpaper(int monitorListPosition, Profile profile, ProjectFile projectFile);
|
||||||
|
|
||||||
|
void removeWallpaperAt(int pos);
|
||||||
|
|
||||||
void constructWallpaper(Profile profile, QString monitorID, ProjectFile spf);
|
void constructWallpaper(Profile profile, QString monitorID, ProjectFile spf);
|
||||||
|
|
||||||
void setWallpaper(int monitorIndex, QString wallpaperID);
|
void constructWallpaper(QString folder, int monitorListAt);
|
||||||
|
|
||||||
|
void setWallpaper(int monitorIndex, QString wallpaperID, QUrl absoluteStoragePath);
|
||||||
|
|
||||||
void setLocalStoragePath(QUrl localStoragePath)
|
void setLocalStoragePath(QUrl localStoragePath)
|
||||||
{
|
{
|
||||||
if (m_localStoragePath == localStoragePath)
|
if (m_localStoragePath == localStoragePath)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QJsonValue cleanedPath = QJsonValue(QString(localStoragePath.toString()).remove(0,8));
|
QJsonValue cleanedPath = QJsonValue(QString(localStoragePath.toString()).remove(0, 8));
|
||||||
|
|
||||||
m_localStoragePath = cleanedPath.toString();
|
m_localStoragePath = cleanedPath.toString();
|
||||||
|
|
||||||
@ -186,13 +190,11 @@ public slots:
|
|||||||
private:
|
private:
|
||||||
void createDefaultConfig();
|
void createDefaultConfig();
|
||||||
void createProfileConfig();
|
void createProfileConfig();
|
||||||
void updateSettingsLocalPath(QUrl newPath);
|
|
||||||
|
|
||||||
bool m_autostart = true;
|
bool m_autostart = true;
|
||||||
bool m_highPriorityStart = true;
|
bool m_highPriorityStart = true;
|
||||||
bool m_sendStatistics;
|
bool m_sendStatistics;
|
||||||
|
|
||||||
|
|
||||||
AppId_t m_steamID;
|
AppId_t m_steamID;
|
||||||
|
|
||||||
Renderer m_renderer = Renderer::OpenGL;
|
Renderer m_renderer = Renderer::OpenGL;
|
||||||
@ -202,8 +204,9 @@ private:
|
|||||||
MonitorListModel* m_mlm;
|
MonitorListModel* m_mlm;
|
||||||
QThread m_thread;
|
QThread m_thread;
|
||||||
|
|
||||||
|
|
||||||
QVector<QSharedPointer<Wallpaper>> m_wallpapers;
|
QVector<QSharedPointer<Wallpaper>> m_wallpapers;
|
||||||
QVector<QSharedPointer<ActiveProfiles>> m_activeProfiles;
|
|
||||||
QUrl m_localStoragePath;
|
QUrl m_localStoragePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -212,6 +215,8 @@ public:
|
|||||||
ActiveProfiles();
|
ActiveProfiles();
|
||||||
ActiveProfiles(QString monitorId, Profile profile);
|
ActiveProfiles(QString monitorId, Profile profile);
|
||||||
|
|
||||||
|
QString monitorId() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_monitorId;
|
QString m_monitorId;
|
||||||
Profile m_profile;
|
Profile m_profile;
|
||||||
@ -222,4 +227,4 @@ enum FillMode {
|
|||||||
PreserveAspectFit,
|
PreserveAspectFit,
|
||||||
PreserveAspectCrop,
|
PreserveAspectCrop,
|
||||||
};
|
};
|
||||||
#endif // SCREENPLAYSETTINGS_H
|
|
||||||
|
@ -5,10 +5,11 @@ SteamWorkshop::SteamWorkshop(QObject* parent)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SteamWorkshop::SteamWorkshop(AppId_t nConsumerAppId, SteamWorkshopListModel* wlm)
|
SteamWorkshop::SteamWorkshop(AppId_t nConsumerAppId, SteamWorkshopListModel* wlm, Settings *s)
|
||||||
{
|
{
|
||||||
m_AppId = nConsumerAppId;
|
m_AppId = nConsumerAppId;
|
||||||
m_workshopListModel = wlm;
|
m_workshopListModel = wlm;
|
||||||
|
m_settings = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SteamWorkshop::createWorkshopItem()
|
void SteamWorkshop::createWorkshopItem()
|
||||||
@ -51,6 +52,23 @@ void SteamWorkshop::getAPICallInfo()
|
|||||||
void SteamWorkshop::createLocalWorkshopItem(QString title, QUrl videoPath, QUrl previewPath)
|
void SteamWorkshop::createLocalWorkshopItem(QString title, QUrl videoPath, QUrl previewPath)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
QFuture<void> future = QtConcurrent::run([&]() {
|
||||||
|
if(QDir(m_settings->localStoragePath().toString() + title ).exists()){
|
||||||
|
//emit localFileCopyCompleted()
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// bool copyResult = QFile::copy();
|
||||||
|
// if(copyResult){
|
||||||
|
// emit localFileCopyCompleted(true);
|
||||||
|
// } else {
|
||||||
|
// emit localFileCopyCompleted(false);
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void SteamWorkshop::onWorkshopItemCreated(CreateItemResult_t* pCallback, bool bIOFailure)
|
void SteamWorkshop::onWorkshopItemCreated(CreateItemResult_t* pCallback, bool bIOFailure)
|
||||||
@ -94,7 +112,7 @@ void SteamWorkshop::onWorkshopSearched(SteamUGCQueryCompleted_t* pCallback, bool
|
|||||||
QByteArray urlData(url);
|
QByteArray urlData(url);
|
||||||
previews = SteamUGC()->GetQueryUGCNumAdditionalPreviews(pCallback->m_handle, i);
|
previews = SteamUGC()->GetQueryUGCNumAdditionalPreviews(pCallback->m_handle, i);
|
||||||
|
|
||||||
m_workshopListModel->append(QString(details.m_rgchTitle),QUrl(urlData));
|
m_workshopListModel->append(QString(details.m_rgchTitle), QUrl(urlData));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,15 +6,19 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QFuture>
|
||||||
|
#include <QtConcurrent/QtConcurrent>
|
||||||
|
|
||||||
#include "steam/steam_api.h"
|
#include "steam/steam_api.h"
|
||||||
#include "steamworkshoplistmodel.h"
|
#include "steamworkshoplistmodel.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
class SteamWorkshop : public QObject {
|
class SteamWorkshop : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SteamWorkshop(QObject* parent = nullptr);
|
explicit SteamWorkshop(QObject* parent = nullptr);
|
||||||
SteamWorkshop(AppId_t nConsumerAppId, SteamWorkshopListModel* wlm);
|
SteamWorkshop(AppId_t nConsumerAppId, SteamWorkshopListModel* wlm, Settings* s);
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void searchWorkshop();
|
void searchWorkshop();
|
||||||
@ -22,10 +26,12 @@ public slots:
|
|||||||
void submitWorkshopItem(QString title, QString description, QString language, int remoteStoragePublishedFileVisibility, QUrl absoluteContentPath, QUrl absolutePreviewPath);
|
void submitWorkshopItem(QString title, QString description, QString language, int remoteStoragePublishedFileVisibility, QUrl absoluteContentPath, QUrl absolutePreviewPath);
|
||||||
int getItemUpdateProcess();
|
int getItemUpdateProcess();
|
||||||
void getAPICallInfo();
|
void getAPICallInfo();
|
||||||
|
void createLocalWorkshopItem(QString title, QUrl videoPath, QUrl previewPath);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void workshopItemCreated(bool userNeedsToAcceptWorkshopLegalAgreement, int eResult, int publishedFileId);
|
void workshopItemCreated(bool userNeedsToAcceptWorkshopLegalAgreement, int eResult, int publishedFileId);
|
||||||
void workshopSearched();
|
void workshopSearched();
|
||||||
|
void localFileCopyCompleted(bool successful);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void onWorkshopItemCreated(CreateItemResult_t* pCallback, bool bIOFailure);
|
void onWorkshopItemCreated(CreateItemResult_t* pCallback, bool bIOFailure);
|
||||||
@ -39,4 +45,5 @@ private:
|
|||||||
UGCQueryHandle_t m_UGCSearchHandle;
|
UGCQueryHandle_t m_UGCSearchHandle;
|
||||||
SteamAPICall_t m_searchCall;
|
SteamAPICall_t m_searchCall;
|
||||||
SteamWorkshopListModel* m_workshopListModel;
|
SteamWorkshopListModel* m_workshopListModel;
|
||||||
|
Settings* m_settings;
|
||||||
};
|
};
|
||||||
|
@ -18,12 +18,13 @@ Wallpaper::Wallpaper(QWindow* parent)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Wallpaper::Wallpaper(Profile profile, ProjectFile projf)
|
Wallpaper::Wallpaper(Profile profile, ProjectFile project, Monitor monitor)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_profile = profile;
|
m_profile = profile;
|
||||||
m_project = projf;
|
m_monitor = monitor;
|
||||||
QString tmp = profile.m_absolutePath.toString() + "/Wallpaper/" + profile.m_wallpaperId + "/" + projf.m_file.toString();
|
m_project = project;
|
||||||
|
QString tmp = profile.m_absolutePath.toString() + "/Wallpaper/" + profile.m_wallpaperId + "/" + m_project.m_file.toString();
|
||||||
tmp.replace("/","\\\\");
|
tmp.replace("/","\\\\");
|
||||||
setAbsoluteFilePath(tmp);
|
setAbsoluteFilePath(tmp);
|
||||||
|
|
||||||
@ -70,3 +71,8 @@ Wallpaper::~Wallpaper()
|
|||||||
{
|
{
|
||||||
ShowWindow(m_hwnd, SW_HIDE);
|
ShowWindow(m_hwnd, SW_HIDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Monitor Wallpaper::monitor() const
|
||||||
|
{
|
||||||
|
return m_monitor;
|
||||||
|
}
|
||||||
|
@ -12,15 +12,16 @@
|
|||||||
|
|
||||||
#include "profile.h"
|
#include "profile.h"
|
||||||
#include "projectfile.h"
|
#include "projectfile.h"
|
||||||
|
#include "monitorlistmodel.h"
|
||||||
|
|
||||||
class Wallpaper : public QWindow {
|
class Wallpaper : public QWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit Wallpaper(QWindow* parent = 0);
|
explicit Wallpaper(QWindow* parent = 0);
|
||||||
Wallpaper(Profile profile, ProjectFile projf);
|
Wallpaper(Profile profile, ProjectFile project, Monitor monitor);
|
||||||
~Wallpaper();
|
~Wallpaper();
|
||||||
Q_PROPERTY(QString absoluteFilePath READ absoluteFilePath WRITE setAbsoluteFilePath NOTIFY absoluteFilePathChanged)
|
Q_PROPERTY(QString absoluteFilePath READ absoluteFilePath WRITE setAbsoluteFilePath NOTIFY absoluteFilePathChanged)
|
||||||
|
Q_PROPERTY(bool isPlaying READ isPlaying WRITE setIsPlaying NOTIFY isPlayingChanged)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -29,6 +30,13 @@ public:
|
|||||||
return m_absoluteFilePath;
|
return m_absoluteFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isPlaying() const
|
||||||
|
{
|
||||||
|
return m_isPlaying;
|
||||||
|
}
|
||||||
|
|
||||||
|
Monitor monitor() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setAbsoluteFilePath(QString absoluteFilePath)
|
void setAbsoluteFilePath(QString absoluteFilePath)
|
||||||
{
|
{
|
||||||
@ -39,9 +47,20 @@ public slots:
|
|||||||
emit absoluteFilePathChanged(m_absoluteFilePath);
|
emit absoluteFilePathChanged(m_absoluteFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setIsPlaying(bool isPlaying)
|
||||||
|
{
|
||||||
|
if (m_isPlaying == isPlaying)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_isPlaying = isPlaying;
|
||||||
|
emit isPlayingChanged(m_isPlaying);
|
||||||
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void absoluteFilePathChanged(QString absoluteFilePath);
|
void absoluteFilePathChanged(QString absoluteFilePath);
|
||||||
|
|
||||||
|
void isPlayingChanged(bool isPlaying);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HWND m_hwnd;
|
HWND m_hwnd;
|
||||||
HWND m_worker_hwnd;
|
HWND m_worker_hwnd;
|
||||||
@ -50,7 +69,9 @@ private:
|
|||||||
|
|
||||||
Profile m_profile;
|
Profile m_profile;
|
||||||
ProjectFile m_project;
|
ProjectFile m_project;
|
||||||
|
Monitor m_monitor;
|
||||||
QString m_absoluteFilePath;
|
QString m_absoluteFilePath;
|
||||||
|
bool m_isPlaying;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WALLPAPER_H
|
#endif // WALLPAPER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user