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
6549641f
Commit
6549641f
authored
Jun 28, 2013
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some cleaning on video audio graphics widget and restored video
parent
3b51d098
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
89 deletions
+26
-89
UBGraphicsMediaItem.cpp
src/domain/UBGraphicsMediaItem.cpp
+8
-40
UBGraphicsMediaItem.h
src/domain/UBGraphicsMediaItem.h
+1
-18
UBGraphicsMediaItemDelegate.cpp
src/domain/UBGraphicsMediaItemDelegate.cpp
+15
-26
UBGraphicsProxyWidget.cpp
src/domain/UBGraphicsProxyWidget.cpp
+2
-5
No files found.
src/domain/UBGraphicsMediaItem.cpp
View file @
6549641f
...
...
@@ -31,29 +31,6 @@
#include "board/UBBoardController.h"
#include "core/memcheck.h"
UBAudioPresentationWidget
::
UBAudioPresentationWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
,
mBorderSize
(
10
)
{
}
void
UBAudioPresentationWidget
::
paintEvent
(
QPaintEvent
*
event
)
{
QPainter
painter
(
this
);
painter
.
fillRect
(
rect
(),
QBrush
(
Qt
::
white
));
QPen
borderPen
;
borderPen
.
setWidth
(
2
);
borderPen
.
setColor
(
QColor
(
Qt
::
black
));
painter
.
setPen
(
borderPen
);
painter
.
drawRect
(
0
,
0
,
width
(),
height
());
QWidget
::
paintEvent
(
event
);
}
bool
UBGraphicsMediaItem
::
sIsMutedByDefault
=
false
;
UBGraphicsMediaItem
::
UBGraphicsMediaItem
(
const
QUrl
&
pMediaFileUrl
,
QGraphicsItem
*
parent
)
...
...
@@ -97,14 +74,9 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
mAudioOutput
=
new
Phonon
::
AudioOutput
(
Phonon
::
MusicCategory
,
this
);
mMediaObject
->
setTickInterval
(
1000
);
mAudioWidget
=
new
UBAudioPresentationWidget
();
int
borderSize
=
0
;
UBAudioPresentationWidget
*
pAudioWidget
=
dynamic_cast
<
UBAudioPresentationWidget
*>
(
mAudioWidget
);
if
(
pAudioWidget
)
borderSize
=
pAudioWidget
->
borderSize
();
mAudioWidget
->
resize
(
320
,
26
+
2
*
borderSize
);
//3*border size with enabled title
mAudioWidget
->
setMinimumSize
(
150
,
26
+
borderSize
);
mAudioWidget
=
new
QWidget
();
mAudioWidget
->
resize
(
320
,
26
);
mAudioWidget
->
setMinimumSize
(
150
,
26
);
haveLinkedImage
=
false
;
}
...
...
@@ -117,10 +89,7 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
// we should create delegate after media objects because delegate uses his properties at creation.
setDelegate
(
new
UBGraphicsMediaItemDelegate
(
this
,
mMediaObject
));
// TODO claudio remove this because in contrast with the fact the frame should be created on demand.
// but without without forcing the control creation we do not have the frame and all the calculation
// for the different element of the interface will fail
Delegate
()
->
createControls
();
// delegate should be created earler because we setWidget calls resize event for graphics proxy widgt.
// resize uses delegate.
...
...
@@ -130,6 +99,10 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
setWidget
(
mAudioWidget
);
// media widget should be created and placed on proxy widget here.
// TODO claudio remove this because in contrast with the fact the frame should be created on demand.
// but without forcing the control creation we do not have the frame and all the calculation
// for the different element of the interface will fail
Delegate
()
->
createControls
();
if
(
mediaType_Audio
==
mMediaType
)
Delegate
()
->
frame
()
->
setOperationMode
(
UBGraphicsDelegateFrame
::
ResizingHorizontally
);
else
...
...
@@ -196,11 +169,6 @@ void UBGraphicsMediaItem::clearSource()
qDebug
()
<<
"cannot delete file: "
<<
path
;
}
void
UBGraphicsMediaItem
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
{
UBGraphicsProxyWidget
::
paint
(
painter
,
option
,
widget
);
}
void
UBGraphicsMediaItem
::
toggleMute
()
{
mMuted
=
!
mMuted
;
...
...
src/domain/UBGraphicsMediaItem.h
View file @
6549641f
...
...
@@ -32,22 +32,6 @@
#include "board/UBBoardController.h"
#include "frameworks/UBFileSystemUtils.h"
class
UBAudioPresentationWidget
:
public
QWidget
{
public
:
UBAudioPresentationWidget
(
QWidget
*
parent
=
NULL
);
int
borderSize
()
{
return
mBorderSize
;}
void
setTitle
(
QString
title
=
QString
()){
mTitle
=
title
;}
QString
getTitle
(){
return
mTitle
;}
private
:
virtual
void
paintEvent
(
QPaintEvent
*
event
);
int
mBorderSize
;
QString
mTitle
;
};
class
UBGraphicsMediaItem
:
public
UBGraphicsProxyWidget
{
Q_OBJECT
...
...
@@ -121,7 +105,6 @@ protected:
virtual
void
mousePressEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
mouseMoveEvent
(
QGraphicsSceneMouseEvent
*
event
);
virtual
void
clearSource
();
virtual
void
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
);
Phonon
::
MediaObject
*
mMediaObject
;
Phonon
::
VideoWidget
*
mVideoWidget
;
...
...
@@ -145,7 +128,7 @@ private:
QPointF
mMouseMovePos
;
bool
haveLinkedImage
;
QGraphicsPixmapItem
*
mLinkedImage
;
QGraphicsPixmapItem
*
mLinkedImage
;
qint64
mInitialPos
;
};
...
...
src/domain/UBGraphicsMediaItemDelegate.cpp
View file @
6549641f
...
...
@@ -119,14 +119,14 @@ void UBGraphicsMediaItemDelegate::buildButtons()
connect
(
mMuteButton
,
SIGNAL
(
clicked
(
bool
)),
mToolBarShowTimer
,
SLOT
(
start
()));
}
UBGraphicsMediaItem
*
audioItem
=
dynamic_cast
<
UBGraphicsMediaItem
*>
(
mDelegated
);
if
(
audioItem
)
{
if
(
audioItem
->
getMediaType
()
==
UBGraphicsMediaItem
::
mediaType_Audio
)
{
//
UBGraphicsMediaItem *audioItem = dynamic_cast<UBGraphicsMediaItem*>(mDelegated);
//
if (audioItem)
//
{
//
if (audioItem->getMediaType() == UBGraphicsMediaItem::mediaType_Audio)
//
{
positionHandles
();
}
}
//
}
//
}
}
UBGraphicsMediaItemDelegate
::~
UBGraphicsMediaItemDelegate
()
...
...
@@ -143,23 +143,12 @@ void UBGraphicsMediaItemDelegate::positionHandles()
if
(
mediaItem
)
{
QRectF
toolBarRect
=
mToolBarItem
->
rect
();
if
(
mediaItem
->
getMediaType
()
==
UBGraphicsMediaItem
::
mediaType_Video
)
{
mToolBarItem
->
setPos
(
0
,
delegated
()
->
boundingRect
().
height
()
-
mToolBarItem
->
rect
().
height
());
toolBarRect
.
setWidth
(
delegated
()
->
boundingRect
().
width
());
}
else
if
(
mediaItem
->
getMediaType
()
==
UBGraphicsMediaItem
::
mediaType_Audio
)
{
int
borderSize
=
0
;
UBAudioPresentationWidget
*
audioWidget
=
dynamic_cast
<
UBAudioPresentationWidget
*>
(
delegated
()
->
widget
());
if
(
audioWidget
)
borderSize
=
audioWidget
->
borderSize
();
mToolBarItem
->
setPos
(
borderSize
,
delegated
()
->
boundingRect
().
height
()
-
(
mToolBarItem
->
rect
().
height
()
+
borderSize
));
toolBarRect
.
setWidth
((
delegated
()
->
boundingRect
().
width
()
-
2
*
borderSize
));
mToolBarItem
->
show
();
}
mToolBarItem
->
setPos
(
0
,
delegated
()
->
boundingRect
().
height
()
-
mToolBarItem
->
rect
().
height
());
toolBarRect
.
setWidth
(
delegated
()
->
boundingRect
().
width
());
mToolBarItem
->
show
();
mToolBarItem
->
setRect
(
toolBarRect
);
}
...
...
@@ -173,10 +162,10 @@ void UBGraphicsMediaItemDelegate::positionHandles()
}
toolBarMinimumWidth
+=
mToolBarItem
->
boundingRect
().
height
();
UBAudioPresentationWidget
*
pAudioWidget
=
dynamic_cast
<
UBAudioPresentationWidget
*>
(
delegated
()
->
widget
()
);
QWidget
*
pAudioWidget
=
delegated
()
->
widget
(
);
if
(
pAudioWidget
)
{
pAudioWidget
->
setMinimumSize
(
toolBarMinimumWidth
+
(
int
)
mMediaControl
->
lcdAreaSize
().
width
()
+
(
int
)
mMediaControl
->
rect
().
height
(),
26
+
pAudioWidget
->
borderSize
()
);
pAudioWidget
->
setMinimumSize
(
toolBarMinimumWidth
+
(
int
)
mMediaControl
->
lcdAreaSize
().
width
()
+
(
int
)
mMediaControl
->
rect
().
height
(),
26
);
}
QRectF
mediaItemRect
=
mMediaControl
->
rect
();
...
...
@@ -187,7 +176,7 @@ void UBGraphicsMediaItemDelegate::positionHandles()
mToolBarItem
->
positionHandles
();
mMediaControl
->
positionHandles
();
if
(
mediaItem
&&
mediaItem
->
getMediaType
()
==
UBGraphicsMediaItem
::
mediaType_Audio
)
if
(
mediaItem
)
mToolBarItem
->
show
();
}
...
...
src/domain/UBGraphicsProxyWidget.cpp
View file @
6549641f
...
...
@@ -37,10 +37,6 @@ UBGraphicsProxyWidget::UBGraphicsProxyWidget(QGraphicsItem* parent)
{
setData
(
UBGraphicsItemData
::
ItemLayerType
,
UBItemLayerType
::
Object
);
//UBGraphicsItemDelegate* delegate = new UBGraphicsItemDelegate(this,0, true, false, false);
//delegate->init();
//setDelegate(delegate);
setFlag
(
QGraphicsItem
::
ItemSendsGeometryChanges
,
true
);
QGraphicsProxyWidget
::
setAcceptHoverEvents
(
true
);
...
...
@@ -53,6 +49,7 @@ UBGraphicsProxyWidget::~UBGraphicsProxyWidget()
void
UBGraphicsProxyWidget
::
paint
(
QPainter
*
painter
,
const
QStyleOptionGraphicsItem
*
option
,
QWidget
*
widget
)
{
QGraphicsProxyWidget
::
paint
(
painter
,
option
,
widget
);
Delegate
()
->
postpaint
(
painter
,
option
,
widget
);
}
...
...
@@ -158,7 +155,7 @@ void UBGraphicsProxyWidget::resize(const QSizeF & pSize)
if
(
widget
())
{
QSizeF
minimumItemSize
(
widget
()
->
minimumSize
());
if
(
minimumItemSize
.
width
()
>
pSize
.
width
())
sizeX
=
minimumItemSize
.
width
();
...
...
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