1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-15 06:52:34 +02:00

Formatting

This commit is contained in:
Elias Steurer 2023-02-04 12:16:24 +01:00
parent e96f80c68c
commit 924819bb0b
4 changed files with 28 additions and 31 deletions

View File

@ -4,6 +4,9 @@
#include <QDebug>
#include <QDir>
#include <QDomDocument>
#include <QDomElement>
#include <QDomNodeList>
#include <QFile>
#include <QFontDatabase>
#include <QGuiApplication>
@ -28,9 +31,6 @@
#include <QVersionNumber>
#include <QtConcurrent/QtConcurrent>
#include <QtGlobal>
#include <QDomDocument>
#include <QDomElement>
#include <QDomNodeList>
#include "ScreenPlay/globalvariables.h"
#include "ScreenPlay/util.h"
@ -188,42 +188,41 @@ public slots:
QFile settingsPlist(homePath + "/Library/LaunchAgents/" + plistFileName);
if (settingsPlist.exists()) {
QDomDocument doc;
if (!doc.setContent(&settingsPlist)){
if (!doc.setContent(&settingsPlist)) {
settingsPlist.close();
return ;
}
settingsPlist.close();
QDomElement root = doc.firstChildElement();
QDomNodeList dictList = root.elementsByTagName("dict");
if(dictList.size() > 1 && dictList.size() < 1 ){
return;
}
settingsPlist.close();
QDomElement root = doc.firstChildElement();
QDomNodeList dictList = root.elementsByTagName("dict");
if (dictList.size() > 1 && dictList.size() < 1) {
return;
}
// Check if autostart and corresponding path is set and abort if so. This is needed since osx 13.0 Ventura
// because it displays an annoying message every time we change the file.
bool isCorrectPath = false;
bool isAutostartEnabled = false;
QDomNode dictNode = dictList.at(0);
if (dictNode.isElement()){
if (dictNode.isElement()) {
QDomElement dictElement = dictNode.toElement();
QDomNodeList keyList = dictElement.elementsByTagName("key");
for (int j = 0; j < keyList.size(); j++){
for (int j = 0; j < keyList.size(); j++) {
QDomNode keyNode = keyList.at(j);
if (keyNode.isElement()){
if (keyNode.isElement()) {
QDomElement keyElement = keyNode.toElement();
if (keyElement.text() == "ProgramArguments"){
if (keyElement.text() == "ProgramArguments") {
QDomNode valueNode = keyNode.nextSibling();
if (valueNode.isElement()){
if (valueNode.isElement()) {
QDomElement valueElement = valueNode.toElement();
QDomNodeList stringList = valueElement.elementsByTagName("string");
if (!stringList.isEmpty()){
if (!stringList.isEmpty()) {
QDomNode stringNode = stringList.at(0);
if (stringNode.isElement()){
if (stringNode.isElement()) {
QDomElement stringElement = stringNode.toElement();
const QString path = stringElement.text();
if(path == screenPlayPath){
if (path == screenPlayPath) {
isCorrectPath = true;
}
}
@ -234,18 +233,18 @@ public slots:
}
}
if (dictNode.isElement()){
if (dictNode.isElement()) {
QDomElement dictElement = dictNode.toElement();
QDomNodeList keyList = dictElement.elementsByTagName("key");
for (int j = 0; j < keyList.size(); j++){
for (int j = 0; j < keyList.size(); j++) {
QDomNode keyNode = keyList.at(j);
if (keyNode.isElement()){
if (keyNode.isElement()) {
QDomElement keyElement = keyNode.toElement();
if (keyElement.text() == "RunAtLoad"){
if (keyElement.text() == "RunAtLoad") {
QDomNode valueNode = keyNode.nextSibling();
if (valueNode.isElement()){
if (valueNode.isElement()) {
QDomElement valueElement = valueNode.toElement();
if (valueElement.tagName() == "true"){
if (valueElement.tagName() == "true") {
isAutostartEnabled = true;
}
}
@ -255,7 +254,7 @@ public slots:
}
// Nothing to do. Autostart has the same value and the path is also correct.
if(isAutostartEnabled == autostart && isCorrectPath)
if (isAutostartEnabled == autostart && isCorrectPath)
return;
if (!settingsPlist.remove()) {

View File

@ -47,8 +47,7 @@ int main(int argc, char* argv[])
// For testing purposes when starting the ScreenPlayWallpaper directly.
if (argumentList.length() == 1) {
window.setActiveScreensList({ 0 });
// window.setProjectPath("test");
window.setProjectPath("C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/2023_01_05_141855");
window.setProjectPath("test");
window.setAppID("test");
window.setVolume(1);
window.setFillMode("fill");

View File

@ -177,7 +177,6 @@ void BaseWindow::replaceWallpaper(
emit reloadGIF(oldType);
}
/*!
\brief QML Convenience function for global fade in
*/

View File

@ -1,8 +1,8 @@
// SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only
#include "ScreenPlayUtil/projectfile.h"
#include "winwindow.h"
#include <QtQml>
#include "ScreenPlayUtil/projectfile.h"
#include <QGuiApplication>
#include <QtQml>
#include <algorithm>
#include <iostream>
#include <vector>