Commit a97fa5d8 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Allow adding project note from timeline ruler context menu

parent e1161834
...@@ -1571,6 +1571,8 @@ void MainWindow::setupActions() ...@@ -1571,6 +1571,8 @@ void MainWindow::setupActions()
addAction(QStringLiteral("switch_track_target"), i18n("Toggle Track Target"), pCore->projectManager(), SLOT(slotSwitchTrackTarget()), QIcon(), addAction(QStringLiteral("switch_track_target"), i18n("Toggle Track Target"), pCore->projectManager(), SLOT(slotSwitchTrackTarget()), QIcon(),
Qt::SHIFT + Qt::Key_T); Qt::SHIFT + Qt::Key_T);
addAction(QStringLiteral("add_project_note"), i18n("Add Project Note"), pCore->projectManager(), SLOT(slotAddProjectNote()), KoIconUtils::themedIcon(QStringLiteral("bookmark")));
QHash<QString, QAction *> actions; QHash<QString, QAction *> actions;
actions.insert(QStringLiteral("locate"), locateClip); actions.insert(QStringLiteral("locate"), locateClip);
actions.insert(QStringLiteral("reload"), reloadClip); actions.insert(QStringLiteral("reload"), reloadClip);
......
...@@ -67,3 +67,12 @@ void NotesWidget::mousePressEvent(QMouseEvent *e) ...@@ -67,3 +67,12 @@ void NotesWidget::mousePressEvent(QMouseEvent *e)
emit seekProject(anchor.toInt()); emit seekProject(anchor.toInt());
e->setAccepted(true); e->setAccepted(true);
} }
void NotesWidget::addProjectNote()
{
if (!textCursor().atBlockStart()) {
textCursor().movePosition(QTextCursor::EndOfBlock);
insertPlainText(QStringLiteral("\n"));
}
emit insertNotesTimecode();
}
...@@ -34,7 +34,8 @@ class NotesWidget : public QTextEdit ...@@ -34,7 +34,8 @@ class NotesWidget : public QTextEdit
public: public:
explicit NotesWidget(QWidget *parent = nullptr); explicit NotesWidget(QWidget *parent = nullptr);
~NotesWidget(); ~NotesWidget();
/** @brief insert current timeline timecode and focus widget to allow entering quick note */
void addProjectNote();
protected: protected:
void mouseMoveEvent(QMouseEvent *e) override; void mouseMoveEvent(QMouseEvent *e) override;
void mousePressEvent(QMouseEvent *e) override; void mousePressEvent(QMouseEvent *e) override;
......
...@@ -699,6 +699,13 @@ QString ProjectManager::documentNotes() const ...@@ -699,6 +699,13 @@ QString ProjectManager::documentNotes() const
return m_notesPlugin->widget()->toHtml(); return m_notesPlugin->widget()->toHtml();
} }
void ProjectManager::slotAddProjectNote()
{
m_notesPlugin->widget()->raise();
m_notesPlugin->widget()->setFocus();
m_notesPlugin->widget()->addProjectNote();
}
void ProjectManager::prepareSave() void ProjectManager::prepareSave()
{ {
pCore->projectItemModel()->saveDocumentProperties(pCore->window()->getMainTimeline()->controller()->documentProperties(), m_project->metadata(), pCore->projectItemModel()->saveDocumentProperties(pCore->window()->getMainTimeline()->controller()->documentProperties(), m_project->metadata(),
......
...@@ -141,6 +141,8 @@ public slots: ...@@ -141,6 +141,8 @@ public slots:
void adjustProjectDuration(); void adjustProjectDuration();
/** @brief Add an asset in timeline (effect, transition). */ /** @brief Add an asset in timeline (effect, transition). */
void activateAsset(const QVariantMap effectData); void activateAsset(const QVariantMap effectData);
/** @brief insert current timeline timecode in notes widget and focus widget to allow entering quick note */
void slotAddProjectNote();
private slots: private slots:
void slotRevert(); void slotRevert();
......
...@@ -400,6 +400,13 @@ Rectangle { ...@@ -400,6 +400,13 @@ Rectangle {
timeline.editGuide(timeline.position); timeline.editGuide(timeline.position);
} }
} }
OLD.MenuItem {
id: addProjectNote
text: i18n('Add Project Note')
onTriggered: {
timeline.triggerAction('add_project_note')
}
}
onAboutToShow: { onAboutToShow: {
if (guidesModel.hasMarker(timeline.position)) { if (guidesModel.hasMarker(timeline.position)) {
// marker at timeline position // marker at timeline position
......
Supports Markdown
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