diff --git a/gui/ipcpreviewclient.cpp b/gui/ipcpreviewclient.cpp index 0a33341..9107d7f 100644 --- a/gui/ipcpreviewclient.cpp +++ b/gui/ipcpreviewclient.cpp @@ -61,7 +61,8 @@ void IPCPreviewClient::start(RenderConfig config, const QVector &t if(!connect() || !socket->isOpen()) { - // TODO: ERROR + emit error("Could not connect to IPC worker"); + return; } if(socket->isOpen() && socket->isWritable()) @@ -88,7 +89,8 @@ void IPCPreviewClient::start(RenderConfig config, const QVector &t } else { - // TODO: ERROR + emit error("Error while trying to process previews: " + socket->errorString()); + return; } int processed = 0; @@ -107,7 +109,7 @@ void IPCPreviewClient::start(RenderConfig config, const QVector &t } if(processed != targets.count()) { - // TODO: ERROR + emit error("IPC worker didn't send enough previews. This is a bug, please report"); } } socket->disconnectFromServer(); @@ -118,7 +120,8 @@ void IPCPreviewClient::stopGeneration() { if(!connect() || !socket->isOpen()) { - // TODO: ERROR + emit error("Could not connect to IPC worker"); + return; } QDataStream stream(socket); stream << StopGeneratePreviews; diff --git a/gui/ipcpreviewclient.h b/gui/ipcpreviewclient.h index d5cc743..dfb0e35 100644 --- a/gui/ipcpreviewclient.h +++ b/gui/ipcpreviewclient.h @@ -31,6 +31,7 @@ class IPCPreviewClient : public QObject signals: void previewReceived(QSharedPointer previewResult, unsigned int currentPreviewGeneration); void finished(); + void error(QString); }; #endif // IPCPREVIEWCLIENT_H diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index a836a06..82183de 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -34,6 +34,12 @@ MainWindow::MainWindow(QWidget *parent, QString socketPath) : QMainWindow(parent Qt::QueuedConnection); connect(&ipcPreviewClient, &IPCPreviewClient::finished, this, [&] { this->ui->previewProcessBar->setValue(this->ui->previewProcessBar->maximum()); }); + connect(&ipcPreviewClient, &IPCPreviewClient::error, this, + [this](QString msg) + { + qCritical() << msg << Qt::endl; + QMessageBox::critical(this, "IPC error", msg); + }); connect(this, &MainWindow::startIpcPreviews, &ipcPreviewClient, &IPCPreviewClient::startGeneration, Qt::QueuedConnection);