const int TYPEWRITEREFFECT = 3;
TitleWidget::TitleWidget(const KUrl &url, const Timecode &tc, const QString &projectTitlePath, Render *render, QWidget *parent) :
- QDialog(parent),
- Ui::TitleWidget_UI(),
- m_startViewport(NULL),
- m_endViewport(NULL),
- m_render(render),
- m_count(0),
- m_unicodeDialog(new UnicodeDialog(UnicodeDialog::InputHex)),
- m_projectTitlePath(projectTitlePath),
- m_tc(tc)
+ QDialog(parent),
+ Ui::TitleWidget_UI(),
+ m_startViewport(NULL),
+ m_endViewport(NULL),
+ m_render(render),
+ m_count(0),
+ m_unicodeDialog(new UnicodeDialog(UnicodeDialog::InputHex)),
+ m_projectTitlePath(projectTitlePath),
+ m_tc(tc)
{
setupUi(this);
setFont(KGlobalSettings::toolBarFont());
graphicsView->scale(.5, .5);
if (!url.isEmpty()) loadTitle(url);
else {
- prepareTools(NULL);
- slotTextTool();
+ prepareTools(NULL);
+ slotTextTool();
QTimer::singleShot(200, this, SLOT(slotAdjustZoom()));
}
initAnimation();
svg->setZValue(m_count++);
svg->setData(Qt::UserRole, url.path());
graphicsView->scene()->addItem(svg);
- prepareTools(svg);
+ prepareTools(svg);
} else {
QPixmap pix(url.path());
QGraphicsPixmapItem *image = new QGraphicsPixmapItem(pix);
image->setData(Qt::UserRole, url.path());
image->setZValue(m_count++);
graphicsView->scene()->addItem(image);
- prepareTools(image);
+ prepareTools(image);
}
}
m_scene->setTool(TITLE_SELECT);
// Remember x axis setting
l.at(0)->setData(TitleDocument::OriginXLeft, origin_x_left->isChecked() ?
- TitleDocument::AxisInverted : TitleDocument::AxisDefault);
+ TitleDocument::AxisInverted : TitleDocument::AxisDefault);
}
graphicsView->setFocus();
}
updateCoordinates(l.at(0));
l.at(0)->setData(TitleDocument::OriginYTop, origin_y_top->isChecked() ?
- TitleDocument::AxisInverted : TitleDocument::AxisDefault);
+ TitleDocument::AxisInverted : TitleDocument::AxisDefault);
}
graphicsView->setFocus();
cformat.setForeground(QBrush(color));
cur.setCharFormat(cformat);
cur.setBlockFormat(format);
-// item->setTextCursor(cur);
+ // item->setTextCursor(cur);
cur.clearSelection();
item->setTextCursor(cur);
item->setDefaultTextColor(color);
QGraphicsPixmapItem pix;
int pixmapType = pix.type();
foreach(const QGraphicsItem *item, list) {
- if (item->type() == pixmapType && item != m_frameImage) {
- embed_image = true;
- break;
- }
+ if (item->type() == pixmapType && item != m_frameImage) {
+ embed_image = true;
+ break;
+ }
}
if (embed_image && KMessageBox::questionYesNo(this, i18n("Do you want to embed Images into this TitleDocument?\nThis is most needed for sharing Titles.")) != KMessageBox::Yes)
{
titleConfig.writeEntry("font_alpha", textAlpha->value());
titleConfig.writeEntry("font_outline_alpha", textOutlineAlpha->value());
#endif
-
+
titleConfig.writeEntry("font_outline", textOutline->value());
titleConfig.writeEntry("font_weight", font_weight_box->itemData(font_weight_box->currentIndex()).toInt());
titleConfig.writeEntry("font_italic", buttonItalic->isChecked());
if (referenceItem->type() == TEXTITEM) {
showToolbars(TITLE_TEXT);
QGraphicsTextItem* i = static_cast <QGraphicsTextItem *>(referenceItem);
- if (!i->toPlainText().isEmpty()) {
- // We have an existing text item selected
- if (!i->data(100).isNull()) {
- // Item has an effect
- QStringList effdata = i->data(100).toStringList();
- QString effectName = effdata.takeFirst();
- if (effectName == "typewriter") {
- QStringList params = effdata.at(0).split(';');
- typewriter_delay->setValue(params.at(0).toInt());
- typewriter_start->setValue(params.at(1).toInt());
- effect_list->setCurrentIndex(effect_list->findData((int) TYPEWRITEREFFECT));
- effect_stack->setHidden(false);
- }
- } else {
+ if (!i->toPlainText().isEmpty()) {
+ // We have an existing text item selected
+ if (!i->data(100).isNull()) {
+ // Item has an effect
+ QStringList effdata = i->data(100).toStringList();
+ QString effectName = effdata.takeFirst();
+ if (effectName == "typewriter") {
+ QStringList params = effdata.at(0).split(';');
+ typewriter_delay->setValue(params.at(0).toInt());
+ typewriter_start->setValue(params.at(1).toInt());
+ effect_list->setCurrentIndex(effect_list->findData((int) TYPEWRITEREFFECT));
+ effect_stack->setHidden(false);
+ }
+ } else {
#if QT_VERSION >= 0x040600
- if (i->graphicsEffect()) {
- QGraphicsBlurEffect *blur = static_cast <QGraphicsBlurEffect *>(i->graphicsEffect());
- if (blur) {
- effect_list->setCurrentIndex(effect_list->findData((int) BLUREFFECT));
- int rad = (int) blur->blurRadius();
- blur_radius->setValue(rad);
- effect_stack->setHidden(false);
- } else {
- QGraphicsDropShadowEffect *shad = static_cast <QGraphicsDropShadowEffect *>(i->graphicsEffect());
- if (shad) {
- effect_list->setCurrentIndex(effect_list->findData((int) SHADOWEFFECT));
- shadow_radius->setValue(shad->blurRadius());
- shadow_x->setValue(shad->xOffset());
- shadow_y->setValue(shad->yOffset());
- effect_stack->setHidden(false);
- }
- }
- } else {
- effect_list->setCurrentIndex(effect_list->findData((int) NOEFFECT));
- effect_stack->setHidden(true);
- }
+ if (i->graphicsEffect()) {
+ QGraphicsBlurEffect *blur = static_cast <QGraphicsBlurEffect *>(i->graphicsEffect());
+ if (blur) {
+ effect_list->setCurrentIndex(effect_list->findData((int) BLUREFFECT));
+ int rad = (int) blur->blurRadius();
+ blur_radius->setValue(rad);
+ effect_stack->setHidden(false);
+ } else {
+ QGraphicsDropShadowEffect *shad = static_cast <QGraphicsDropShadowEffect *>(i->graphicsEffect());
+ if (shad) {
+ effect_list->setCurrentIndex(effect_list->findData((int) SHADOWEFFECT));
+ shadow_radius->setValue(shad->blurRadius());
+ shadow_x->setValue(shad->xOffset());
+ shadow_y->setValue(shad->yOffset());
+ effect_stack->setHidden(false);
+ }
+ }
+ } else {
+ effect_list->setCurrentIndex(effect_list->findData((int) NOEFFECT));
+ effect_stack->setHidden(true);
+ }
#else
- effect_list->setCurrentIndex(effect_list->findData((int) NOEFFECT));
- effect_stack->setHidden(true);
+ effect_list->setCurrentIndex(effect_list->findData((int) NOEFFECT));
+ effect_stack->setHidden(true);
#endif
- }
- font_size->blockSignals(true);
- font_family->blockSignals(true);
- font_weight_box->blockSignals(true);
- buttonItalic->blockSignals(true);
- buttonUnder->blockSignals(true);
- fontColorButton->blockSignals(true);
+ }
+ font_size->blockSignals(true);
+ font_family->blockSignals(true);
+ font_weight_box->blockSignals(true);
+ buttonItalic->blockSignals(true);
+ buttonUnder->blockSignals(true);
+ fontColorButton->blockSignals(true);
#if not KDE_IS_VERSION(4,5,0)
- textAlpha->blockSignals(true);
+ textAlpha->blockSignals(true);
#endif
- buttonAlignLeft->blockSignals(true);
- buttonAlignRight->blockSignals(true);
- buttonAlignNone->blockSignals(true);
- buttonAlignCenter->blockSignals(true);
-
- QFont font = i->font();
- font_family->setCurrentFont(font);
- font_size->setValue(font.pixelSize());
- m_scene->slotUpdateFontSize(font.pixelSize());
- buttonItalic->setChecked(font.italic());
- buttonUnder->setChecked(font.underline());
- setFontBoxWeight(font.weight());
-
- QTextCursor cursor(i->document());
- cursor.select(QTextCursor::Document);
- QColor color = cursor.charFormat().foreground().color();
+ buttonAlignLeft->blockSignals(true);
+ buttonAlignRight->blockSignals(true);
+ buttonAlignNone->blockSignals(true);
+ buttonAlignCenter->blockSignals(true);
+
+ QFont font = i->font();
+ font_family->setCurrentFont(font);
+ font_size->setValue(font.pixelSize());
+ m_scene->slotUpdateFontSize(font.pixelSize());
+ buttonItalic->setChecked(font.italic());
+ buttonUnder->setChecked(font.underline());
+ setFontBoxWeight(font.weight());
+
+ QTextCursor cursor(i->document());
+ cursor.select(QTextCursor::Document);
+ QColor color = cursor.charFormat().foreground().color();
#if not KDE_IS_VERSION(4,5,0)
- textAlpha->setValue(color.alpha());
- color.setAlpha(255);
+ textAlpha->setValue(color.alpha());
+ color.setAlpha(255);
#endif
- fontColorButton->setColor(color);
-
- if (!i->data(101).isNull()) {
- textOutline->blockSignals(true);
- textOutline->setValue(i->data(101).toDouble() * 10);
- textOutline->blockSignals(false);
- }
- if (!i->data(102).isNull()) {
- textOutlineColor->blockSignals(true);
- QVariant variant = i->data(102);
- color = variant.value<QColor>();
+ fontColorButton->setColor(color);
+
+ if (!i->data(101).isNull()) {
+ textOutline->blockSignals(true);
+ textOutline->setValue(i->data(101).toDouble() * 10);
+ textOutline->blockSignals(false);
+ }
+ if (!i->data(102).isNull()) {
+ textOutlineColor->blockSignals(true);
+ QVariant variant = i->data(102);
+ color = variant.value<QColor>();
#if not KDE_IS_VERSION(4,5,0)
- textOutlineAlpha->blockSignals(true);
- textOutlineAlpha->setValue(color.alpha());
- color.setAlpha(255);
- textOutlineAlpha->blockSignals(false);
+ textOutlineAlpha->blockSignals(true);
+ textOutlineAlpha->setValue(color.alpha());
+ color.setAlpha(255);
+ textOutlineAlpha->blockSignals(false);
#endif
- textOutlineColor->setColor(color);
- textOutlineColor->blockSignals(false);
- }
- QTextCursor cur = i->textCursor();
- QTextBlockFormat format = cur.blockFormat();
- if (i->textWidth() == -1) buttonAlignNone->setChecked(true);
- else if (format.alignment() == Qt::AlignHCenter) buttonAlignCenter->setChecked(true);
- else if (format.alignment() == Qt::AlignRight) buttonAlignRight->setChecked(true);
- else if (format.alignment() == Qt::AlignLeft) buttonAlignLeft->setChecked(true);
-
- font_size->blockSignals(false);
- font_family->blockSignals(false);
- font_weight_box->blockSignals(false);
- buttonItalic->blockSignals(false);
- buttonUnder->blockSignals(false);
- fontColorButton->blockSignals(false);
+ textOutlineColor->setColor(color);
+ textOutlineColor->blockSignals(false);
+ }
+ QTextCursor cur = i->textCursor();
+ QTextBlockFormat format = cur.blockFormat();
+ if (i->textWidth() == -1) buttonAlignNone->setChecked(true);
+ else if (format.alignment() == Qt::AlignHCenter) buttonAlignCenter->setChecked(true);
+ else if (format.alignment() == Qt::AlignRight) buttonAlignRight->setChecked(true);
+ else if (format.alignment() == Qt::AlignLeft) buttonAlignLeft->setChecked(true);
+
+ font_size->blockSignals(false);
+ font_family->blockSignals(false);
+ font_weight_box->blockSignals(false);
+ buttonItalic->blockSignals(false);
+ buttonUnder->blockSignals(false);
+ fontColorButton->blockSignals(false);
#if not KDE_IS_VERSION(4,5,0)
- textAlpha->blockSignals(false);
+ textAlpha->blockSignals(false);
#endif
- buttonAlignLeft->blockSignals(false);
- buttonAlignRight->blockSignals(false);
- buttonAlignNone->blockSignals(false);
- buttonAlignCenter->blockSignals(false);
-
- // mbt 1607: Select text if the text item is an unchanged template item.
- if (i->property("isTemplate").isValid()) {
- cur.setPosition(0, QTextCursor::MoveAnchor);
- cur.select(QTextCursor::Document);
- i->setTextCursor(cur);
- // Make text editable now.
- i->grabKeyboard();
- i->setTextInteractionFlags(Qt::TextEditorInteraction);
- }
- }
+ buttonAlignLeft->blockSignals(false);
+ buttonAlignRight->blockSignals(false);
+ buttonAlignNone->blockSignals(false);
+ buttonAlignCenter->blockSignals(false);
+
+ // mbt 1607: Select text if the text item is an unchanged template item.
+ if (i->property("isTemplate").isValid()) {
+ cur.setPosition(0, QTextCursor::MoveAnchor);
+ cur.select(QTextCursor::Document);
+ i->setTextCursor(cur);
+ // Make text editable now.
+ i->grabKeyboard();
+ i->setTextInteractionFlags(Qt::TextEditorInteraction);
+ }
+ }
updateAxisButtons(i);
updateCoordinates(i);
{
m_trackActions << actions;
setupUi(this);
-// ruler_frame->setMaximumHeight();
-// size_frame->setMaximumHeight();
+ // ruler_frame->setMaximumHeight();
+ // size_frame->setMaximumHeight();
m_scene = new CustomTrackScene(doc);
m_trackview = new CustomTrackView(doc, m_scene, parent);
m_trackview->scale(1, 1);
QDomElement base = MainWindow::transitions.getEffectByTag(mlt_service, transitionId).cloneNode().toElement();
if (!base.isNull()) for (int k = 0; k < transitionparams.count(); k++) {
- p = transitionparams.item(k).toElement();
- if (!p.isNull()) {
- QString paramName = p.attribute("name");
- QString paramValue = p.text();
-
- QDomNodeList params = base.elementsByTagName("parameter");
- if (paramName != "a_track" && paramName != "b_track") for (int i = 0; i < params.count(); ++i) {
- QDomElement e = params.item(i).toElement();
- if (!e.isNull() && e.attribute("tag") == paramName) {
- if (e.attribute("type") == "double") {
- QString factor = e.attribute("factor", "1");
- double offset = e.attribute("offset", "0").toDouble();
- if (factor != "1" || offset != 0) {
- double fact;
- if (factor.contains('%')) {
- fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor);
- } else {
- fact = factor.toDouble();
- }
- paramValue = QLocale().toString(offset + paramValue.toDouble() * fact);
- }
+ p = transitionparams.item(k).toElement();
+ if (!p.isNull()) {
+ QString paramName = p.attribute("name");
+ QString paramValue = p.text();
+
+ QDomNodeList params = base.elementsByTagName("parameter");
+ if (paramName != "a_track" && paramName != "b_track") for (int i = 0; i < params.count(); ++i) {
+ QDomElement e = params.item(i).toElement();
+ if (!e.isNull() && e.attribute("tag") == paramName) {
+ if (e.attribute("type") == "double") {
+ QString factor = e.attribute("factor", "1");
+ double offset = e.attribute("offset", "0").toDouble();
+ if (factor != "1" || offset != 0) {
+ double fact;
+ if (factor.contains('%')) {
+ fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor);
+ } else {
+ fact = factor.toDouble();
}
- e.setAttribute("value", paramValue);
- break;
+ paramValue = QLocale().toString(offset + paramValue.toDouble() * fact);
}
}
+ e.setAttribute("value", paramValue);
+ break;
+ }
}
}
+ }
/*QDomDocument doc;
doc.appendChild(doc.importNode(base, true));
}
}
-int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool locked, QDomNodeList producers)
+int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool locked, const QDomNodeList &producers)
{
// parse track
int position = 0;
break;
}
}
- }
+ }
}
else {
// We cannot find the producer, something is really wrong, add
// add effect to clip
QString effecttag;
QString effectid;
- QString effectinfo;
+ QString effectinfo;
QString effectindex = QString::number(effectNb);
// Get effect tag & index
for (QDomNode n3 = effect.firstChild(); !n3.isNull(); n3 = n3.nextSibling()) {
effecttag = effectparam.text();
} else if (effectparam.attribute("name") == "kdenlive_id") {
effectid = effectparam.text();
- } else if (effectparam.attribute("name") == "kdenlive_info") {
+ } else if (effectparam.attribute("name") == "kdenlive_info") {
effectinfo = effectparam.text();
} else if (effectparam.attribute("name") == "disable" && effectparam.text().toInt() == 1) {
// Fix effects index
} else {
QDomElement currenteffect = clipeffect.cloneNode().toElement();
currenteffect.setAttribute("kdenlive_ix", effectindex);
- currenteffect.setAttribute("kdenlive_info", effectinfo);
+ currenteffect.setAttribute("kdenlive_info", effectinfo);
QDomNodeList clipeffectparams = currenteffect.childNodes();
if (MainWindow::videoEffects.hasKeyFrames(currenteffect)) {
} else {
// Check if effect has in/out points
if (effect.hasAttribute("in")) {
- EffectsList::setParameter(currenteffect, "in", effect.attribute("in"));
- currenteffect.setAttribute("in", effect.attribute("in"));
- currenteffect.setAttribute("_sync_in_out", "1");
+ EffectsList::setParameter(currenteffect, "in", effect.attribute("in"));
+ currenteffect.setAttribute("in", effect.attribute("in"));
+ currenteffect.setAttribute("_sync_in_out", "1");
}
if (effect.hasAttribute("out")) {
- EffectsList::setParameter(currenteffect, "out", effect.attribute("out"));
- currenteffect.setAttribute("out", effect.attribute("out"));
+ EffectsList::setParameter(currenteffect, "out", effect.attribute("out"));
+ currenteffect.setAttribute("out", effect.attribute("out"));
}
}
// Special case, region filter embeds other effects
- bool regionFilter = effecttag == "region";
- QMap <QString, QString> regionEffects;
-
+ bool regionFilter = effecttag == "region";
+ QMap <QString, QString> regionEffects;
+
// adjust effect parameters
for (QDomNode n3 = effect.firstChild(); !n3.isNull(); n3 = n3.nextSibling()) {
// parse effect parameters
QDomElement effectparam = n3.toElement();
QString paramname = effectparam.attribute("name");
QString paramvalue = effectparam.text();
-
- if (regionFilter && paramname.startsWith("filter")) {
- regionEffects.insert(paramname, paramvalue);
- continue;
- }
+
+ if (regionFilter && paramname.startsWith("filter")) {
+ regionEffects.insert(paramname, paramvalue);
+ continue;
+ }
// try to find this parameter in the effect xml and set its value
adjustparameterValue(clipeffectparams, paramname, paramvalue);
}
if (regionFilter && !regionEffects.isEmpty()) {
- // insert region sub-effects
- int i = 0;
- while (regionEffects.contains(QString("filter%1").arg(i))) {
- QString filterid = regionEffects.value(QString("filter%1.kdenlive_id").arg(i));
- QString filtertag = regionEffects.value(QString("filter%1.tag").arg(i));
- QDomElement subclipeffect = getEffectByTag(filtertag, filterid).cloneNode().toElement();
- QDomNodeList subclipeffectparams = subclipeffect.childNodes();
- subclipeffect.setAttribute("region_ix", i);
- QMap<QString, QString>::const_iterator j = regionEffects.constBegin();
- while (j != regionEffects.constEnd()) {
- if (j.key().startsWith(QString("filter%1.").arg(i))) {
- QString pname = j.key().section('.', 1, -1);
- adjustparameterValue(subclipeffectparams, pname, j.value());
- }
- ++j;
- }
- currenteffect.appendChild(currenteffect.ownerDocument().importNode(subclipeffect, true));
- ++i;
- }
- }
+ // insert region sub-effects
+ int i = 0;
+ while (regionEffects.contains(QString("filter%1").arg(i))) {
+ QString filterid = regionEffects.value(QString("filter%1.kdenlive_id").arg(i));
+ QString filtertag = regionEffects.value(QString("filter%1.tag").arg(i));
+ QDomElement subclipeffect = getEffectByTag(filtertag, filterid).cloneNode().toElement();
+ QDomNodeList subclipeffectparams = subclipeffect.childNodes();
+ subclipeffect.setAttribute("region_ix", i);
+ QMap<QString, QString>::const_iterator j = regionEffects.constBegin();
+ while (j != regionEffects.constEnd()) {
+ if (j.key().startsWith(QString("filter%1.").arg(i))) {
+ QString pname = j.key().section('.', 1, -1);
+ adjustparameterValue(subclipeffectparams, pname, j.value());
+ }
+ ++j;
+ }
+ currenteffect.appendChild(currenteffect.ownerDocument().importNode(subclipeffect, true));
+ ++i;
+ }
+ }
if (disableeffect) currenteffect.setAttribute("disable", "1");
if (clip)
QDomElement e;
QLocale locale;
for (int k = 0; k < clipeffectparams.count(); k++) {
- e = clipeffectparams.item(k).toElement();
+ e = clipeffectparams.item(k).toElement();
if (!e.isNull() && e.tagName() == "parameter" && e.attribute("name") == paramname) {
- QString type = e.attribute("type");
+ QString type = e.attribute("type");
QString factor = e.attribute("factor", "1");
double fact;
if (factor.contains('%')) {
- fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor);
+ fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor);
} else {
- fact = factor.toDouble();
+ fact = factor.toDouble();
}
double offset = e.attribute("offset", "0").toDouble();
if (type == "simplekeyframe") {
- QStringList kfrs = paramvalue.split(";");
+ QStringList kfrs = paramvalue.split(";");
for (int l = 0; l < kfrs.count(); l++) {
- QString fr = kfrs.at(l).section('=', 0, 0);
+ QString fr = kfrs.at(l).section('=', 0, 0);
double val = locale.toDouble(kfrs.at(l).section('=', 1, 1));
//kfrs[l] = fr + ":" + locale.toString((int)(val * fact));
kfrs[l] = fr + ':' + QString::number((int) (offset + val * fact));
}
e.setAttribute("keyframes", kfrs.join(";"));
} else if (type == "double" || type == "constant") {
- bool ok;
+ bool ok;
e.setAttribute("value", offset + locale.toDouble(paramvalue, &ok) * fact);
if (!ok)
- e.setAttribute("value", paramvalue);
+ e.setAttribute("value", paramvalue);
} else {
- e.setAttribute("value", paramvalue);
+ e.setAttribute("value", paramvalue);
}
break;
}
- }
+ }
}
{
QDomElement clipeffect = MainWindow::customEffects.getEffectByTag(QString(), effectid);
if (clipeffect.isNull()) {
- clipeffect = MainWindow::videoEffects.getEffectByTag(effecttag, effectid);
+ clipeffect = MainWindow::videoEffects.getEffectByTag(effecttag, effectid);
}
if (clipeffect.isNull()) {
- clipeffect = MainWindow::audioEffects.getEffectByTag(effecttag, effectid);
+ clipeffect = MainWindow::audioEffects.getEffectByTag(effecttag, effectid);
}
return clipeffect;
}
missingXml = m.toElement();
break;
}
- }
+ }
}
}
if (missingXml == QDomElement()) return NULL;