Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
bb3f1310
Commit
bb3f1310
authored
Mar 08, 2016
by
Craig Watson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show black rectangle in place of video when vid. not available
parent
3ab6d01a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
18 deletions
+23
-18
UBGraphicsMediaItem.cpp
src/domain/UBGraphicsMediaItem.cpp
+20
-17
UBGraphicsMediaItem.h
src/domain/UBGraphicsMediaItem.h
+3
-1
No files found.
src/domain/UBGraphicsMediaItem.cpp
View file @
bb3f1310
...
...
@@ -94,9 +94,6 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
connect
(
Delegate
(),
SIGNAL
(
showOnDisplayChanged
(
bool
)),
this
,
SLOT
(
showOnDisplayChanged
(
bool
)));
connect
(
mMediaObject
,
SIGNAL
(
videoAvailableChanged
(
bool
)),
this
,
SLOT
(
hasMediaChanged
(
bool
)));
connect
(
mMediaObject
,
static_cast
<
void
(
QMediaPlayer
::*
)(
QMediaPlayer
::
Error
)
>
(
&
QMediaPlayer
::
error
),
this
,
&
UBGraphicsMediaItem
::
mediaError
);
}
...
...
@@ -136,6 +133,8 @@ UBGraphicsVideoItem::UBGraphicsVideoItem(const QUrl &pMediaFileUrl, QGraphicsIte
connect
(
mVideoItem
,
SIGNAL
(
nativeSizeChanged
(
QSizeF
)),
this
,
SLOT
(
videoSizeChanged
(
QSizeF
)));
connect
(
mMediaObject
,
SIGNAL
(
videoAvailableChanged
(
bool
)),
this
,
SLOT
(
hasVideoChanged
(
bool
)));
setAcceptHoverEvents
(
true
);
...
...
@@ -186,7 +185,7 @@ QVariant UBGraphicsMediaItem::itemChange(GraphicsItemChange change, const QVaria
void
UBGraphicsMediaItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
{
painter
->
save
();
painter
->
setCompositionMode
(
QPainter
::
CompositionMode_SourceOver
);
//
painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
Delegate
()
->
postpaint
(
painter
,
option
,
widget
);
painter
->
restore
();
}
...
...
@@ -290,19 +289,6 @@ void UBGraphicsMediaItem::setMute(bool bMute)
sIsMutedByDefault
=
mMuted
;
}
void
UBGraphicsMediaItem
::
hasMediaChanged
(
bool
hasMedia
)
{
if
(
hasMedia
&&
mMediaObject
->
isSeekable
())
{
mMediaObject
->
setPosition
(
mInitialPos
);
UBGraphicsMediaItemDelegate
*
med
=
dynamic_cast
<
UBGraphicsMediaItemDelegate
*>
(
Delegate
());
if
(
med
)
med
->
updateTicker
(
initialPos
());
}
}
UBGraphicsScene
*
UBGraphicsMediaItem
::
scene
()
{
return
qobject_cast
<
UBGraphicsScene
*>
(
QGraphicsItem
::
scene
());
...
...
@@ -517,7 +503,12 @@ void UBGraphicsVideoItem::videoSizeChanged(QSizeF newSize)
Delegate
()
->
showToolBar
(
false
);
}
void
UBGraphicsVideoItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
{
QGraphicsRectItem
::
paint
(
painter
,
option
,
widget
);
UBGraphicsMediaItem
::
paint
(
painter
,
option
,
widget
);
}
void
UBGraphicsVideoItem
::
hoverEnterEvent
(
QGraphicsSceneHoverEvent
*
event
)
{
...
...
@@ -536,3 +527,15 @@ void UBGraphicsVideoItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
{
QGraphicsRectItem
::
hoverLeaveEvent
(
event
);
}
void
UBGraphicsVideoItem
::
hasVideoChanged
(
bool
hasVideo
)
{
if
(
hasVideo
)
{
setBrush
(
QColor
(
Qt
::
transparent
));
setPen
(
QColor
(
Qt
::
transparent
));
}
else
{
setBrush
(
QColor
(
Qt
::
black
));
setPen
(
QColor
(
Qt
::
white
));
}
}
src/domain/UBGraphicsMediaItem.h
View file @
bb3f1310
...
...
@@ -111,7 +111,6 @@ public slots:
void
toggleMute
();
void
setMute
(
bool
bMute
);
void
activeSceneChanged
();
void
hasMediaChanged
(
bool
hasMedia
);
void
showOnDisplayChanged
(
bool
shown
);
virtual
void
play
();
...
...
@@ -176,8 +175,11 @@ public:
virtual
UBItem
*
deepCopy
()
const
;
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
public
slots
:
void
videoSizeChanged
(
QSizeF
newSize
);
void
hasVideoChanged
(
bool
hasVideo
);
protected
:
...
...
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