2021-09-28 21:44:09 +02:00
|
|
|
#include <QFile>
|
|
|
|
#include <QDesktopServices>
|
|
|
|
#include <QSettings>
|
|
|
|
#include <QProcess>
|
|
|
|
#include <QUrl>
|
|
|
|
#include <QLocalSocket>
|
|
|
|
#include <QDataStream>
|
|
|
|
#include "ipcserver.h"
|
2022-04-24 12:34:34 +02:00
|
|
|
#include "common.h"
|
|
|
|
#include "databasefactory.h"
|
|
|
|
#include "../shared/logger.h"
|
2021-09-28 21:44:09 +02:00
|
|
|
|
|
|
|
IpcServer::IpcServer()
|
|
|
|
{
|
|
|
|
connect(&this->spawningServer, &QLocalServer::newConnection, this, &IpcServer::spawnerNewConnection);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IpcServer::startSpawner(QString socketPath)
|
|
|
|
{
|
|
|
|
QFile::remove(socketPath);
|
|
|
|
return this->spawningServer.listen(socketPath);
|
|
|
|
}
|
|
|
|
|
|
|
|
void IpcServer::spawnerNewConnection()
|
|
|
|
{
|
|
|
|
QScopedPointer<QLocalSocket> socket{this->spawningServer.nextPendingConnection()};
|
|
|
|
if(!socket.isNull())
|
|
|
|
{
|
|
|
|
if(!socket->waitForReadyRead())
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
QDataStream stream(socket.get());
|
|
|
|
IPCCommand command;
|
|
|
|
stream >> command;
|
2022-05-17 19:22:59 +02:00
|
|
|
if(command == GeneratePreviews)
|
2021-09-28 21:44:09 +02:00
|
|
|
{
|
2022-05-17 19:22:59 +02:00
|
|
|
RenderConfig renderConfig;
|
|
|
|
QVector<RenderTarget> targets;
|
|
|
|
stream >> renderConfig;
|
|
|
|
stream >> targets;
|
2021-09-28 21:44:09 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|