# HG changeset patch # User Wuzzy # Date 1547765160 -3600 # Node ID 8ffa0c27f4340475c5977b9b6b39fe1c8f7055c3 # Parent a049926fcdd337454a4ff8c0c64c22623f086e1a Show error message in frontend if video encoding failed in engine diff -r a049926fcdd3 -r 8ffa0c27f434 QTfrontend/net/recorder.cpp --- a/QTfrontend/net/recorder.cpp Thu Jan 17 22:48:14 2019 +0100 +++ b/QTfrontend/net/recorder.cpp Thu Jan 17 23:46:00 2019 +0100 @@ -23,6 +23,7 @@ #include "gameuiconfig.h" #include "hwconsts.h" #include "game.h" +#include "util/MessageDialog.h" #include "LibavInteraction.h" // Encoding is memory expensive process, so we need to limit maximum number @@ -76,6 +77,16 @@ case 'v': finished = true; break; + case 'E': + int size = msg.size(); + emit ErrorMessage( + tr("A fatal ERROR occured while processing the video recording! " + "The video could not be saved.\n\n" + "As a workaround, you could try to reset the Hedgewars video recorder settings to the defaults.\n\n" + "To report this error, please click the 'Feedback' button in the main menu!\n\n" + "Last engine message:\n%1") + .arg(QString::fromUtf8(msg.mid(2).left(size - 4)))); + return; } } } diff -r a049926fcdd3 -r 8ffa0c27f434 QTfrontend/net/recorder.h --- a/QTfrontend/net/recorder.h Thu Jan 17 22:48:14 2019 +0100 +++ b/QTfrontend/net/recorder.h Thu Jan 17 23:46:00 2019 +0100 @@ -51,6 +51,7 @@ signals: void onProgress(float progress); // 0 < progress < 1 void encodingFinished(bool success); + void ErrorMessage(const QString &); private: bool finished; diff -r a049926fcdd3 -r 8ffa0c27f434 QTfrontend/ui/page/pagevideos.cpp --- a/QTfrontend/ui/page/pagevideos.cpp Thu Jan 17 22:48:14 2019 +0100 +++ b/QTfrontend/ui/page/pagevideos.cpp Thu Jan 17 23:46:00 2019 +0100 @@ -48,6 +48,7 @@ #include "gameuiconfig.h" #include "recorder.h" #include "ask_quit.h" +#include "util/MessageDialog.h" static const QSize ThumbnailSize(350, 350*3/5); @@ -315,6 +316,7 @@ progressBar->setValue(0); connect(pRecorder, SIGNAL(onProgress(float)), this, SLOT(updateProgress(float))); connect(pRecorder, SIGNAL(encodingFinished(bool)), this, SLOT(encodingFinished(bool))); + connect(pRecorder, SIGNAL(ErrorMessage(const QString &)), this, SLOT(ShowFatalErrorMessage(const QString &)), Qt::QueuedConnection); filesTable->setCellWidget(row, vcProgress, progressBar); numRecorders++; @@ -742,3 +744,8 @@ } } +void PageVideos::ShowFatalErrorMessage(const QString & msg) +{ + MessageDialog::ShowFatalMessage(msg, this); +} + diff -r a049926fcdd3 -r 8ffa0c27f434 QTfrontend/ui/page/pagevideos.h --- a/QTfrontend/ui/page/pagevideos.h Thu Jan 17 22:48:14 2019 +0100 +++ b/QTfrontend/ui/page/pagevideos.h Thu Jan 17 23:46:00 2019 +0100 @@ -86,6 +86,7 @@ void deleteSelectedFiles(); void openVideosDirectory(); void updateFileList(const QString & path); + void ShowFatalErrorMessage(const QString & msg); }; #endif // PAGE_VIDEOS_H