mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-09-02 16:49:47 +02:00
Fix reserved argument path
Looks like this gets swallen in godot, so lets just use projectpath Remove duplicate godot export function that now lives in util
This commit is contained in:
parent
70e9b48abf
commit
2626226618
@ -206,9 +206,6 @@ public slots:
|
|||||||
emit isConnectedChanged(m_isConnected);
|
emit isConnectedChanged(m_isConnected);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
bool exportGodotProject();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::shared_ptr<GlobalVariables> m_globalVariables;
|
const std::shared_ptr<GlobalVariables> m_globalVariables;
|
||||||
std::unique_ptr<SDKConnection> m_connection;
|
std::unique_ptr<SDKConnection> m_connection;
|
||||||
@ -219,7 +216,7 @@ private:
|
|||||||
QVector<int> m_screenNumber;
|
QVector<int> m_screenNumber;
|
||||||
QProcess m_process;
|
QProcess m_process;
|
||||||
QString m_previewImage;
|
QString m_previewImage;
|
||||||
ContentTypes::InstalledType m_type;
|
ContentTypes::InstalledType m_type { ContentTypes::InstalledType::Unknown };
|
||||||
Video::FillMode m_fillMode;
|
Video::FillMode m_fillMode;
|
||||||
QString m_appID;
|
QString m_appID;
|
||||||
QString m_absolutePath;
|
QString m_absolutePath;
|
||||||
|
@ -123,7 +123,7 @@ private:
|
|||||||
QString m_previewImage;
|
QString m_previewImage;
|
||||||
QString m_appID;
|
QString m_appID;
|
||||||
QPoint m_position;
|
QPoint m_position;
|
||||||
ContentTypes::InstalledType m_type;
|
ContentTypes::InstalledType m_type { ContentTypes::InstalledType::Unknown };
|
||||||
QString m_absolutePath;
|
QString m_absolutePath;
|
||||||
QTimer m_pingAliveTimer;
|
QTimer m_pingAliveTimer;
|
||||||
QStringList m_appArgumentsList;
|
QStringList m_appArgumentsList;
|
||||||
|
@ -87,7 +87,7 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(
|
|||||||
|
|
||||||
m_appArgumentsList = QStringList {
|
m_appArgumentsList = QStringList {
|
||||||
"--screens", screens,
|
"--screens", screens,
|
||||||
"--path", m_absolutePath,
|
"--projectpath", m_absolutePath,
|
||||||
"--appID", m_appID,
|
"--appID", m_appID,
|
||||||
"--volume", QString::number(static_cast<double>(volume)),
|
"--volume", QString::number(static_cast<double>(volume)),
|
||||||
"--fillmode", QVariant::fromValue(fillMode).toString(),
|
"--fillmode", QVariant::fromValue(fillMode).toString(),
|
||||||
@ -110,10 +110,6 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(
|
|||||||
|
|
||||||
bool ScreenPlayWallpaper::start()
|
bool ScreenPlayWallpaper::start()
|
||||||
{
|
{
|
||||||
if (m_type == ContentTypes::InstalledType::GodotWallpaper) {
|
|
||||||
if (!exportGodotProject())
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_process.setArguments(m_appArgumentsList);
|
m_process.setArguments(m_appArgumentsList);
|
||||||
if (m_type == ContentTypes::InstalledType::GodotWallpaper) {
|
if (m_type == ContentTypes::InstalledType::GodotWallpaper) {
|
||||||
@ -308,80 +304,6 @@ bool ScreenPlayWallpaper::replace(
|
|||||||
emit requestSave();
|
emit requestSave();
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief .
|
|
||||||
*/
|
|
||||||
bool ScreenPlayWallpaper::exportGodotProject()
|
|
||||||
{
|
|
||||||
if (!m_projectJson.contains("version"))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
const quint64 version = m_projectJson.value("version").toInt();
|
|
||||||
const QString packageFileName = QString("project-v%1.zip").arg(version);
|
|
||||||
QFileInfo godotPackageFile(m_absolutePath + "/" + packageFileName);
|
|
||||||
// Skip reexport
|
|
||||||
if (godotPackageFile.exists())
|
|
||||||
return true;
|
|
||||||
|
|
||||||
qInfo() << "No suitable version found for Godot package" << packageFileName << " at" << godotPackageFile.absoluteFilePath() << " exporting a new pck as zip.";
|
|
||||||
|
|
||||||
// Prepare the Godot export command
|
|
||||||
const QList<QString>
|
|
||||||
godotCmd
|
|
||||||
= { "--export-pack", "--headless", "Windows Desktop", packageFileName };
|
|
||||||
|
|
||||||
// Create QProcess instance to run the command
|
|
||||||
QProcess process;
|
|
||||||
|
|
||||||
// Set the working directory to the given absolute path
|
|
||||||
process.setWorkingDirectory(m_absolutePath);
|
|
||||||
process.setProgram(m_globalVariables->godotEditorExecutablePath().toString());
|
|
||||||
// Start the Godot export process
|
|
||||||
process.setArguments(godotCmd);
|
|
||||||
process.start();
|
|
||||||
|
|
||||||
// Wait for the process to finish or timeout
|
|
||||||
const int timeoutMilliseconds = 30000;
|
|
||||||
if (!process.waitForFinished(timeoutMilliseconds)) {
|
|
||||||
qCritical() << "Godot export process timed out or failed to start.";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Capture the standard output and error
|
|
||||||
QString stdoutString = process.readAllStandardOutput();
|
|
||||||
QString stderrString = process.readAllStandardError();
|
|
||||||
|
|
||||||
// If you want to print the output to the console:
|
|
||||||
if (!stdoutString.isEmpty())
|
|
||||||
qDebug() << "Output:" << stdoutString;
|
|
||||||
if (!stderrString.isEmpty())
|
|
||||||
qDebug() << "Error:" << stderrString;
|
|
||||||
|
|
||||||
// Check for errors
|
|
||||||
if (process.exitStatus() != QProcess::NormalExit || process.exitCode() != 0) {
|
|
||||||
qCritical() << "Failed to export Godot project. Error:" << process.errorString();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if the project.zip file was created
|
|
||||||
QString zipPath = QDir(m_absolutePath).filePath(packageFileName);
|
|
||||||
if (!QFile::exists(zipPath)) {
|
|
||||||
qCritical() << "Expected export file (" << packageFileName << ") was not created.";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Optional: Verify if the .zip file is valid
|
|
||||||
// (A complete verification would involve extracting the file and checking its contents,
|
|
||||||
// but for simplicity, we're just checking its size here)
|
|
||||||
QFileInfo zipInfo(zipPath);
|
|
||||||
if (zipInfo.size() <= 0) {
|
|
||||||
qCritical() << "The exported " << packageFileName << " file seems to be invalid.";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_screenplaywallpaper.cpp"
|
#include "moc_screenplaywallpaper.cpp"
|
||||||
|
@ -46,7 +46,7 @@ ScreenPlayWidget::ScreenPlayWidget(
|
|||||||
m_projectSettingsListModel.init(type, projectSettingsListModelProperties);
|
m_projectSettingsListModel.init(type, projectSettingsListModelProperties);
|
||||||
|
|
||||||
m_appArgumentsList = QStringList {
|
m_appArgumentsList = QStringList {
|
||||||
"--path",
|
"--projectpath",
|
||||||
m_absolutePath,
|
m_absolutePath,
|
||||||
"--appID",
|
"--appID",
|
||||||
m_appID,
|
m_appID,
|
||||||
|
@ -94,7 +94,7 @@ func parse_args():
|
|||||||
|
|
||||||
# Check if only the default argument is provided
|
# Check if only the default argument is provided
|
||||||
if args.size() == 1:
|
if args.size() == 1:
|
||||||
args = ["--path",
|
args = ["--projectpath",
|
||||||
#"C:/Code/cpp/ScreenPlay/ScreenPlay/Content/wallpaper_godot_fjord",
|
#"C:/Code/cpp/ScreenPlay/ScreenPlay/Content/wallpaper_godot_fjord",
|
||||||
"C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/2023_12_08_205323",
|
"C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/2023_12_08_205323",
|
||||||
"--appID", "qmz9lq4wglox5DdYaXumVgRSDeZYAUjC",
|
"--appID", "qmz9lq4wglox5DdYaXumVgRSDeZYAUjC",
|
||||||
@ -124,7 +124,7 @@ func parse_args():
|
|||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
# Check for all required arguments
|
# Check for all required arguments
|
||||||
var required_args = ["screens", "path", "appID", "volume", "check", "projectPackageFile"]
|
var required_args = ["screens", "projectpath", "appID", "volume", "check", "projectPackageFile"]
|
||||||
for req_arg in required_args:
|
for req_arg in required_args:
|
||||||
if not arg_dict.has(req_arg):
|
if not arg_dict.has(req_arg):
|
||||||
print("Missing argument:", req_arg)
|
print("Missing argument:", req_arg)
|
||||||
@ -147,7 +147,7 @@ func parse_args():
|
|||||||
return false
|
return false
|
||||||
|
|
||||||
# Assign the values to the respective properties
|
# Assign the values to the respective properties
|
||||||
screen_play_wallpaper.set_projectPath(arg_dict["path"])
|
screen_play_wallpaper.set_projectPath(arg_dict["projectpath"])
|
||||||
screen_play_wallpaper.set_appID(arg_dict["appID"])
|
screen_play_wallpaper.set_appID(arg_dict["appID"])
|
||||||
screen_play_wallpaper.set_volume(float(arg_dict["volume"]))
|
screen_play_wallpaper.set_volume(float(arg_dict["volume"]))
|
||||||
screen_play_wallpaper.set_projectPackageFile(arg_dict["projectPackageFile"])
|
screen_play_wallpaper.set_projectPackageFile(arg_dict["projectPackageFile"])
|
||||||
|
@ -43,7 +43,6 @@ int main(int argc, char* argv[])
|
|||||||
QCoreApplication::setApplicationVersion("1.0");
|
QCoreApplication::setApplicationVersion("1.0");
|
||||||
std::unique_ptr<const ScreenPlayUtil::LoggingHandler> logging;
|
std::unique_ptr<const ScreenPlayUtil::LoggingHandler> logging;
|
||||||
std::unique_ptr<BaseWindow> window;
|
std::unique_ptr<BaseWindow> window;
|
||||||
const auto platformName = QGuiApplication::platformName();
|
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
window = std::make_unique<WinWindow>();
|
window = std::make_unique<WinWindow>();
|
||||||
@ -78,7 +77,7 @@ int main(int argc, char* argv[])
|
|||||||
QStringList {
|
QStringList {
|
||||||
// Docs: Don't forget that arguments must start with the name of the executable (ignored, though).
|
// Docs: Don't forget that arguments must start with the name of the executable (ignored, though).
|
||||||
QGuiApplication::applicationName(),
|
QGuiApplication::applicationName(),
|
||||||
"--path", projectPath,
|
"--projectpath", projectPath,
|
||||||
"--appID", "qmz9lq4wglox5DdYaXumVgRSDeZYAUjC",
|
"--appID", "qmz9lq4wglox5DdYaXumVgRSDeZYAUjC",
|
||||||
"--screens", "{0}",
|
"--screens", "{0}",
|
||||||
"--volume", "1",
|
"--volume", "1",
|
||||||
@ -94,7 +93,7 @@ int main(int argc, char* argv[])
|
|||||||
parser.addHelpOption();
|
parser.addHelpOption();
|
||||||
|
|
||||||
// Define the command line options
|
// Define the command line options
|
||||||
QCommandLineOption pathOption("path", "Set the project path.", "path");
|
QCommandLineOption pathOption("projectpath", "Set the project path.", "projectpath");
|
||||||
QCommandLineOption appIDOption("appID", "Set the application ID.", "appID");
|
QCommandLineOption appIDOption("appID", "Set the application ID.", "appID");
|
||||||
QCommandLineOption screensOption("screens", "Set screens parameter.", "screens");
|
QCommandLineOption screensOption("screens", "Set screens parameter.", "screens");
|
||||||
QCommandLineOption volumeOption("volume", "Set volume level.", "volume");
|
QCommandLineOption volumeOption("volume", "Set volume level.", "volume");
|
||||||
|
@ -68,7 +68,7 @@ int main(int argc, char* argv[])
|
|||||||
QStringList {
|
QStringList {
|
||||||
// Docs: Don't forget that arguments must start with the name of the executable (ignored, though).
|
// Docs: Don't forget that arguments must start with the name of the executable (ignored, though).
|
||||||
QGuiApplication::applicationName(),
|
QGuiApplication::applicationName(),
|
||||||
"--path", projectPath,
|
"--projectpath", projectPath,
|
||||||
"--appID", "qmz9lq4wglox5DdYaXumVgRSDeZYAUjC",
|
"--appID", "qmz9lq4wglox5DdYaXumVgRSDeZYAUjC",
|
||||||
"--type", type,
|
"--type", type,
|
||||||
"--posX", QString::number(center.x()),
|
"--posX", QString::number(center.x()),
|
||||||
@ -81,7 +81,7 @@ int main(int argc, char* argv[])
|
|||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
parser.setApplicationDescription("ScreenPlay Widget");
|
parser.setApplicationDescription("ScreenPlay Widget");
|
||||||
parser.addHelpOption();
|
parser.addHelpOption();
|
||||||
QCommandLineOption pathOption("path", "Project path", "path");
|
QCommandLineOption pathOption("projectpath", "Project path", "projectpath");
|
||||||
QCommandLineOption appIDOption("appID", "Application ID", "appid");
|
QCommandLineOption appIDOption("appID", "Application ID", "appid");
|
||||||
QCommandLineOption typeOption("type", "Content type", "type");
|
QCommandLineOption typeOption("type", "Content type", "type");
|
||||||
QCommandLineOption posXOption("posX", "X position", "positionX");
|
QCommandLineOption posXOption("posX", "X position", "positionX");
|
||||||
|
Loading…
Reference in New Issue
Block a user