1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-15 06:52:34 +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; QQmlApplicationEngine mainWindowEngine;
installedListModel.loadScreens();
mainWindowEngine.rootContext()->setContextProperty("monitorListModel", &monitorListModel); mainWindowEngine.rootContext()->setContextProperty("monitorListModel", &monitorListModel);
mainWindowEngine.rootContext()->setContextProperty("installedListModel", &installedListModel); mainWindowEngine.rootContext()->setContextProperty("installedListModel", &installedListModel);
mainWindowEngine.rootContext()->setContextProperty("settings", &settings); mainWindowEngine.rootContext()->setContextProperty("settings", &settings);
@ -64,7 +65,7 @@ int main(int argc, char* argv[])
[&](){exit(app.exec()); }); [&](){exit(app.exec()); });
installedListModel.loadScreens(); profileListModel.loadProfiles();
int status = app.exec(); int status = app.exec();
//Shutdown //Shutdown

View File

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

View File

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

View File

@ -3,19 +3,6 @@
InstalledListModel::InstalledListModel(QObject* parent) InstalledListModel::InstalledListModel(QObject* parent)
: QAbstractListModel(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 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_id = id;
m_version = version; m_version = version;
m_wallpaperId = wallpaperId; m_wallpaperId = wallpaperId;

View File

@ -3,12 +3,14 @@
#include <QRect> #include <QRect>
#include <QString> #include <QString>
#include <QUrl>
class Profile { class Profile {
public: public:
Profile(); 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_id;
QString m_version = ""; QString m_version = "";
QString m_wallpaperId = ""; QString m_wallpaperId = "";

View File

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

View File

@ -8,8 +8,17 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
m_mlm = mlm; m_mlm = mlm;
m_ilm = ilm; m_ilm = ilm;
QFile configTmp; QFile configTmp;
QString appConfigLocation = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation); 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"); configTmp.setFileName(appConfigLocation + "/settings.json");
// App Settings // App Settings
@ -18,6 +27,7 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
createDefaultConfig(); createDefaultConfig();
} }
QJsonDocument configJsonDocument; QJsonDocument configJsonDocument;
QJsonParseError parseError; QJsonParseError parseError;
QJsonObject configObj; QJsonObject configObj;
@ -45,6 +55,37 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
return; 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_autostart = configObj.value("autostart").toBool();
m_highPriorityStart = configObj.value("highPriorityStart").toBool(); m_highPriorityStart = configObj.value("highPriorityStart").toBool();
m_sendStatistics = configObj.value("sendStatistics").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 profileName = activeProfilesTmp.at(i).toObject().value("profile").toString();
QString monitorID = activeProfilesTmp.at(i).toObject().value("monitorID").toString(); QString monitorID = activeProfilesTmp.at(i).toObject().value("monitorID").toString();
Profile profile; Profile profile;
if (!m_plm->getProfileByName(profileName, &profile)) if (!m_plm->getProfileByName(profileName, &profile))
continue; continue;

View File

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