gradient->setSpread(QGradient::ReflectSpread);
scene->setBackgroundBrush(*gradient);*/
+ QPen framepen(Qt::DotLine);
+ framepen.setColor(Qt::red);
+
+ m_frameBorder = new QGraphicsRectItem(QRectF(0, 0, m_frameWidth, m_frameHeight));
+ m_frameBorder->setPen(framepen);
+ m_frameBorder->setZValue(-1100);
+ m_frameBorder->setBrush(Qt::transparent);
+ m_frameBorder->setFlags(0);
+ graphicsView->scene()->addItem(m_frameBorder);
+
m_frameImage = new QGraphicsPixmapItem();
QTransform qtrans;
qtrans.scale(2.0, 2.0);
connect(m_scene, SIGNAL(newText(QGraphicsTextItem *)), this , SLOT(slotNewText(QGraphicsTextItem *)));
connect(zoom_slider, SIGNAL(valueChanged(int)), this , SLOT(slotUpdateZoom(int)));
- QPen framepen(Qt::DotLine);
- framepen.setColor(Qt::red);
-
- m_frameBorder = new QGraphicsRectItem(QRectF(0, 0, m_frameWidth, m_frameHeight));
- m_frameBorder->setPen(framepen);
- m_frameBorder->setZValue(-1100);
- m_frameBorder->setBrush(Qt::transparent);
- m_frameBorder->setFlags(0);
- graphicsView->scene()->addItem(m_frameBorder);
// mbd: load saved settings
readChoices();
m_endViewport->setData(0, m_frameWidth);
m_endViewport->setData(1, m_frameHeight);
+ // scale the view so that the title widget is not too big at startup
+ graphicsView->scale(.5, .5);
if (!url.isEmpty()) loadTitle(url);
else {
slotTextTool();
void TitleWidget::displayBackgroundFrame()
{
+ QRectF r = m_frameBorder->sceneBoundingRect();
if (!displayBg->isChecked()) {
- QPixmap bg(m_frameWidth / 2, m_frameHeight / 2);
QPixmap pattern(20, 20);
pattern.fill();
QColor bgcolor(210, 210, 210);
- QPainter p;
- p.begin(&pattern);
+ QPainter p(&pattern);
p.fillRect(QRect(0, 0, 10, 10), bgcolor);
p.fillRect(QRect(10, 10, 20, 20), bgcolor);
p.end();
QBrush br(pattern);
-
- p.begin(&bg);
- p.fillRect(bg.rect(), br);
- p.end();
+ QPixmap bg((int) (r.width() / 2), (int) (r.height()/ 2));
+ QPainter p2(&bg);
+ p2.fillRect(bg.rect(), br);
+ p2.end();
m_frameImage->setPixmap(bg);
} else {
- m_frameImage->setPixmap(QPixmap::fromImage(m_render->extractFrame((int) m_render->seekPosition().frames(m_render->fps()), m_frameWidth / 2, m_frameHeight / 2)));
+ QImage img = m_render->extractFrame((int) m_render->seekPosition().frames(m_render->fps()), QString(), m_render->frameRenderWidth() / 2, m_render->renderHeight() / 2);
+ m_frameImage->setPixmap(QPixmap::fromImage(img.scaled(r.width() / 2, r.height() / 2)));
}
}
{
if (anim_start->isChecked()) slotAnimStart(false);
if (anim_end->isChecked()) slotAnimEnd(false);
+ bool embed_image=false;
+ if (KMessageBox::questionYesNo(this, i18n("Do you want to embed Images into this TitleDocument?\nThis is most needed for sharing Titles.")) != KMessageBox::No)
+ {
+ embed_image=true;
+ }
if (url.isEmpty()) {
KFileDialog *fs = new KFileDialog(KUrl(m_projectTitlePath), "application/x-kdenlivetitle", this);
fs->setOperationMode(KFileDialog::Saving);
delete fs;
}
if (!url.isEmpty()) {
- if (m_titledocument.saveDocument(url, m_startViewport, m_endViewport, m_tc.getFrameCount(title_duration->text()) - 1) == false)
+ if (m_titledocument.saveDocument(url, m_startViewport, m_endViewport, m_tc.getFrameCount(title_duration->text()), embed_image) == false)
KMessageBox::error(this, i18n("Cannot write to file %1", url.path()));
}
}
QDomDocument TitleWidget::xml()
{
QDomDocument doc = m_titledocument.xml(m_startViewport, m_endViewport);
- doc.documentElement().setAttribute("out", m_tc.getFrameCount(title_duration->text()) - 1);
+ doc.documentElement().setAttribute("out", m_tc.getFrameCount(title_duration->text()));
return doc;
}
int TitleWidget::outPoint() const
{
- return m_tc.getFrameCount(title_duration->text()) - 1;
+ return m_tc.getFrameCount(title_duration->text());
}
void TitleWidget::setXml(QDomDocument doc)
{
int out;
- m_count = m_titledocument.loadFromXml(doc, m_startViewport, m_endViewport, &out);
+ m_count = m_titledocument.loadFromXml(doc, m_startViewport, m_endViewport, &out, m_projectTitlePath);
adjustFrameSize();
- title_duration->setText(m_tc.getTimecode(GenTime(out + 1, m_render->fps())));
+ title_duration->setText(m_tc.getTimecode(GenTime(out, m_render->fps())));
/*if (doc.documentElement().hasAttribute("out")) {
GenTime duration = GenTime(doc.documentElement().attribute("out").toDouble() / 1000.0);
title_duration->setText(m_tc.getTimecode(duration));