gui: Begin simple IPC error reporting
This commit is contained in:
parent
ee19692a7a
commit
a43ab169b5
@ -61,7 +61,8 @@ void IPCPreviewClient::start(RenderConfig config, const QVector<RenderTarget> &t
|
|||||||
|
|
||||||
if(!connect() || !socket->isOpen())
|
if(!connect() || !socket->isOpen())
|
||||||
{
|
{
|
||||||
// TODO: ERROR
|
emit error("Could not connect to IPC worker");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(socket->isOpen() && socket->isWritable())
|
if(socket->isOpen() && socket->isWritable())
|
||||||
@ -88,7 +89,8 @@ void IPCPreviewClient::start(RenderConfig config, const QVector<RenderTarget> &t
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO: ERROR
|
emit error("Error while trying to process previews: " + socket->errorString());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int processed = 0;
|
int processed = 0;
|
||||||
@ -107,7 +109,7 @@ void IPCPreviewClient::start(RenderConfig config, const QVector<RenderTarget> &t
|
|||||||
}
|
}
|
||||||
if(processed != targets.count())
|
if(processed != targets.count())
|
||||||
{
|
{
|
||||||
// TODO: ERROR
|
emit error("IPC worker didn't send enough previews. This is a bug, please report");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
socket->disconnectFromServer();
|
socket->disconnectFromServer();
|
||||||
@ -118,7 +120,8 @@ void IPCPreviewClient::stopGeneration()
|
|||||||
{
|
{
|
||||||
if(!connect() || !socket->isOpen())
|
if(!connect() || !socket->isOpen())
|
||||||
{
|
{
|
||||||
// TODO: ERROR
|
emit error("Could not connect to IPC worker");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
QDataStream stream(socket);
|
QDataStream stream(socket);
|
||||||
stream << StopGeneratePreviews;
|
stream << StopGeneratePreviews;
|
||||||
|
@ -31,6 +31,7 @@ class IPCPreviewClient : public QObject
|
|||||||
signals:
|
signals:
|
||||||
void previewReceived(QSharedPointer<PreviewResult> previewResult, unsigned int currentPreviewGeneration);
|
void previewReceived(QSharedPointer<PreviewResult> previewResult, unsigned int currentPreviewGeneration);
|
||||||
void finished();
|
void finished();
|
||||||
|
void error(QString);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // IPCPREVIEWCLIENT_H
|
#endif // IPCPREVIEWCLIENT_H
|
||||||
|
@ -34,6 +34,12 @@ MainWindow::MainWindow(QWidget *parent, QString socketPath) : QMainWindow(parent
|
|||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
connect(&ipcPreviewClient, &IPCPreviewClient::finished, this,
|
connect(&ipcPreviewClient, &IPCPreviewClient::finished, this,
|
||||||
[&] { this->ui->previewProcessBar->setValue(this->ui->previewProcessBar->maximum()); });
|
[&] { 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,
|
connect(this, &MainWindow::startIpcPreviews, &ipcPreviewClient, &IPCPreviewClient::startGeneration,
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
|
Loading…
Reference in New Issue
Block a user