Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Kdenlive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
258
Issues
258
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Multimedia
Kdenlive
Commits
6f58f7fb
Commit
6f58f7fb
authored
May 01, 2020
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement timecode parsing when pasting text in Project notes
CCBUG: 420843
parent
261590c1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
4 deletions
+24
-4
src/project/dialogs/noteswidget.cpp
src/project/dialogs/noteswidget.cpp
+21
-1
src/project/dialogs/noteswidget.h
src/project/dialogs/noteswidget.h
+1
-0
src/project/notesplugin.cpp
src/project/notesplugin.cpp
+2
-3
No files found.
src/project/dialogs/noteswidget.cpp
View file @
6f58f7fb
...
...
@@ -18,10 +18,12 @@
***************************************************************************/
#include "noteswidget.h"
#include "kdenlive_debug.h"
#include "core.h"
#include <QMenu>
#include <QMouseEvent>
#include <QMimeData>
#include <klocalizedstring.h>
NotesWidget
::
NotesWidget
(
QWidget
*
parent
)
...
...
@@ -76,3 +78,21 @@ void NotesWidget::addProjectNote()
}
emit
insertNotesTimecode
();
}
void
NotesWidget
::
insertFromMimeData
(
const
QMimeData
*
source
)
{
QString
pastedText
=
source
->
text
();
// Check for timecodes
QStringList
words
=
pastedText
.
split
(
QLatin1Char
(
' '
));
QMap
<
QString
,
QString
>
replacementPatterns
;
for
(
const
QString
&
w
:
words
)
{
if
(
w
.
size
()
>
4
&&
w
.
size
()
<
13
&&
w
.
count
(
QLatin1Char
(
':'
))
>
1
)
{
// This is probably a timecode
int
frames
=
pCore
->
timecode
().
getFrameCount
(
w
);
if
(
frames
>
0
)
{
pastedText
.
replace
(
w
,
QStringLiteral
(
"<a href=
\"
"
)
+
QString
::
number
(
frames
)
+
QStringLiteral
(
"
\"
>"
)
+
w
+
QStringLiteral
(
"</a> "
));
}
}
}
insertHtml
(
pastedText
);
}
src/project/dialogs/noteswidget.h
View file @
6f58f7fb
...
...
@@ -40,6 +40,7 @@ public:
protected:
void
mouseMoveEvent
(
QMouseEvent
*
e
)
override
;
void
mousePressEvent
(
QMouseEvent
*
e
)
override
;
void
insertFromMimeData
(
const
QMimeData
*
source
)
override
;
private
slots
:
void
slotFillNotesMenu
(
const
QPoint
&
pos
);
...
...
src/project/notesplugin.cpp
View file @
6f58f7fb
...
...
@@ -11,11 +11,10 @@ the Free Software Foundation, either version 3 of the License, or
#include "notesplugin.h"
#include "core.h"
#include "dialogs/noteswidget.h"
#include "doc/kdenlivedoc.h"
#include "mainwindow.h"
#include "doc/kdenlivedoc.h"
#include "monitor/monitormanager.h"
#include "project/projectmanager.h"
#include "klocalizedstring.h"
NotesPlugin
::
NotesPlugin
(
ProjectManager
*
projectManager
)
...
...
@@ -44,7 +43,7 @@ void NotesPlugin::showDock()
void
NotesPlugin
::
slotInsertTimecode
()
{
int
frames
=
pCore
->
monitorManager
()
->
projectMonitor
()
->
position
();
QString
position
=
pCore
->
projectManager
()
->
current
()
->
timecode
().
getTimecodeFromFrames
(
frames
);
QString
position
=
pCore
->
timecode
().
getTimecodeFromFrames
(
frames
);
m_widget
->
insertHtml
(
QStringLiteral
(
"<a href=
\"
"
)
+
QString
::
number
(
frames
)
+
QStringLiteral
(
"
\"
>"
)
+
position
+
QStringLiteral
(
"</a> "
));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment