Commit a91bc866 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Fix setting the codec based on the mimetype

parent 7b13d14c
......@@ -282,8 +282,8 @@ void DlgAnimationRenderer::selectRenderType()
if (filter) {
m_encoderConfigWidget = filter->createConfigurationWidget(0, KisDocument::nativeFormatMimeType(), mimetype.toLatin1());
if (m_encoderConfigWidget) {
m_encoderConfigWidget->setConfiguration(filter->lastSavedConfiguration());
KoDialog dlg;
m_encoderConfigWidget->setConfiguration(filter->lastSavedConfiguration("", mimetype.toLatin1()));
KoDialog dlg(this);
dlg.setMainWidget(m_encoderConfigWidget);
dlg.setButtons(KoDialog::Ok | KoDialog::Cancel);
if (!dlg.exec()) {
......@@ -325,8 +325,8 @@ void DlgAnimationRenderer::sequenceMimeTypeSelected()
if (filter) {
m_frameExportConfigWidget = filter->createConfigurationWidget(0, KisDocument::nativeFormatMimeType(), mimetype.toLatin1());
if (m_frameExportConfigWidget) {
m_frameExportConfigWidget->setConfiguration(filter->lastSavedConfiguration());
KoDialog dlg;
m_frameExportConfigWidget->setConfiguration(filter->lastSavedConfiguration("", mimetype.toLatin1()));
KoDialog dlg(this);
dlg.setMainWidget(m_frameExportConfigWidget);
dlg.setButtons(KoDialog::Ok | KoDialog::Cancel);
if (!dlg.exec()) {
......
......@@ -27,6 +27,7 @@
#include <QFileInfo>
#include <QApplication>
#include <kis_debug.h>
#include <KisImportExportManager.h>
#include <KisFilterChain.h>
#include <KoColorSpaceConstants.h>
......@@ -37,11 +38,13 @@
#include <kis_group_layer.h>
#include <kis_paint_layer.h>
#include <kis_paint_device.h>
#include <kis_config.h>
#include <kis_cursor_override_hijacker.h>
#include "video_saver.h"
#include "video_export_options_dialog.h"
#include "kis_cursor_override_hijacker.h"
K_PLUGIN_FACTORY_WITH_JSON(KisVideoExportFactory, "krita_video_export.json", registerPlugin<KisVideoExport>();)
......@@ -79,10 +82,7 @@ KisImportExportFilter::ConversionStatus KisVideoExport::convert(const QByteArray
QMessageBox::critical(KisPart::instance()->currentMainwindow(),
i18n("Video Export Error"),
warningMessage);
} else {
qWarning() << "WARNING:" << warningMessage;
}
return KisImportExportFilter::UsageError;
}
......@@ -104,6 +104,7 @@ KisImportExportFilter::ConversionStatus KisVideoExport::convert(const QByteArray
KisPropertiesConfigurationSP KisVideoExport::defaultConfiguration(const QByteArray &from, const QByteArray &to) const
{
Q_UNUSED(from);
Q_ASSERT(!to.isEmpty());
KisPropertiesConfigurationSP cfg(new KisPropertiesConfiguration());
......@@ -120,7 +121,16 @@ KisPropertiesConfigurationSP KisVideoExport::defaultConfiguration(const QByteArr
else if (to == "video/x-matroska" || to == "video/mp4") {
cfg->setProperty("CodecIndex", VideoExportOptionsDialog::CODEC_H264);
}
cfg->setProperty("mimetype", to);
return cfg;
}
KisPropertiesConfigurationSP KisVideoExport::lastSavedConfiguration(const QByteArray &from, const QByteArray &to) const
{
KisPropertiesConfigurationSP cfg = defaultConfiguration(from, to);
QString filterConfig = KisConfig().exportConfiguration("FFMPEG_CONFIG");
cfg->fromXML(filterConfig, false);
return cfg;
}
......
......@@ -33,8 +33,8 @@ public:
public:
virtual KisImportExportFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to, KisPropertiesConfigurationSP configuration = 0);
KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from = "", const QByteArray& to = "") const;
KisPropertiesConfigurationSP defaultConfiguration(const QByteArray& from, const QByteArray& to) const;
KisPropertiesConfigurationSP lastSavedConfiguration(const QByteArray &from, const QByteArray &to) const;
KisConfigWidget *createConfigurationWidget(QWidget *parent, const QByteArray& from = "", const QByteArray& to = "") const;
};
......
......@@ -200,10 +200,11 @@ void VideoExportOptionsDialog::setConfiguration(const KisPropertiesConfiguration
ui->intBitrate->setValue(m_d->defaultBitrate);
m_d->defaultCustomLine = cfg->getString("CustomLineValue", "");
ui->txtCustomLine->setText(m_d->defaultCustomLine);
if (cfg->hasProperty("CodecIndex")) {
setCodec((VideoExportOptionsDialog::CodecIndex)cfg->getInt("CodecIndex"));
}
else {
if (cfg->getString("mimetype") == "video/ogg") {
ui->cmbCodec->setEnabled(false);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment