Commit 6f206f85 authored by Laurent Montel's avatar Laurent Montel 😁

Const'ify Fix indent

parent 95d462a7
......@@ -26,9 +26,9 @@
#include <KDebug>
SpacerDialog::SpacerDialog(const GenTime &duration, Timecode tc, int track, const QList<TrackInfo> &tracks, QWidget * parent) :
QDialog(parent),
m_in(tc)
SpacerDialog::SpacerDialog(const GenTime &duration, const Timecode &tc, int track, const QList<TrackInfo> &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;
}
......
......@@ -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 <TrackInfo>& tracks, QWidget * parent = 0);
GenTime selectedDuration();
int selectedTrack();
SpacerDialog(const GenTime &duration, const Timecode &tc, int track, const QList <TrackInfo>& tracks, QWidget * parent = 0);
GenTime selectedDuration() const;
int selectedTrack() const;
private:
TimecodeDisplay m_in;
......
......@@ -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 <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);
......
......@@ -48,8 +48,8 @@ TrackView::TrackView(KdenliveDoc *doc, const QList<QAction *> &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 <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);
......@@ -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<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)
......@@ -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;