void EffectStackEdit::setFrameSize(QPoint p)
{
m_frameSize = p;
+ QDomNodeList namenode = m_params.elementsByTagName("parameter");
+ for (int i = 0;i < namenode.count() ;i++) {
+ QDomNode pa = namenode.item(i);
+ QDomNode na = pa.firstChildElement("name");
+ QString type = pa.attributes().namedItem("type").nodeValue();
+ QString paramName = i18n(na.toElement().text().toUtf8().data());
+
+ if (type == "geometry") {
+ Geometryval *geom = ((Geometryval*)m_valueItems[paramName+"geometry"]);
+ geom->setFrameSize(m_frameSize);
+ break;
+ }
+ }
+
}
void EffectStackEdit::updateProjectFormat(MltVideoProfile profile, Timecode t)
m_view->value_height->setValue(m_frameSize.y());
}
}
+
+void Geometryval::setFrameSize(QPoint p)
+{
+ m_frameSize = p;
+}
public:
explicit Geometryval(const MltVideoProfile profile, QPoint frame_size, QWidget* parent = 0);
QDomElement getParamDesc();
+ void setFrameSize(QPoint p);
private:
Ui::Geometryval m_ui;
//m_clipManager->slotEditTextClipFile(id, dia_ui->xml().toString());
QMap <QString, QString> newprops;
newprops.insert("xmldata", dia_ui->xml().toString());
+ newprops.insert("frame_size", QString::number(pix.width()) + 'x' + QString::number(pix.height()));
EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
m_activeDocument->commandStack()->push(command);
m_clipMonitor->refreshMonitor(true);
QDomDocument TitleWidget::xml()
{
- return m_titledocument.xml(m_startViewport, m_endViewport);
+ QDomDocument doc = m_titledocument.xml(m_startViewport, m_endViewport);
+ if (cropImage->isChecked()) {
+ doc.documentElement().setAttribute("crop", 1);
+ }
+ return doc;
}
void TitleWidget::setXml(QDomDocument doc)
{
m_count = m_titledocument.loadFromXml(doc, m_startViewport, m_endViewport);
+ QDomElement e = doc.documentElement();
+ cropImage->setChecked(e.hasAttribute("crop"));
m_transformations.clear();
QList <QGraphicsItem *> items = graphicsView->scene()->items();
const double PI = 4.0 * atan(1.0);
QImage TitleWidget::renderedPixmap()
{
- QImage pix(m_frameWidth, m_frameHeight, QImage::Format_ARGB32);
+ int minX = 0;
+ int minY = 0;
+ int maxX = m_frameWidth;
+ int maxY = m_frameHeight;
+ if (!cropImage->isChecked()) {
+ m_scene->removeItem(m_startViewport);
+ m_scene->removeItem(m_endViewport);
+ QRect boundingRect = m_scene->itemsBoundingRect().toRect();
+ if (boundingRect.left() < 0) minX = boundingRect.left();
+ if (boundingRect.top() < 0) minY = boundingRect.top();
+ if (boundingRect.right() > maxX) maxX = boundingRect.right();
+ if (boundingRect.bottom() > maxY) maxY = boundingRect.bottom();
+ if (minX < 0) {
+ maxX = maxX - minX;
+ }
+ if (minY < 0) {
+ maxY = maxY - minY;
+ }
+ }
+
+ QImage pix(maxX, maxY, QImage::Format_ARGB32);
pix.fill(Qt::transparent);
QPainter painter(&pix);
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::HighQualityAntialiasing);
m_endViewport->setVisible(false);
m_frameImage->setVisible(false);
- m_scene->render(&painter, QRectF(), QRectF(0, 0, m_frameWidth, m_frameHeight));
+ m_scene->render(&painter, QRectF(), QRectF(minX, minY, maxX - minX, maxY - minY));
painter.end();
m_frameBorder->setPen(framepen);
m_startViewport->setVisible(true);
titleConfig.writeEntry("background_color", kcolorbutton->color());
titleConfig.writeEntry("background_alpha", horizontalSlider->value());
+
+ titleConfig.writeEntry("crop_image", cropImage->isChecked());
//! \todo Not sure if I should sync - it is probably safe to do it
config->sync();
kcolorbutton->setColor(titleConfig.readEntry("background_color", kcolorbutton->color()));
horizontalSlider->setValue(titleConfig.readEntry("background_alpha", horizontalSlider->value()));
+
+ cropImage->setChecked(titleConfig.readEntry("crop_image", cropImage->isChecked()));
}
<string>Title Clip</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
- <item row="5" column="7">
+ <item row="5" column="8">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</spacer>
</item>
- <item row="2" column="1" colspan="8">
+ <item row="2" column="1" colspan="9">
<widget class="QFrame" name="rect_properties">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</layout>
</widget>
</item>
- <item row="3" column="1" colspan="8">
+ <item row="3" column="1" colspan="9">
<widget class="QFrame" name="text_properties">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</layout>
</widget>
</item>
- <item row="4" column="1" colspan="8">
+ <item row="4" column="1" colspan="9">
<widget class="QSplitter" name="splitter">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<rect>
<x>0</x>
<y>0</y>
- <width>358</width>
- <height>178</height>
+ <width>94</width>
+ <height>65</height>
</rect>
</property>
<attribute name="label">
<rect>
<x>0</x>
<y>0</y>
- <width>341</width>
+ <width>232</width>
<height>198</height>
</rect>
</property>
</property>
</widget>
</item>
- <item row="5" column="8">
+ <item row="5" column="9">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
- <item row="0" column="6" colspan="3">
+ <item row="0" column="6" colspan="4">
<widget class="QFrame" name="frame_properties">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
</property>
</widget>
</item>
+ <item row="5" column="7">
+ <widget class="QCheckBox" name="cropImage">
+ <property name="text">
+ <string>Crop to frame size</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<customwidgets>