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

Notes widget: context menu now allows to insert clickable timecode to make...

Notes widget: context menu now allows to insert clickable timecode to make easy reference to some place in the project

svn path=/trunk/kdenlive/; revision=5564
parent a49621a4
......@@ -279,6 +279,7 @@ set(kdenlive_SRCS
monitoreditwidget.cpp
simplekeyframes/simpletimelinewidget.cpp
simplekeyframes/simplekeyframewidget.cpp
noteswidget.cpp
)
add_definitions(${KDE4_DEFINITIONS})
......
......@@ -589,7 +589,7 @@ bool KdenliveDoc::saveSceneList(const QString &path, const QString &scene, const
addedXml.appendChild(docproperties);
QDomElement docnotes = sceneList.createElement("documentnotes");
QDomText value = sceneList.createTextNode(m_notesWidget->toPlainText());
QDomText value = sceneList.createTextNode(m_notesWidget->toHtml());
docnotes.appendChild(value);
addedXml.appendChild(docnotes);
......
......@@ -215,7 +215,10 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
m_notesDock = new QDockWidget(i18n("Project Notes"), this);
m_notesDock->setObjectName("notes_widget");
m_notesWidget = new KTextEdit();
m_notesWidget = new NotesWidget();
connect(m_notesWidget, SIGNAL(insertNotesTimecode()), this, SLOT(slotInsertNotesTimecode()));
connect(m_notesWidget, SIGNAL(seekProject(int)), m_projectMonitor->render, SLOT(seekToFrame(int)));
m_notesWidget->setTabChangesFocus(true);
#if KDE_IS_VERSION(4,4,0)
m_notesWidget->setClickMessage(i18n("Enter your project notes here ..."));
......@@ -4230,6 +4233,13 @@ void MainWindow::slotUpdateProxySettings()
m_projectList->updateProxyConfig();
}
void MainWindow::slotInsertNotesTimecode()
{
int frames = m_projectMonitor->render->seekPosition().frames(m_activeDocument->fps());
QString position = m_activeDocument->timecode().getTimecodeFromFrames(frames);
m_notesWidget->insertHtml("<a href=\"" + QString::number(frames) + "\">" + position + "</a> ");
}
#include "mainwindow.moc"
#ifdef DEBUG_MAINW
......
......@@ -45,6 +45,7 @@
#include "statusbarmessagelabel.h"
#include "dvdwizard.h"
#include "stopmotion/stopmotion.h"
#include "noteswidget.h"
class KdenliveDoc;
class TrackView;
......@@ -149,7 +150,7 @@ private:
//KListWidget *m_effectList;
QDockWidget *m_notesDock;
KTextEdit *m_notesWidget;
NotesWidget *m_notesWidget;
QDockWidget *m_effectStackDock;
EffectStackView *m_effectStack;
......@@ -532,7 +533,8 @@ private slots:
void slotDoAction(const QString& action_name);
/** @brief Update project because the use of proxy clips was enabled / disabled. */
void slotUpdateProxySettings();
/** @brief Insert current project's timecode into the notes widget. */
void slotInsertNotesTimecode();
signals:
Q_SCRIPTABLE void abortRenderJob(const QString &url);
};
......
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "noteswidget.h"
#include <KLocale>
#include <KDebug>
#include <QMenu>
#include <QMouseEvent>
NotesWidget::NotesWidget(QWidget * parent) :
KTextEdit(parent)
{
connect(this, SIGNAL(aboutToShowContextMenu(QMenu *)), this, SLOT(slotFillNotesMenu(QMenu *)));
setMouseTracking(true);
}
void NotesWidget::slotFillNotesMenu(QMenu *menu)
{
QAction *a = new QAction(i18n("Insert current timecode"), this);
connect(a, SIGNAL(triggered(bool)), this, SIGNAL(insertNotesTimecode()));
menu->insertAction(menu->actions().at(0), a);
}
void NotesWidget::mouseMoveEvent( QMouseEvent * e )
{
QString anchor = anchorAt(e->pos());
if (anchor.isEmpty()) viewport()->setCursor(Qt::IBeamCursor);
else viewport()->setCursor(Qt::PointingHandCursor);
}
void NotesWidget::mousePressEvent( QMouseEvent * e )
{
QString anchor = anchorAt(e->pos());
if (anchor.isEmpty()) {
KTextEdit::mousePressEvent(e);
return;
}
kDebug()<<"+++++++++\nCLICKED NACHOR: "<<anchor;
emit seekProject(anchor.toInt());
e->setAccepted(true);
}
NotesWidget::~NotesWidget()
{
}
/***************************************************************************
* Copyright (C) 2011 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef NOTESWIDGET_H
#define NOTESWIDGET_H
#include <KTextEdit>
/**
* @class NotesWidget
* @brief A small text editor to create project notes.
* @author Jean-Baptiste Mardelle
*/
class NotesWidget : public KTextEdit
{
Q_OBJECT
public:
NotesWidget(QWidget * parent = 0);
~NotesWidget();
protected:
virtual void mouseMoveEvent ( QMouseEvent * e );
virtual void mousePressEvent ( QMouseEvent * e );
private slots:
void slotFillNotesMenu(QMenu *menu);
private:
signals:
void insertNotesTimecode();
void seekProject(int);
};
#endif
......@@ -92,7 +92,6 @@ Q_OBJECT public:
/** @brief Seeks the renderer clip to the given time. */
void seek(GenTime time);
void seek(int time);
void seekToFrame(int pos);
void seekToFrameDiff(int diff);
int m_isBlocked;
......@@ -394,6 +393,7 @@ public slots:
void slotSplitView(bool doit);
void slotSwitchFullscreen();
void slotSetVolume(int volume);
void seekToFrame(int pos);
};
#endif
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