Git commit c88d97b9c144c434c5b81a4a93cfc249a7336f3c by Jean-Baptiste Mardel= le. Committed on 31/03/2016 at 20:37. Pushed by mardelle into branch 'Applications/16.04'. Fix editing of titles / slideshows M +35 -40 src/bin/bin.cpp M +2 -0 src/bin/bin.h M +5 -0 src/mltcontroller/clippropertiescontroller.cpp M +1 -0 src/mltcontroller/clippropertiescontroller.h http://commits.kde.org/kdenlive/c88d97b9c144c434c5b81a4a93cfc249a7336f3c diff --git a/src/bin/bin.cpp b/src/bin/bin.cpp index 0f32e07..64ef6e4 100644 --- a/src/bin/bin.cpp +++ b/src/bin/bin.cpp @@ -1537,17 +1537,45 @@ void Bin::slotItemDoubleClicked(const QModelIndex &= ix, const QPoint pos) if (item->itemType() =3D=3D AbstractProjectItem::ClipItem) { ProjectClip *clip =3D static_cast(item); if (clip) { - if (clip->clipType() !=3D Text) { - m_editAction->trigger(); - } else { - m_propertiesPanel->setEnabled(false); + if (clip->clipType() =3D=3D Text) { showTitleWidget(clip); + } else if (clip->clipType() =3D=3D SlideShow) { + showSlideshowWidget(clip); + } else if (clip->clipType() =3D=3D QText) { + ClipCreationDialog::createQTextClip(m_doc, getFolderIn= fo(), this, clip); + } else { + m_editAction->trigger(); } } } } } = +void Bin::slotEditClip() +{ + QString panelId =3D m_propertiesPanel->property("clipId").toString(); + QModelIndex current =3D m_proxyModel->selectionModel()->currentIndex(); + AbstractProjectItem *item =3D static_cast(m_prox= yModel->mapToSource(current).internalPointer()); + if (item->clipId() !=3D panelId) { + // wrong clip + return; + } + ProjectClip *clip =3D qobject_cast(item); + switch (clip->clipType()) { + case Text: + showTitleWidget(clip); + break; + case SlideShow: + showSlideshowWidget(clip); + break; + case QText: + ClipCreationDialog::createQTextClip(m_doc, getFolderInfo(), th= is, clip); + break; + default: + break; + } +} + void Bin::slotSwitchClipProperties(bool display) { m_propertiesDock->toggleViewAction()->trigger(); @@ -1563,11 +1591,7 @@ void Bin::slotSwitchClipProperties(const QModelIndex= &ix) // User clicked in the icon, open clip properties AbstractProjectItem *item =3D static_cast(m_= proxyModel->mapToSource(ix).internalPointer()); ProjectClip *clip =3D qobject_cast(item); - if (clip && clip->clipType() =3D=3D Text) { - m_propertiesPanel->setEnabled(false); - } else { - m_propertiesPanel->setEnabled(true); - } + m_propertiesPanel->setEnabled(true); showClipProperties(clip); } else { @@ -1594,45 +1618,16 @@ void Bin::showClipProperties(ProjectClip *clip, boo= l forceRefresh, bool openExte return; } // Special case: text clips open title widget - if (clip->clipType() =3D=3D Text) { - foreach (QWidget * w, m_propertiesPanel->findChildren()) { - delete w; - } - m_propertiesPanel->setProperty("clipId", clip->clipId()); - m_propertiesPanel->setEnabled(false); - return; - } - if (clip->clipType() =3D=3D SlideShow) { - // Cleanup widget for new content - foreach (QWidget * w, m_propertiesPanel->findChildren()) { - delete w; - } - m_propertiesPanel->setProperty("clipId", clip->clipId()); - m_propertiesPanel->setEnabled(false); - showSlideshowWidget(clip); - return; - } - if (clip->clipType() =3D=3D QText) { - // Cleanup widget for new content - foreach (QWidget * w, m_propertiesPanel->findChildren()) { - delete w; - } - m_propertiesPanel->setProperty("clipId", clip->clipId()); - m_propertiesPanel->setEnabled(false); - ClipCreationDialog::createQTextClip(m_doc, getFolderInfo(), this, = clip); - return; - } + m_propertiesPanel->setEnabled(true); QString panelId =3D m_propertiesPanel->property("clipId").toString(); if (!forceRefresh && panelId =3D=3D clip->clipId()) { // the properties panel is already displaying current clip, do not= hing - m_propertiesPanel->setEnabled(true); return; } // Cleanup widget for new content foreach (QWidget * w, m_propertiesPanel->findChildren()) { delete w; } - m_propertiesPanel->setEnabled(true); m_propertiesPanel->setProperty("clipId", clip->clipId()); QVBoxLayout *lay =3D static_cast(m_propertiesPanel->layo= ut()); if (lay =3D=3D 0) { @@ -1645,7 +1640,7 @@ void Bin::showClipProperties(ProjectClip *clip, bool = forceRefresh, bool openExte connect(panel, SIGNAL(updateClipProperties(const QString &, QMap, QMap)), this, SLOT(slotEditClipCommand(cons= t QString &, QMap, QMap))); connect(panel, SIGNAL(seekToFrame(int)), m_monitor, SLOT(slotSeek(int)= )); connect(panel, SIGNAL(addMarkers(QString,QList)), this,= SLOT(slotAddClipMarker(QString,QList))); - + connect(panel, SIGNAL(editClip()), this, SLOT(slotEditClip())); connect(panel, SIGNAL(editAnalysis(QString,QString,QString)), this, SL= OT(slotAddClipExtraData(QString,QString,QString))); = connect(panel, SIGNAL(loadMarkers(QString)), this, SLOT(slotLoadClipMa= rkers(QString))); diff --git a/src/bin/bin.h b/src/bin/bin.h index 739aca7..3f859f7 100644 --- a/src/bin/bin.h +++ b/src/bin/bin.h @@ -560,6 +560,8 @@ private slots: void doRefreshAudioThumbs(const QString &id); /** @brief Enable item view and hide message */ void slotMessageActionTriggered(); + /** @brief Request editing of title or slideshow clip */ + void slotEditClip(); = public slots: void slotThumbnailReady(const QString &id, const QImage &img, bool fro= mFile =3D false); diff --git a/src/mltcontroller/clippropertiescontroller.cpp b/src/mltcontro= ller/clippropertiescontroller.cpp index 09d7c81..06a7c2a 100644 --- a/src/mltcontroller/clippropertiescontroller.cpp +++ b/src/mltcontroller/clippropertiescontroller.cpp @@ -222,6 +222,11 @@ ClipPropertiesController::ClipPropertiesController(Tim= ecode tc, ClipController * = // Force properties QVBoxLayout *vbox =3D new QVBoxLayout; + if (m_type =3D=3D Text || m_type =3D=3D SlideShow || m_type =3D=3D QTe= xt) { + QPushButton *editButton =3D new QPushButton(i18n("Edit Clip"), thi= s); + connect(editButton, SIGNAL(clicked()), this, SIGNAL(editClip())); + vbox->addWidget(editButton); + } if (m_type =3D=3D Color || m_type =3D=3D Image || m_type =3D=3D AV || = m_type =3D=3D Video || m_type =3D=3D TextTemplate) { // Edit duration widget m_originalProperties.insert(QStringLiteral("out"), m_properties.ge= t("out")); diff --git a/src/mltcontroller/clippropertiescontroller.h b/src/mltcontroll= er/clippropertiescontroller.h index f29d086..7c2517f 100644 --- a/src/mltcontroller/clippropertiescontroller.h +++ b/src/mltcontroller/clippropertiescontroller.h @@ -120,6 +120,7 @@ signals: void loadMarkers(const QString &); void saveMarkers(const QString &); void editAnalysis(const QString &id, const QString &name, const QStrin= g &value); + void editClip(); }; = #endif