5#include <QCoreApplication>
8#include <QProgressDialog>
15#include <klocalizedstring.h>
48 QImageReader reader(
m_path);
49 if (reader.read(&outImage)) {
51 if (outImage.isNull() || outImage.size().isEmpty()) {
52 warnFile.nospace() <<
"Got null image reading frame from file '" <<
m_path <<
"'";
58 warnFile.nospace() <<
"Error " << reader.error() <<
" reading frame from file '" <<
m_path
59 <<
"': " << reader.errorString();
75 if (inputFileCount == 0) {
79 int lastIndex = inputFileCount - 1;
102 if (instances != 0) {
148 outErrorMessage = i18n(
"No frame files found");
153 return encode(outErrorMessage);
180 Qt::DirectConnection);
188 Qt::DirectConnection);
193 [&errorCode](
const QString &errorMessage) {
196 Qt::DirectConnection);
201 Qt::DirectConnection);
203 QProgressDialog *progressDlg;
205 progressDlg =
nullptr;
207 progressDlg =
new QProgressDialog;
208 progressDlg->setLabelText(i18n(
"Rendering animation..."));
213 [progressDlg, frameCount = settings.
inputFiles.size()](
int frameNo) {
217 }
else if (frameNo >= frameCount) {
220 progress = qRound(qreal(frameNo) / qreal(frameCount) * 100.0);
222 progressDlg->setValue(progress);
223 QCoreApplication::processEvents();
225 Qt::DirectConnection);
227 &QProgressDialog::canceled,
230 Qt::DirectConnection);
232 QCoreApplication::processEvents();
253 Qt::QueuedConnection);
258 Qt::QueuedConnection);
263 Qt::QueuedConnection);
268 Qt::QueuedConnection);
273 Qt::QueuedConnection);
278 Qt::QueuedConnection);
281 runnable->setAutoDelete(
true);
282 QThreadPool::globalInstance()->start(runnable);
295 disconnect(runnable);
302 if (!supportedFormats) {
309 return *supportedFormats;
315 if (format->key() == key) {
329 if (androidRunnable) {
330 return androidRunnable;
337 return libavRunnable;
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)