Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLMC
Commits
45a5a195
Commit
45a5a195
authored
Aug 14, 2009
by
Ludovic Fauvet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clip's visual representation now show the filename of the clip.
parent
c7f780d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
4 deletions
+30
-4
src/gui/GraphicsMovieItem.cpp
src/gui/GraphicsMovieItem.cpp
+23
-0
src/gui/GraphicsMovieItem.h
src/gui/GraphicsMovieItem.h
+7
-4
No files found.
src/gui/GraphicsMovieItem.cpp
View file @
45a5a195
...
...
@@ -35,6 +35,14 @@ GraphicsMovieItem::GraphicsMovieItem( Clip* clip ) : m_clip( clip ), m_width( 0
.
arg
(
clip
->
getParent
()
->
getFileInfo
()
->
fileName
()
)
.
arg
(
length
.
toString
(
"hh:mm:ss.zzz"
)
)
);
setToolTip
(
tooltip
);
m_movieTitle
=
new
QGraphicsTextItem
(
this
,
scene
()
);
m_movieTitle
->
setFlag
(
QGraphicsItem
::
ItemIgnoresTransformations
);
QFont
titleFont
=
m_movieTitle
->
font
();
titleFont
.
setPointSize
(
8
);
m_movieTitle
->
setFont
(
titleFont
);
updateTitle
();
}
GraphicsMovieItem
::~
GraphicsMovieItem
()
...
...
@@ -57,6 +65,7 @@ void GraphicsMovieItem::paint( QPainter* painter, const QStyleOptionGraphicsItem
painter
->
drawRect
(
boundingRect
()
);
paintAudioSpectrum
(
painter
);
updateTitle
();
}
...
...
@@ -118,3 +127,17 @@ Clip* GraphicsMovieItem::clip() const
{
return
m_clip
;
}
void
GraphicsMovieItem
::
updateTitle
()
{
QFontMetrics
fm
(
m_movieTitle
->
font
()
);
QString
text
=
m_clip
->
getParent
()
->
getFileInfo
()
->
fileName
();
static
int
lastWidth
=
0
;
int
width
=
TracksView
::
instance
()
->
mapFromScene
(
boundingRect
()
).
boundingRect
().
width
();
if
(
lastWidth
==
width
)
return
;
lastWidth
=
width
;
//FIXME there is a small visual refresh bug here
m_movieTitle
->
setPlainText
(
fm
.
elidedText
(
text
,
Qt
::
ElideRight
,
width
)
);
}
src/gui/GraphicsMovieItem.h
View file @
45a5a195
...
...
@@ -23,6 +23,7 @@
#ifndef GRAPHICSMOVIEITEM_H
#define GRAPHICSMOVIEITEM_H
#include <QFontMetrics>
#include "AbstractGraphicsMediaItem.h"
#include "Clip.h"
#include "TracksView.h"
...
...
@@ -49,10 +50,12 @@ public:
void
paintAudioSpectrum
(
QPainter
*
painter
);
private:
Clip
*
m_clip
;
int
m_width
;
int
m_height
;
QVector
<
float
*>
m_audioSpectrum
;
void
updateTitle
();
Clip
*
m_clip
;
int
m_width
;
int
m_height
;
QVector
<
float
*>
m_audioSpectrum
;
QGraphicsTextItem
*
m_movieTitle
;
};
#endif // GRAPHICSMOVIEITEM_H
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