From 6f206f85a9c002e4e8e5f80880750739a088ec52 Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Wed, 22 May 2013 12:43:22 +0200 Subject: [PATCH] Const'ify Fix indent --- src/spacerdialog.cpp | 10 +- src/spacerdialog.h | 6 +- src/titlewidget.cpp | 262 +++++++++++++++++++++---------------------- src/trackview.cpp | 152 ++++++++++++------------- src/trackview.h | 4 +- 5 files changed, 217 insertions(+), 217 deletions(-) diff --git a/src/spacerdialog.cpp b/src/spacerdialog.cpp index 9dad7168..19ff4f85 100644 --- a/src/spacerdialog.cpp +++ b/src/spacerdialog.cpp @@ -26,9 +26,9 @@ #include -SpacerDialog::SpacerDialog(const GenTime &duration, Timecode tc, int track, const QList &tracks, QWidget * parent) : - QDialog(parent), - m_in(tc) +SpacerDialog::SpacerDialog(const GenTime &duration, const Timecode &tc, int track, const QList &tracks, QWidget * parent) : + QDialog(parent), + m_in(tc) { setFont(KGlobalSettings::toolBarFont()); setupUi(this); @@ -49,12 +49,12 @@ SpacerDialog::SpacerDialog(const GenTime &duration, Timecode tc, int track, cons adjustSize(); } -GenTime SpacerDialog::selectedDuration() +GenTime SpacerDialog::selectedDuration() const { return m_in.gentime(); } -int SpacerDialog::selectedTrack() +int SpacerDialog::selectedTrack() const { return track_number->currentIndex() - 1; } diff --git a/src/spacerdialog.h b/src/spacerdialog.h index fec3c6de..d8405658 100644 --- a/src/spacerdialog.h +++ b/src/spacerdialog.h @@ -38,9 +38,9 @@ class SpacerDialog : public QDialog, public Ui::SpacerDialog_UI Q_OBJECT public: - SpacerDialog(const GenTime &duration, Timecode tc, int track, const QList & tracks, QWidget * parent = 0); - GenTime selectedDuration(); - int selectedTrack(); + SpacerDialog(const GenTime &duration, const Timecode &tc, int track, const QList & tracks, QWidget * parent = 0); + GenTime selectedDuration() const; + int selectedTrack() const; private: TimecodeDisplay m_in; diff --git a/src/titlewidget.cpp b/src/titlewidget.cpp index 996aba56..b0d2b2cd 100644 --- a/src/titlewidget.cpp +++ b/src/titlewidget.cpp @@ -65,15 +65,15 @@ const int SHADOWEFFECT = 2; 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()); @@ -505,8 +505,8 @@ TitleWidget::TitleWidget(const KUrl &url, const Timecode &tc, const QString &pro graphicsView->scale(.5, .5); if (!url.isEmpty()) loadTitle(url); else { - prepareTools(NULL); - slotTextTool(); + prepareTools(NULL); + slotTextTool(); QTimer::singleShot(200, this, SLOT(slotAdjustZoom())); } initAnimation(); @@ -741,7 +741,7 @@ void TitleWidget::slotImageTool() 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); @@ -750,7 +750,7 @@ void TitleWidget::slotImageTool() image->setData(Qt::UserRole, url.path()); image->setZValue(m_count++); graphicsView->scene()->addItem(image); - prepareTools(image); + prepareTools(image); } } m_scene->setTool(TITLE_SELECT); @@ -1429,7 +1429,7 @@ void TitleWidget::slotOriginXClicked() // Remember x axis setting l.at(0)->setData(TitleDocument::OriginXLeft, origin_x_left->isChecked() ? - TitleDocument::AxisInverted : TitleDocument::AxisDefault); + TitleDocument::AxisInverted : TitleDocument::AxisDefault); } graphicsView->setFocus(); } @@ -1453,7 +1453,7 @@ void TitleWidget::slotOriginYClicked() updateCoordinates(l.at(0)); l.at(0)->setData(TitleDocument::OriginYTop, origin_y_top->isChecked() ? - TitleDocument::AxisInverted : TitleDocument::AxisDefault); + TitleDocument::AxisInverted : TitleDocument::AxisDefault); } graphicsView->setFocus(); @@ -1608,7 +1608,7 @@ void TitleWidget::slotUpdateText() cformat.setForeground(QBrush(color)); cur.setCharFormat(cformat); cur.setBlockFormat(format); -// item->setTextCursor(cur); + // item->setTextCursor(cur); cur.clearSelection(); item->setTextCursor(cur); item->setDefaultTextColor(color); @@ -1863,10 +1863,10 @@ void TitleWidget::saveTitle(KUrl url) 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) { @@ -1993,7 +1993,7 @@ void TitleWidget::writeChoices() 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()); @@ -2571,127 +2571,127 @@ void TitleWidget::prepareTools(QGraphicsItem *referenceItem) if (referenceItem->type() == TEXTITEM) { showToolbars(TITLE_TEXT); QGraphicsTextItem* i = static_cast (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 (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 (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 (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 (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(); + 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(); #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); diff --git a/src/trackview.cpp b/src/trackview.cpp index 2d2c3363..5cc9453c 100644 --- a/src/trackview.cpp +++ b/src/trackview.cpp @@ -48,8 +48,8 @@ TrackView::TrackView(KdenliveDoc *doc, const QList &actions, bool *ok { 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); @@ -355,34 +355,34 @@ void TrackView::parseDocument(const QDomDocument &doc) 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)); @@ -596,7 +596,7 @@ void TrackView::adjustTrackHeaders() } } -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; @@ -688,7 +688,7 @@ int TrackView::slotAddProjectTrack(int ix, QDomElement xml, bool locked, QDomNod break; } } - } + } } else { // We cannot find the producer, something is really wrong, add @@ -780,7 +780,7 @@ void TrackView::slotAddProjectEffects(QDomNodeList effects, QDomElement parentNo // 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()) { @@ -790,7 +790,7 @@ void TrackView::slotAddProjectEffects(QDomNodeList effects, QDomElement parentNo 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 @@ -811,7 +811,7 @@ void TrackView::slotAddProjectEffects(QDomNodeList effects, QDomElement parentNo } 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)) { @@ -896,31 +896,31 @@ void TrackView::slotAddProjectEffects(QDomNodeList effects, QDomElement parentNo } 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 regionEffects; - + bool regionFilter = effecttag == "region"; + QMap 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); @@ -928,26 +928,26 @@ void TrackView::slotAddProjectEffects(QDomNodeList effects, QDomElement parentNo } 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::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::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) @@ -964,37 +964,37 @@ void TrackView::adjustparameterValue(QDomNodeList clipeffectparams, const QStrin 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; } - } + } } @@ -1002,10 +1002,10 @@ QDomElement TrackView::getEffectByTag(const QString &effecttag, const QString &e { 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; } @@ -1050,7 +1050,7 @@ DocClipBase *TrackView::getMissingProducer(const QString &id) const missingXml = m.toElement(); break; } - } + } } } if (missingXml == QDomElement()) return NULL; diff --git a/src/trackview.h b/src/trackview.h index 49399b6c..67477671 100644 --- a/src/trackview.h +++ b/src/trackview.h @@ -106,7 +106,7 @@ private: QList m_trackActions; void parseDocument(const QDomDocument &doc); - int slotAddProjectTrack(int ix, QDomElement xml, bool locked, QDomNodeList producers); + int slotAddProjectTrack(int ix, QDomElement xml, bool locked, const QDomNodeList &producers); DocClipBase *getMissingProducer(const QString &id) const; void adjustTrackHeaders(); /** @brief Add effects from the xml. Returns true if some effect was upgraded, false if everything went fine.*/ @@ -152,7 +152,7 @@ signals: void configTrack(int); void updateTracksInfo(); void setZoom(int); - void showTrackEffects(int, TrackInfo); + void showTrackEffects(int, const TrackInfo&); }; #endif -- 2.39.2