1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-02 16:49:47 +02:00

Add everything cuz i need the stuff on my laptop

This commit is contained in:
kelteseth 2017-06-30 10:04:19 +02:00
parent 6bb1c69a59
commit 08468e89f4
9 changed files with 58 additions and 27 deletions

View File

@ -51,6 +51,7 @@ int main(int argc, char* argv[])
QQmlApplicationEngine mainWindowEngine;
installedListModel.loadScreens();
mainWindowEngine.rootContext()->setContextProperty("monitorListModel", &monitorListModel);
mainWindowEngine.rootContext()->setContextProperty("installedListModel", &installedListModel);
mainWindowEngine.rootContext()->setContextProperty("settings", &settings);
@ -64,7 +65,7 @@ int main(int argc, char* argv[])
[&](){exit(app.exec()); });
installedListModel.loadScreens();
profileListModel.loadProfiles();
int status = app.exec();
//Shutdown

View File

@ -41,16 +41,8 @@ Page {
}
add: Transition {
NumberAnimation { properties: "x,y"; from: 100; duration: 1000 }
}
displaced: Transition {
NumberAnimation { properties: "x,y"; duration: 400; easing.type: Easing.OutBounce }
NumberAnimation { property: "opacity"; from: 0; to: 1.0; duration: 400 }
}
}

View File

@ -3,6 +3,7 @@
"autostart" : true,
"highPriorityStart" : false,
"sendStatistics" : false,
"absoluteStoragePath": "", //we use the Appdata folder if empty AppData\Local\Aimber\ScreenPlay
"renderer": {
"renderer-value": 0,
"renderer-enum" : ["OpenGL","Vulkan", "DirectX11", "DirectX12", "Software"]

View File

@ -3,19 +3,6 @@
InstalledListModel::InstalledListModel(QObject* parent)
: QAbstractListModel(parent)
{
QString writablePath = QStandardPaths::writableLocation(QStandardPaths::StandardLocation::DataLocation);
if (!QDir(writablePath).exists()) {
if (!QDir().mkdir(writablePath)) {
qWarning("ERROR: Cloud not create install dir");
return;
}
} else {
_screensPath = writablePath + "/Wallpaper/";
}
}
int InstalledListModel::rowCount(const QModelIndex& parent) const

View File

@ -5,8 +5,9 @@ Profile::Profile()
}
Profile::Profile(QString id, QString version, QString wallpaperId, QRect rect, bool isLooping)
Profile::Profile(QUrl absolutePath, QString id, QString version, QString wallpaperId, QRect rect, bool isLooping)
{
m_absolutePath = absolutePath;
m_id = id;
m_version = version;
m_wallpaperId = wallpaperId;

View File

@ -3,12 +3,14 @@
#include <QRect>
#include <QString>
#include <QUrl>
class Profile {
public:
Profile();
Profile(QString id, QString version, QString wallpaperId, QRect rect, bool isLooping);
Profile(QUrl absolutePath, QString id, QString version, QString wallpaperId, QRect rect, bool isLooping);
QUrl m_absolutePath;
QString m_id;
QString m_version = "";
QString m_wallpaperId = "";

View File

@ -8,7 +8,7 @@
#include <QStandardPaths>
#include <QString>
#include <QVector>
#include <QUrl>
#include <QDebug>
class Profile;
@ -33,6 +33,8 @@ public:
private:
QHash<int, QByteArray> m_roleNames;
QVector<Profile> m_profileList;
QUrl m_absoluteStoragePath;
};
#endif // PROFILELISTMODEL_H

View File

@ -8,8 +8,17 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
m_mlm = mlm;
m_ilm = ilm;
QFile configTmp;
QString appConfigLocation = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation);
if (!QDir(appConfigLocation).exists()) {
if (!QDir().mkdir(appConfigLocation)) {
qWarning("ERROR: Cloud not create install dir");
return;
}
}
configTmp.setFileName(appConfigLocation + "/settings.json");
// App Settings
@ -18,6 +27,7 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
createDefaultConfig();
}
QJsonDocument configJsonDocument;
QJsonParseError parseError;
QJsonObject configObj;
@ -45,6 +55,37 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
return;
}
if(QString(configObj.value("absoluteStoragePath").toString()).isEmpty())
m_absoluteStoragePath = appConfigLocation;
//Create default folders
if (!QDir(appConfigLocation + "/ProfilePackages").exists()) {
if (!QDir().mkdir(appConfigLocation + "/ProfilePackages")) {
qWarning("ERROR: Cloud not create ProfilePackages dir");
return;
}
}
if (!QDir(appConfigLocation + "/Profiles").exists()) {
if (!QDir().mkdir(appConfigLocation + "/Profiles")) {
qWarning("ERROR: Cloud not create Profiles dir");
return;
}
}
if (!QDir(appConfigLocation + "/Wallpaper").exists()) {
if (!QDir().mkdir(appConfigLocation + "/Wallpaper")) {
qWarning("ERROR: Cloud not create Wallpaper dir");
return;
}
}
if (!QDir(appConfigLocation + "/Widgets").exists()) {
if (!QDir().mkdir(appConfigLocation + "/Widgets")) {
qWarning("ERROR: Cloud not create Widgets dir");
return;
}
}
m_autostart = configObj.value("autostart").toBool();
m_highPriorityStart = configObj.value("highPriorityStart").toBool();
m_sendStatistics = configObj.value("sendStatistics").toBool();
@ -64,6 +105,7 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
QString profileName = activeProfilesTmp.at(i).toObject().value("profile").toString();
QString monitorID = activeProfilesTmp.at(i).toObject().value("monitorID").toString();
Profile profile;
if (!m_plm->getProfileByName(profileName, &profile))
continue;

View File

@ -140,8 +140,11 @@ private:
bool m_autostart = true;
bool m_highPriorityStart = true;
Renderer m_renderer = Renderer::OpenGL;
bool m_sendStatistics;
QUrl m_absoluteStoragePath;
Renderer m_renderer = Renderer::OpenGL;
Version m_version;
ProfileListModel* m_plm;
InstalledListModel* m_ilm;