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
6cafdcfc
Commit
6cafdcfc
authored
May 02, 2012
by
Claudio Valerio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
on stop the video widget show a screen shot instead of the phonon::mediawidget
parent
8957a360
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
51 deletions
+59
-51
UBMediaWidget.cpp
src/customWidgets/UBMediaWidget.cpp
+53
-45
UBMediaWidget.h
src/customWidgets/UBMediaWidget.h
+6
-6
No files found.
src/customWidgets/UBMediaWidget.cpp
View file @
6cafdcfc
...
...
@@ -26,6 +26,8 @@ UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name)
,
mpMediaObject
(
NULL
)
,
mpVideoWidget
(
NULL
)
,
mpAudioOutput
(
NULL
)
,
mpLayout
(
NULL
)
,
mpSeekerLayout
(
NULL
)
,
mpPlayStopButton
(
NULL
)
,
mpPauseButton
(
NULL
)
,
mpSlider
(
NULL
)
...
...
@@ -33,15 +35,16 @@ UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name)
,
mGeneratingThumbnail
(
false
)
,
mBorder
(
5
)
,
mpMediaContainer
(
NULL
)
,
mMediaLayout
(
NULL
)
,
mpCover
(
NULL
)
// , mpVideoStackedWidget(NULL)
// , mpSnapshotVideoWidget(NULL)
,
mpSnapshotVideoWidget
(
NULL
)
{
SET_STYLE_SHEET
();
addAction
(
eAction_Close
);
mType
=
type
;
setLayout
(
&
mLayout
);
mpLayout
=
new
QVBoxLayout
(
this
);
setLayout
(
mpLayout
);
mpPlayStopButton
=
new
UBMediaButton
(
this
);
mpPlayStopButton
->
setPixmap
(
QPixmap
(
":images/play.svg"
));
...
...
@@ -53,10 +56,11 @@ UBMediaWidget::UBMediaWidget(eMediaType type, QWidget *parent, const char *name)
mpSlider
->
setMinimum
(
0
);
mpSlider
->
setMaximum
(
0
);
mSeekerLayout
.
addWidget
(
mpPlayStopButton
,
0
);
mSeekerLayout
.
addWidget
(
mpPauseButton
,
0
);
mSeekerLayout
.
addWidget
(
mpSlider
,
1
);
mSeekerLayout
.
setContentsMargins
(
0
,
0
,
0
,
0
);
mpSeekerLayout
=
new
QHBoxLayout
(
this
);
mpSeekerLayout
->
addWidget
(
mpPlayStopButton
,
0
);
mpSeekerLayout
->
addWidget
(
mpPauseButton
,
0
);
mpSeekerLayout
->
addWidget
(
mpSlider
,
1
);
mpSeekerLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
connect
(
mpPlayStopButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onPlayStopClicked
()));
connect
(
mpPauseButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
onPauseClicked
()));
...
...
@@ -74,10 +78,13 @@ UBMediaWidget::~UBMediaWidget()
DELETEPTR
(
mpPlayStopButton
);
DELETEPTR
(
mpAudioOutput
);
DELETEPTR
(
mpVideoWidget
);
// DELETEPTR(mpVideoStackedWidget);
// DELETEPTR(mpSnapshotVideoWidget);
DELETEPTR
(
mpMediaObject
);
DELETEPTR
(
mpCover
);
DELETEPTR
(
mpSnapshotVideoWidget
);
DELETEPTR
(
mpVideoStackedWidget
);
DELETEPTR
(
mpMediaContainer
);
DELETEPTR
(
mpSeekerLayout
);
DELETEPTR
(
mpLayout
);
}
/**
...
...
@@ -109,10 +116,14 @@ eMediaType UBMediaWidget::mediaType()
void
UBMediaWidget
::
showEvent
(
QShowEvent
*
event
)
{
if
(
!
mpVideoWidget
){
mpSnapshotVideoWidget
=
new
QLabel
(
this
);
mpVideoWidget
=
new
Phonon
::
VideoWidget
(
this
);
mMediaLayout
.
addStretch
(
1
);
mMediaLayout
.
addWidget
(
mpVideoWidget
,
0
);
mMediaLayout
.
addStretch
(
1
);
mpVideoStackedWidget
=
new
QStackedWidget
(
this
);
mpVideoStackedWidget
->
addWidget
(
mpVideoWidget
);
mpVideoStackedWidget
->
addWidget
(
mpSnapshotVideoWidget
);
mMediaLayout
->
addStretch
(
1
);
mMediaLayout
->
addWidget
(
mpVideoStackedWidget
,
0
);
mMediaLayout
->
addStretch
(
1
);
Phonon
::
createPath
(
mpMediaObject
,
mpVideoWidget
);
adaptSizeToVideo
();
mpMediaObject
->
play
();
...
...
@@ -135,41 +146,39 @@ void UBMediaWidget::createMediaPlayer()
{
mpMediaContainer
=
new
QWidget
(
this
);
mpMediaContainer
->
setObjectName
(
"UBMediaVideoContainer"
);
mpMediaContainer
->
setLayout
(
&
mMediaLayout
);
mMediaLayout
=
new
QHBoxLayout
(
this
);
mpMediaContainer
->
setLayout
(
mMediaLayout
);
if
(
eMediaType_Video
==
mType
){
mMediaLayout
.
setContentsMargins
(
10
,
10
,
10
,
10
);
mMediaLayout
->
setContentsMargins
(
10
,
10
,
10
,
10
);
if
(
isVisible
()){
mpSnapshotVideoWidget
=
new
QLabel
(
this
);
mpVideoWidget
=
new
Phonon
::
VideoWidget
(
this
);
mMediaLayout
.
addStretch
(
1
);
// mpVideoStackedWidget = new QStackedWidget(this);
// mpVideoStackedWidget->addWidget(mpVideoWidget);
// mpSnapshotVideoWidget = new QLabel(this);
// mpVideoStackedWidget->addWidget(mpSnapshotVideoWidget);
// mMediaLayout.addWidget(mpVideoStackedWidget,0);
mMediaLayout
.
addWidget
(
mpVideoWidget
,
0
);
mMediaLayout
.
addStretch
(
1
);
mpVideoStackedWidget
=
new
QStackedWidget
(
this
);
mpVideoStackedWidget
->
addWidget
(
mpVideoWidget
);
mpVideoStackedWidget
->
addWidget
(
mpSnapshotVideoWidget
);
mMediaLayout
->
addStretch
(
1
);
mMediaLayout
->
addWidget
(
mpVideoStackedWidget
,
0
);
mMediaLayout
->
addStretch
(
1
);
Phonon
::
createPath
(
mpMediaObject
,
mpVideoWidget
);
adaptSizeToVideo
();
}
mpAudioOutput
=
new
Phonon
::
AudioOutput
(
Phonon
::
VideoCategory
,
this
);
Phonon
::
createPath
(
mpMediaObject
,
mpAudioOutput
);
}
else
if
(
eMediaType_Audio
==
mType
){
mMediaLayout
.
setContentsMargins
(
10
,
10
,
10
,
10
);
mMediaLayout
->
setContentsMargins
(
10
,
10
,
10
,
10
);
mpCover
=
new
QLabel
(
mpMediaContainer
);
mpMediaContainer
->
setStyleSheet
(
QString
(
"background: none;"
));
setAudioCover
(
":images/libpalette/soundIcon.svg"
);
mpCover
->
setScaledContents
(
true
);
mMediaLayout
.
addStretch
(
1
);
mMediaLayout
.
addWidget
(
mpCover
,
0
);
mMediaLayout
.
addStretch
(
1
);
mMediaLayout
->
addStretch
(
1
);
mMediaLayout
->
addWidget
(
mpCover
,
0
);
mMediaLayout
->
addStretch
(
1
);
mpAudioOutput
=
new
Phonon
::
AudioOutput
(
Phonon
::
MusicCategory
,
this
);
Phonon
::
createPath
(
mpMediaObject
,
mpAudioOutput
);
}
m
Layout
.
addWidget
(
mpMediaContainer
,
1
);
m
Layout
.
addLayout
(
&
m
SeekerLayout
,
0
);
m
pLayout
->
addWidget
(
mpMediaContainer
,
1
);
m
pLayout
->
addLayout
(
mp
SeekerLayout
,
0
);
setActionsParent
(
mpMediaContainer
);
}
...
...
@@ -188,21 +197,19 @@ void UBMediaWidget::adaptSizeToVideo()
}
}
//void UBMediaWidget::updateView(Phonon::State nextState)
//{
// if(eMediaType_Video == mType){
// if(nextState != Phonon::PlayingState){
// const QPixmap& snapshot = QPixmap::grabWindow(mpVideoWidget->winId());
// if(snapshot.size().width()!= 0){
// mpSnapshotVideoWidget->setPixmap(snapshot);
// mpVideoStackedWidget->setCurrentWidget(mpSnapshotVideoWidget);
// }
// }
// else
// mpVideoStackedWidget->setCurrentWidget(mpVideoWidget);
// }
void
UBMediaWidget
::
updateView
(
Phonon
::
State
nextState
)
{
if
(
eMediaType_Video
==
mType
){
if
(
nextState
!=
Phonon
::
PlayingState
){
const
QPixmap
&
snapshot
=
QPixmap
::
grabWindow
(
mpVideoWidget
->
winId
());
mpSnapshotVideoWidget
->
setPixmap
(
snapshot
);
mpVideoStackedWidget
->
setCurrentWidget
(
mpSnapshotVideoWidget
);
}
else
mpVideoStackedWidget
->
setCurrentWidget
(
mpVideoWidget
);
}
//
}
}
/**
* \brief Handle the media state change notification
...
...
@@ -232,7 +239,8 @@ void UBMediaWidget::onStateChanged(Phonon::State newState, Phonon::State oldStat
mpPauseButton
->
setEnabled
(
false
);
mpSlider
->
setValue
(
0
);
}
//updateView(newState);
if
(
mType
==
eMediaType_Video
)
updateView
(
newState
);
}
}
...
...
src/customWidgets/UBMediaWidget.h
View file @
6cafdcfc
...
...
@@ -91,7 +91,7 @@ private slots:
private
:
void
createMediaPlayer
();
void
adaptSizeToVideo
();
//
void updateView(Phonon::State nextState);
void
updateView
(
Phonon
::
State
nextState
);
/** The current media type */
eMediaType
mType
;
...
...
@@ -102,9 +102,9 @@ private:
/** The audio renderer */
Phonon
::
AudioOutput
*
mpAudioOutput
;
/** The principal layout of this widget */
QVBoxLayout
m
Layout
;
QVBoxLayout
*
mp
Layout
;
/** The seeker layout */
QHBoxLayout
m
SeekerLayout
;
QHBoxLayout
*
mp
SeekerLayout
;
/** The play-stop button */
UBMediaButton
*
mpPlayStopButton
;
/** The pause button */
...
...
@@ -120,14 +120,14 @@ private:
/** A widget that will contain the media */
QWidget
*
mpMediaContainer
;
/** The media layout */
QHBoxLayout
mMediaLayout
;
QHBoxLayout
*
mMediaLayout
;
/** The audio cover */
QLabel
*
mpCover
;
/** The media url */
QString
mUrl
;
//
QStackedWidget* mpVideoStackedWidget;
//
QLabel* mpSnapshotVideoWidget;
QStackedWidget
*
mpVideoStackedWidget
;
QLabel
*
mpSnapshotVideoWidget
;
};
#endif // UBMEDIAWIDGET_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