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
aa5755f5
Commit
aa5755f5
authored
Sep 05, 2010
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Abstract*Items: Merging code.
parent
75c19620
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
156 deletions
+79
-156
src/Gui/timeline/AbstractGraphicsMediaItem.cpp
src/Gui/timeline/AbstractGraphicsMediaItem.cpp
+65
-0
src/Gui/timeline/AbstractGraphicsMediaItem.h
src/Gui/timeline/AbstractGraphicsMediaItem.h
+13
-1
src/Gui/timeline/GraphicsAudioItem.cpp
src/Gui/timeline/GraphicsAudioItem.cpp
+0
-58
src/Gui/timeline/GraphicsAudioItem.h
src/Gui/timeline/GraphicsAudioItem.h
+0
-13
src/Gui/timeline/GraphicsMovieItem.cpp
src/Gui/timeline/GraphicsMovieItem.cpp
+0
-68
src/Gui/timeline/GraphicsMovieItem.h
src/Gui/timeline/GraphicsMovieItem.h
+0
-14
src/Gui/timeline/GraphicsTrack.cpp
src/Gui/timeline/GraphicsTrack.cpp
+1
-2
No files found.
src/Gui/timeline/AbstractGraphicsMediaItem.cpp
View file @
aa5755f5
...
...
@@ -47,6 +47,8 @@ AbstractGraphicsMediaItem::AbstractGraphicsMediaItem( Clip* clip ) :
m_height
(
0
),
m_muted
(
false
)
{
setFlags
(
QGraphicsItem
::
ItemIsSelectable
);
m_clipHelper
=
new
ClipHelper
(
clip
);
// Adjust the width
setWidth
(
clip
->
length
()
);
...
...
@@ -54,6 +56,7 @@ AbstractGraphicsMediaItem::AbstractGraphicsMediaItem( Clip* clip ) :
connect
(
m_clipHelper
,
SIGNAL
(
lengthUpdated
()
),
this
,
SLOT
(
adjustLength
()
)
);
connect
(
clip
,
SIGNAL
(
unloaded
(
Clip
*
)
),
this
,
SLOT
(
clipDestroyed
(
Clip
*
)
),
Qt
::
DirectConnection
);
setAcceptHoverEvents
(
true
);
}
AbstractGraphicsMediaItem
::
AbstractGraphicsMediaItem
(
ClipHelper
*
ch
)
:
...
...
@@ -66,12 +69,14 @@ AbstractGraphicsMediaItem::AbstractGraphicsMediaItem( ClipHelper* ch ) :
m_height
(
0
),
m_muted
(
false
)
{
setFlags
(
QGraphicsItem
::
ItemIsSelectable
);
// Adjust the width
setWidth
(
ch
->
length
()
);
// Automatically adjust future changes
connect
(
ch
,
SIGNAL
(
lengthUpdated
()
),
this
,
SLOT
(
adjustLength
()
)
);
connect
(
ch
->
clip
(),
SIGNAL
(
unloaded
(
Clip
*
)
),
this
,
SLOT
(
clipDestroyed
(
Clip
*
)
),
Qt
::
DirectConnection
);
setAcceptHoverEvents
(
true
);
}
AbstractGraphicsMediaItem
::~
AbstractGraphicsMediaItem
()
...
...
@@ -351,3 +356,63 @@ AbstractGraphicsMediaItem::setEmphasized( bool value )
else
setScale
(
1.0
);
}
void
AbstractGraphicsMediaItem
::
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
TracksView
*
tv
=
tracksView
();
if
(
tv
)
{
switch
(
tv
->
tool
()
)
{
case
TOOL_DEFAULT
:
setCursor
(
Qt
::
OpenHandCursor
);
break
;
case
TOOL_CUT
:
setCursor
(
QCursor
(
QPixmap
(
":/images/editcut"
)
)
);
break
;
}
}
QGraphicsItem
::
hoverEnterEvent
(
event
);
}
void
AbstractGraphicsMediaItem
::
hoverMoveEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
if
(
!
tracksView
()
)
return
;
if
(
tracksView
()
->
tool
()
==
TOOL_DEFAULT
)
{
if
(
resizeZone
(
event
->
pos
()
)
)
setCursor
(
Qt
::
SizeHorCursor
);
else
setCursor
(
Qt
::
OpenHandCursor
);
}
}
void
AbstractGraphicsMediaItem
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
if
(
!
tracksView
()
)
return
;
if
(
tracksView
()
->
tool
()
==
TOOL_DEFAULT
)
{
if
(
resizeZone
(
event
->
pos
()
)
)
setCursor
(
Qt
::
SizeHorCursor
);
else
setCursor
(
Qt
::
ClosedHandCursor
);
}
else
if
(
tracksView
()
->
tool
()
==
TOOL_CUT
)
emit
split
(
this
,
qRound64
(
event
->
pos
().
x
()
)
);
}
void
AbstractGraphicsMediaItem
::
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
Q_UNUSED
(
event
);
if
(
!
tracksView
()
)
return
;
if
(
tracksView
()
->
tool
()
==
TOOL_DEFAULT
)
setCursor
(
Qt
::
OpenHandCursor
);
}
src/Gui/timeline/AbstractGraphicsMediaItem.h
View file @
aa5755f5
...
...
@@ -153,7 +153,11 @@ protected:
*/
void
setHeight
(
qint64
height
);
virtual
void
contextMenuEvent
(
QGraphicsSceneContextMenuEvent
*
event
);
virtual
void
contextMenuEvent
(
QGraphicsSceneContextMenuEvent
*
event
);
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverMoveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
protected
slots
:
/**
...
...
@@ -184,6 +188,14 @@ private:
bool
m_muted
;
QColor
m_itemColor
;
signals:
/**
* \brief Emitted when the item detect a cut request.
* \param self A pointer to the sender.
* \param frame Frame's number where the cut takes place.
*/
void
split
(
AbstractGraphicsMediaItem
*
self
,
qint64
frame
);
};
#endif // ABSTRACTGRAPHICSMEDIAITEM_H
src/Gui/timeline/GraphicsAudioItem.cpp
View file @
aa5755f5
...
...
@@ -37,15 +37,12 @@
GraphicsAudioItem
::
GraphicsAudioItem
(
Clip
*
clip
)
:
AbstractGraphicsMediaItem
(
clip
)
{
setFlags
(
QGraphicsItem
::
ItemIsSelectable
);
QTime
length
=
QTime
().
addMSecs
(
clip
->
getMedia
()
->
lengthMS
()
);
QString
tooltip
(
tr
(
"<p style='white-space:pre'><b>Name:</b> %1"
"<br><b>Length:</b> %2"
)
.
arg
(
clip
->
getMedia
()
->
fileName
()
)
.
arg
(
length
.
toString
(
"hh:mm:ss.zzz"
)
)
);
setToolTip
(
tooltip
);
setAcceptHoverEvents
(
true
);
}
GraphicsAudioItem
::
GraphicsAudioItem
(
ClipHelper
*
ch
)
:
...
...
@@ -179,58 +176,3 @@ void GraphicsAudioItem::paintTitle( QPainter* painter, const QStyleOptionGraphic
painter
->
setPen
(
Qt
::
white
);
painter
->
drawText
(
mapped
,
Qt
::
AlignVCenter
,
fm
.
elidedText
(
text
,
Qt
::
ElideRight
,
mapped
.
width
()
)
);
}
void
GraphicsAudioItem
::
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
TracksView
*
tv
=
Timeline
::
getInstance
()
->
tracksView
();
if
(
tv
)
{
switch
(
tv
->
tool
()
)
{
case
TOOL_DEFAULT
:
setCursor
(
Qt
::
OpenHandCursor
);
break
;
case
TOOL_CUT
:
setCursor
(
QCursor
(
QPixmap
(
":/images/editcut"
)
)
);
break
;
}
}
AbstractGraphicsMediaItem
::
hoverEnterEvent
(
event
);
}
void
GraphicsAudioItem
::
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
AbstractGraphicsMediaItem
::
hoverLeaveEvent
(
event
);
}
void
GraphicsAudioItem
::
hoverMoveEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
if
(
!
tracksView
()
)
return
;
if
(
tracksView
()
->
tool
()
==
TOOL_DEFAULT
)
{
if
(
resizeZone
(
event
->
pos
()
)
)
setCursor
(
Qt
::
SizeHorCursor
);
else
setCursor
(
Qt
::
OpenHandCursor
);
}
}
void
GraphicsAudioItem
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
TracksView
*
tv
=
Timeline
::
getInstance
()
->
tracksView
();
if
(
tv
->
tool
()
==
TOOL_DEFAULT
)
setCursor
(
Qt
::
ClosedHandCursor
);
else
if
(
tv
->
tool
()
==
TOOL_CUT
)
emit
split
(
this
,
qRound64
(
event
->
pos
().
x
()
)
);
}
void
GraphicsAudioItem
::
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
Q_UNUSED
(
event
);
TracksView
*
tv
=
Timeline
::
getInstance
()
->
tracksView
();
if
(
tv
->
tool
()
==
TOOL_DEFAULT
)
setCursor
(
Qt
::
OpenHandCursor
);
}
src/Gui/timeline/GraphicsAudioItem.h
View file @
aa5755f5
...
...
@@ -67,19 +67,6 @@ protected:
* \param option Painting options.
*/
void
paintTitle
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
);
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverMoveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
signals:
/**
* \brief Emitted when the item detect a cut request.
* \param self A pointer to the sender.
* \param frame Frame's number where the cut takes place.
*/
void
split
(
AbstractGraphicsMediaItem
*
self
,
qint64
frame
);
};
#endif // GRAPHICSAUDIOITEM_H
src/Gui/timeline/GraphicsMovieItem.cpp
View file @
aa5755f5
...
...
@@ -37,29 +37,23 @@
GraphicsMovieItem
::
GraphicsMovieItem
(
Clip
*
clip
)
:
AbstractGraphicsMediaItem
(
clip
)
{
setFlags
(
QGraphicsItem
::
ItemIsSelectable
);
QTime
length
=
QTime
().
addMSecs
(
clip
->
getMedia
()
->
lengthMS
()
);
QString
tooltip
(
tr
(
"<p style='white-space:pre'><b>Name:</b> %1"
"<br><b>Length:</b> %2"
)
.
arg
(
clip
->
getMedia
()
->
fileName
()
)
.
arg
(
length
.
toString
(
"hh:mm:ss.zzz"
)
)
);
setToolTip
(
tooltip
);
setAcceptHoverEvents
(
true
);
}
GraphicsMovieItem
::
GraphicsMovieItem
(
ClipHelper
*
ch
)
:
AbstractGraphicsMediaItem
(
ch
)
{
setFlags
(
QGraphicsItem
::
ItemIsSelectable
);
QTime
length
=
QTime
().
addMSecs
(
ch
->
clip
()
->
getMedia
()
->
lengthMS
()
);
QString
tooltip
(
tr
(
"<p style='white-space:pre'><b>Name:</b> %1"
"<br><b>Length:</b> %2"
)
.
arg
(
ch
->
clip
()
->
getMedia
()
->
fileName
()
)
.
arg
(
length
.
toString
(
"hh:mm:ss.zzz"
)
)
);
setToolTip
(
tooltip
);
setAcceptHoverEvents
(
true
);
}
GraphicsMovieItem
::~
GraphicsMovieItem
()
...
...
@@ -178,65 +172,3 @@ void GraphicsMovieItem::paintTitle( QPainter* painter, const QStyleOptionGraphic
painter
->
setPen
(
Qt
::
white
);
painter
->
drawText
(
mapped
,
Qt
::
AlignVCenter
,
fm
.
elidedText
(
text
,
Qt
::
ElideRight
,
mapped
.
width
()
)
);
}
void
GraphicsMovieItem
::
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
TracksView
*
tv
=
Timeline
::
getInstance
()
->
tracksView
();
if
(
tv
)
{
switch
(
tv
->
tool
()
)
{
case
TOOL_DEFAULT
:
setCursor
(
Qt
::
OpenHandCursor
);
break
;
case
TOOL_CUT
:
setCursor
(
QCursor
(
QPixmap
(
":/images/editcut"
)
)
);
break
;
}
}
AbstractGraphicsMediaItem
::
hoverEnterEvent
(
event
);
}
void
GraphicsMovieItem
::
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
AbstractGraphicsMediaItem
::
hoverLeaveEvent
(
event
);
}
void
GraphicsMovieItem
::
hoverMoveEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
if
(
!
tracksView
()
)
return
;
if
(
tracksView
()
->
tool
()
==
TOOL_DEFAULT
)
{
if
(
resizeZone
(
event
->
pos
()
)
)
setCursor
(
Qt
::
SizeHorCursor
);
else
setCursor
(
Qt
::
OpenHandCursor
);
}
}
void
GraphicsMovieItem
::
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
if
(
!
tracksView
()
)
return
;
if
(
tracksView
()
->
tool
()
==
TOOL_DEFAULT
)
{
if
(
resizeZone
(
event
->
pos
()
)
)
setCursor
(
Qt
::
SizeHorCursor
);
else
setCursor
(
Qt
::
ClosedHandCursor
);
}
else
if
(
tracksView
()
->
tool
()
==
TOOL_CUT
)
emit
split
(
this
,
qRound64
(
event
->
pos
().
x
()
)
);
}
void
GraphicsMovieItem
::
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
)
{
Q_UNUSED
(
event
);
if
(
!
tracksView
()
)
return
;
if
(
tracksView
()
->
tool
()
==
TOOL_DEFAULT
)
setCursor
(
Qt
::
OpenHandCursor
);
}
src/Gui/timeline/GraphicsMovieItem.h
View file @
aa5755f5
...
...
@@ -68,19 +68,5 @@ protected:
* \param option Painting options.
*/
void
paintTitle
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
);
virtual
void
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverLeaveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
hoverMoveEvent
(
QGraphicsSceneHoverEvent
*
event
);
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QGraphicsSceneMouseEvent
*
event
);
signals:
/**
* \brief Emitted when the item detect a cut request.
* \param self A pointer to the sender.
* \param frame Frame's number where the cut takes place.
*/
void
split
(
AbstractGraphicsMediaItem
*
self
,
qint64
frame
);
};
#endif // GRAPHICSMOVIEITEM_H
src/Gui/timeline/GraphicsTrack.cpp
View file @
aa5755f5
...
...
@@ -136,8 +136,7 @@ EmphasizedTrackItem::boundingRect() const
}
void
EmphasizedTrackItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
EmphasizedTrackItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
,
QWidget
*
)
{
painter
->
setBrush
(
QBrush
(
Qt
::
darkBlue
));
painter
->
drawRect
(
boundingRect
()
);
...
...
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