Commit 851a68cb authored by Julius Künzel's avatar Julius Künzel

Allow to edit title clip with double click on timeline

Fixes #644
Inspired by Akhil Gangadharan and !108
parent 5b5a368e
Pipeline #53004 passed with stage
in 10 minutes and 31 seconds
......@@ -438,6 +438,7 @@ public slots:
* @param minimumTracksCount the number of active streams for this clip
*/
void checkProjectAudioTracks(QString clipId, int minimumTracksCount);
void showTitleWidget(const std::shared_ptr<ProjectClip> &clip);
protected:
/* This function is called whenever an item is selected to propagate signals
......@@ -527,7 +528,6 @@ private:
/** @brief Get the QModelIndex value for an item in the Bin. */
QModelIndex getIndexForId(const QString &id, bool folderWanted) const;
std::shared_ptr<ProjectClip> getFirstSelectedClip();
void showTitleWidget(const std::shared_ptr<ProjectClip> &clip);
void showSlideshowWidget(const std::shared_ptr<ProjectClip> &clip);
void processAudioThumbs();
void updateSortingAction(int ix);
......
......@@ -3,6 +3,7 @@ import QtQml.Models 2.11
import QtQuick.Controls 2.4
import Kdenlive.Controls 1.0
import 'Timeline.js' as Logic
import com.enums 1.0
Rectangle {
id: root
......@@ -1633,7 +1634,11 @@ Rectangle {
} else {
clipBeingMovedId = -1
timeline.ungrabHack()
timeline.editItemDuration(dragProxy.draggedItem)
if(dragProxy.masterObject.itemType === ProducerType.Text || dragProxy.masterObject.itemType === ProducerType.TextTemplate) {
timeline.editTitleClip(dragProxy.draggedItem)
} else {
timeline.editItemDuration(dragProxy.draggedItem)
}
}
}
}
......
......@@ -3140,6 +3140,29 @@ void TimelineController::editItemDuration(int id)
}
}
void TimelineController::editTitleClip(int id)
{
if (id == -1) {
id = m_root->property("mainItemId").toInt();
if (id == -1) {
std::unordered_set<int> sel = m_model->getCurrentSelection();
if (!sel.empty()) {
id = *sel.begin();
}
if (id == -1 || !m_model->isItem(id) || !m_model->isClip(id)) {
pCore->displayMessage(i18n("No clip selected"), ErrorMessage, 500);
return;
}
}
}
std::shared_ptr<ProjectClip> binClip = pCore->projectItemModel()->getClipByBinID(getClipBinId(id));
if(binClip->clipType() != ClipType::Text && binClip->clipType() != ClipType::TextTemplate) {
pCore->displayMessage(i18n("Item is not a title clip"), ErrorMessage, 500);
return;
}
pCore->bin()->showTitleWidget(binClip);
}
QPoint TimelineController::selectionInOut() const
{
std::unordered_set<int> ids = m_model->getCurrentSelection();
......
......@@ -99,6 +99,9 @@ public:
/** @brief Edit an item's in/out points with a dialog
*/
Q_INVOKABLE void editItemDuration(int itemId = -1);
/** @brief Edit a title clip with a title widget
*/
Q_INVOKABLE void editTitleClip(int itemId = -1);
/** @brief Returns the topmost track containing a selected item (-1 if selection is embty) */
Q_INVOKABLE int selectedTrack() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment