Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Allow adding project note from timeline ruler context menu

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