Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
c8d48a58
Commit
c8d48a58
authored
Sep 12, 2009
by
Ludovic Fauvet
Browse files
Adjust the GraphicsMovieItem size when the Clip length change
parent
61ffebcc
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/GUI/GraphicsMovieItem.cpp
View file @
c8d48a58
...
...
@@ -39,6 +39,11 @@ GraphicsMovieItem::GraphicsMovieItem( Clip* clip ) : m_clip( clip ), m_width( 0
.
arg
(
length
.
toString
(
"hh:mm:ss.zzz"
)
)
);
setToolTip
(
tooltip
);
setAcceptHoverEvents
(
true
);
// Adjust the width
setWidth
(
clip
->
getLength
()
);
// Automatically adjust future changes
connect
(
clip
,
SIGNAL
(
lengthUpdated
()
),
this
,
SLOT
(
adjustLength
()
)
);
}
GraphicsMovieItem
::~
GraphicsMovieItem
()
...
...
@@ -75,6 +80,13 @@ void GraphicsMovieItem::setHeight( int height )
m_height
=
height
;
}
void
GraphicsMovieItem
::
adjustLength
()
{
//FIXME implement clip expanding.
Q_ASSERT
(
m_clip
->
getLength
()
<=
m_width
);
setWidth
(
m_clip
->
getLength
()
);
}
void
GraphicsMovieItem
::
paintAudioSpectrum
(
QPainter
*
painter
)
{
qreal
x1
,
x2
,
y1
,
y2
;
...
...
src/GUI/GraphicsMovieItem.h
View file @
c8d48a58
...
...
@@ -51,7 +51,6 @@ public:
void
setWidth
(
int
width
);
void
setHeight
(
int
height
);
Clip
*
clip
()
const
;
void
setClip
(
Clip
*
clip
);
//void setAudioSpectrum( QVector<float*> spectrum );
void
paintAudioSpectrum
(
QPainter
*
painter
);
...
...
@@ -61,6 +60,9 @@ protected:
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
);
private
slots
:
void
adjustLength
();
private:
Clip
*
m_clip
;
int
m_width
;
...
...
src/GUI/TracksView.cpp
View file @
c8d48a58
...
...
@@ -186,7 +186,6 @@ void TracksView::addMediaItem( Clip* clip, unsigned int track, qint64 start )
}
GraphicsMovieItem
*
item
=
new
GraphicsMovieItem
(
clip
);
item
->
setWidth
(
clip
->
getLength
()
);
item
->
setHeight
(
tracksHeight
()
);
item
->
setParentItem
(
getTrack
(
track
)
);
item
->
oldTrackNumber
=
track
;
...
...
@@ -208,7 +207,6 @@ void TracksView::dragEnterEvent( QDragEnterEvent* event )
if
(
m_dragItem
)
delete
m_dragItem
;
m_dragItem
=
new
GraphicsMovieItem
(
clip
);
m_dragItem
->
setWidth
(
(
int
)
(
clip
->
getLength
()
)
);
m_dragItem
->
setHeight
(
tracksHeight
()
);
m_dragItem
->
setPos
(
mappedXPos
,
0
);
m_dragItem
->
setParentItem
(
m_layout
->
itemAt
(
0
)
->
graphicsItem
()
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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