Project notes will now be inserted depending on the active monitor. If the...

Project notes will now be inserted depending on the active monitor. If the Clip Monitor is active, inserting a project note will be relative to Bin clip, otherwise to timeline.
Related to #407
parent 4cc6bfdd
Pipeline #22353 passed with stage
in 10 minutes and 42 seconds
......@@ -2501,6 +2501,20 @@ std::shared_ptr<ProjectClip> Bin::getBinClip(const QString &id)
return clip;
}
const QString Bin::getBinClipName(const QString &id) const
{
std::shared_ptr<ProjectClip> clip = nullptr;
if (id.contains(QLatin1Char('_'))) {
clip = m_itemModel->getClipByBinID(id.section(QLatin1Char('_'), 0, 0));
} else if (!id.isEmpty()) {
clip = m_itemModel->getClipByBinID(id);
}
if (clip) {
return clip->clipName();
}
return QString();
}
void Bin::setWaitingStatus(const QString &id)
{
std::shared_ptr<ProjectClip> clip = m_itemModel->getClipByBinID(id);
......
......@@ -196,6 +196,8 @@ public:
/** @brief Get a clip from it's id */
std::shared_ptr<ProjectClip> getBinClip(const QString &id);
/** @brief Get a clip's name from it's id */
const QString getBinClipName(const QString &id) const;
/** @brief Returns a list of selected clip ids.
* @param allowSubClips: if true, will include subclip ids in the form: "master clip id/in/out"
......
......@@ -620,6 +620,7 @@ void Monitor::setupMenu(QMenu *goMenu, QMenu *overlayMenu, QAction *playZone, QA
}
m_contextMenu->addAction(m_monitorManager->getAction(QStringLiteral("extract_frame")));
m_contextMenu->addAction(m_monitorManager->getAction(QStringLiteral("extract_frame_to_project")));
m_contextMenu->addAction(m_monitorManager->getAction(QStringLiteral("add_project_note")));
if (m_id == Kdenlive::ProjectMonitor) {
m_contextMenu->addAction(m_monitorManager->getAction(QStringLiteral("monitor_multitrack")));
......
......@@ -65,8 +65,12 @@ void NotesWidget::mousePressEvent(QMouseEvent *e)
QTextEdit::mousePressEvent(e);
return;
}
// qCDebug(KDENLIVE_LOG)<<"+++++++++\nCLICKED NACHOR: "<<anchor;
emit seekProject(anchor.toInt());
if (anchor.contains(QLatin1Char('#'))) {
// That's a Bin Clip reference.
pCore->selectBinClip(anchor.section(QLatin1Char('#'), 0, 0), anchor.section(QLatin1Char('#'), 1).toInt(), QPoint());
} else {
emit seekProject(anchor.toInt());
}
e->setAccepted(true);
}
......
......@@ -42,9 +42,22 @@ void NotesPlugin::showDock()
void NotesPlugin::slotInsertTimecode()
{
int frames = pCore->monitorManager()->projectMonitor()->position();
QString position = pCore->timecode().getTimecodeFromFrames(frames);
m_widget->insertHtml(QStringLiteral("<a href=\"") + QString::number(frames) + QStringLiteral("\">") + position + QStringLiteral("</a> "));
if (pCore->monitorManager()->isActive(Kdenlive::ClipMonitor)) {
// Add a note on the current bin clip
int frames = pCore->monitorManager()->clipMonitor()->position();
QString position = pCore->timecode().getTimecodeFromFrames(frames);
QString binId = pCore->monitorManager()->clipMonitor()->activeClipId();
if (binId.isEmpty()) {
pCore->displayMessage(i18n("Cannot add note, no clip selected in project bin"), InformationMessage);
return;
}
QString clipName = pCore->bin()->getBinClipName(binId);
m_widget->insertHtml(QString("<a href=\"%1#%2\">%3(%4)</a> ").arg(binId).arg(frames).arg(clipName).arg(position));
} else {
int frames = pCore->monitorManager()->projectMonitor()->position();
QString position = pCore->timecode().getTimecodeFromFrames(frames);
m_widget->insertHtml(QStringLiteral("<a href=\"") + QString::number(frames) + QStringLiteral("\">") + position + QStringLiteral("</a> "));
}
}
NotesWidget *NotesPlugin::widget()
......
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