Commit 6bf5a581 authored by Halla Rempt's avatar Halla Rempt

Add a filetype selector for the image sequence

This is only enabled if render to video is disabled, since we only
do .png with ffmpeg
parent a888311a
......@@ -33,6 +33,7 @@
#include <kis_image.h>
#include <kis_image_animation_interface.h>
#include <kis_time_range.h>
#include <KisImportExportManager.h>
DlgAnimaterionRenderer::DlgAnimaterionRenderer(KisImageWSP image, QWidget *parent)
: KoDialog(parent)
......@@ -45,6 +46,7 @@ DlgAnimaterionRenderer::DlgAnimaterionRenderer(KisImageWSP image, QWidget *paren
m_page = new WdgAnimaterionRenderer(this);
m_page->layout()->setMargin(0);
m_page->dirRequester->setMode(KoFileDialog::OpenDirectory);
m_page->dirRequester->setFileName(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
m_page->intStart->setMinimum(image->animationInterface()->fullClipRange().start());
m_page->intStart->setMaximum(image->animationInterface()->fullClipRange().end());
......@@ -54,6 +56,20 @@ DlgAnimaterionRenderer::DlgAnimaterionRenderer(KisImageWSP image, QWidget *paren
m_page->intEnd->setMaximum(image->animationInterface()->fullClipRange().end());
m_page->intEnd->setValue(image->animationInterface()->playbackRange().end());
QStringList mimes = KisImportExportManager::mimeFilter(KisImportExportManager::Export);
mimes.sort();
Q_FOREACH(const QString &mime, mimes) {
QString description = KisMimeDatabase::descriptionForMimeType(mime);
if (description.isEmpty()) {
description = mime;
}
m_page->cmbMimetype->addItem(description, mime);
if (mime == "image/png") {
m_page->cmbMimetype->setCurrentIndex(m_page->cmbMimetype->count() - 1);
}
}
setMainWidget(m_page);
resize(m_page->sizeHint());
......@@ -91,6 +107,7 @@ DlgAnimaterionRenderer::DlgAnimaterionRenderer(KisImageWSP image, QWidget *paren
}
connect(m_page->cmbRenderType, SIGNAL(activated(int)), this, SLOT(selectRenderType(int)));
connect(m_page->grpRender, SIGNAL(toggled(bool)), this, SLOT(toggleSequenceType(bool)));
}
DlgAnimaterionRenderer::~DlgAnimaterionRenderer()
......@@ -118,9 +135,14 @@ void DlgAnimaterionRenderer::setSequenceConfiguration(KisPropertiesConfiguration
m_page->sequenceStart->setValue(cfg->getInt("sequence_start", m_image->animationInterface()->playbackRange().start()));
}
bool DlgAnimaterionRenderer::renderToVideo() const
{
return m_page->grpRender->isChecked();
}
KisPropertiesConfigurationSP DlgAnimaterionRenderer::getVideoConfiguration() const
{
if (!m_page->grpRenderOptions->isChecked()) {
if (!m_page->grpRender->isChecked()) {
return 0;
}
KisPropertiesConfigurationSP cfg = new KisPropertiesConfiguration();
......@@ -136,7 +158,7 @@ void DlgAnimaterionRenderer::setVideoConfiguration(KisPropertiesConfigurationSP
KisPropertiesConfigurationSP DlgAnimaterionRenderer::getencoderConfiguration() const
{
if (!m_page->grpRenderOptions->isChecked()) {
if (!m_page->grpRender->isChecked()) {
return 0;
}
KisPropertiesConfigurationSP cfg = new KisPropertiesConfiguration();
......@@ -161,3 +183,14 @@ void DlgAnimaterionRenderer::selectRenderType(int renderType)
// m_configWidgets[renderType]->setVisible(true);
// }
}
void DlgAnimaterionRenderer::toggleSequenceType(bool toggle)
{
m_page->cmbMimetype->setEnabled(!toggle);
for (int i = 0; i < m_page->cmbMimetype->count(); ++i) {
if (m_page->cmbMimetype->itemData(i).toString() == "image/png") {
m_page->cmbMimetype->setCurrentIndex(i);
break;
}
}
}
......@@ -53,6 +53,8 @@ public:
KisPropertiesConfigurationSP getSequenceConfiguration() const;
void setSequenceConfiguration(KisPropertiesConfigurationSP cfg) const;
bool renderToVideo() const;
KisPropertiesConfigurationSP getVideoConfiguration() const;
void setVideoConfiguration(KisPropertiesConfigurationSP cfg) const;
......@@ -62,6 +64,7 @@ public:
private Q_SLOTS:
void selectRenderType(int renderType);
void toggleSequenceType(bool toggle);
private:
......@@ -69,7 +72,6 @@ private:
WdgAnimaterionRenderer *m_page;
QList<QSharedPointer<KisImportExportFilter>> m_filters;
QList<QWidget> m_configWidgets;
};
#endif // DLG_ANIMATIONRENDERERIMAGE
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>460</width>
<height>581</height>
<height>719</height>
</rect>
</property>
<property name="windowTitle">
......@@ -19,80 +19,120 @@
<property name="title">
<string>Image Sequence</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
<widget class="QLabel" name="label">
<property name="text">
<string>Base name:</string>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Base name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="txtBasename">
<property name="text">
<string>frame</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Render location:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KisFileNameRequester" name="dirRequester" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>First frame:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="intStart"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Last frame:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="intEnd"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Naming sequence starts with:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="sequenceStart"/>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="txtBasename">
<property name="text">
<string>frame</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>File format:</string>
</property>
<property name="buddy">
<cstring>label_8</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="cmbMimetype">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Select the file format for the image sequence. If you want to render to video or animated gif, you can only select PNG</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Render location:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="KisFileNameRequester" name="dirRequester" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>First frame:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QSpinBox" name="intStart">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Last frame:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QSpinBox" name="intEnd">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Naming sequence starts with:</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QSpinBox" name="sequenceStart">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<widget class="QGroupBox" name="grpRender">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
......@@ -111,24 +151,24 @@
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Render as:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QComboBox" name="cmbRenderType"/>
</item>
<item row="1" column="0">
<item row="2" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>File:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="KisFileNameRequester" name="videoFilename" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
......@@ -138,7 +178,7 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<widget class="QGroupBox" name="grpRenderOptions">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
......@@ -151,7 +191,7 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="chkDeleteSequence">
<property name="text">
<string>Delete Sequence After Rendering</string>
......@@ -176,6 +216,16 @@
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>txtBasename</tabstop>
<tabstop>cmbMimetype</tabstop>
<tabstop>intStart</tabstop>
<tabstop>intEnd</tabstop>
<tabstop>sequenceStart</tabstop>
<tabstop>grpRender</tabstop>
<tabstop>cmbRenderType</tabstop>
<tabstop>chkDeleteSequence</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
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