Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /* This file is part of the KDE project |
---|---|
2 | Copyright (C) 2007 Matthias Kretz <kretz@kde.org> |
3 | |
4 | Permission to use, copy, modify, and distribute this software |
5 | and its documentation for any purpose and without fee is hereby |
6 | granted, provided that the above copyright notice appear in all |
7 | copies and that both that the copyright notice and this |
8 | permission notice and warranty disclaimer appear in supporting |
9 | documentation, and that the name of the author not be used in |
10 | advertising or publicity pertaining to distribution of the |
11 | software without specific, written prior permission. |
12 | |
13 | The author disclaim all warranties with regard to this |
14 | software, including all implied warranties of merchantability |
15 | and fitness. In no event shall the author be liable for any |
16 | special, indirect or consequential damages or any damages |
17 | whatsoever resulting from loss of use, data or profits, whether |
18 | in an action of contract, negligence or other tortious action, |
19 | arising out of or in connection with the use or performance of |
20 | this software. |
21 | |
22 | */ |
23 | |
24 | #include "videoplayback.h" |
25 | |
26 | #include <QtGui/QBoxLayout> |
27 | |
28 | #include <phonon/videopath.h> |
29 | #include <phonon/audiooutput.h> |
30 | #include <phonon/audiopath.h> |
31 | #include <phonon/mediaobject.h> |
32 | #include <phonon/ui/videowidget.h> |
33 | #include <phonon/ui/mediacontrols.h> |
34 | |
35 | using namespace Phonon; |
36 | |
37 | MediaPlayer::MediaPlayer(QWidget *parent) |
38 | : QWidget(parent) |
39 | { |
40 | QVBoxLayout *layout = new QVBoxLayout(this); |
41 | |
42 | m_vwidget = new VideoWidget(this); |
43 | layout->addWidget(m_vwidget); |
44 | m_vwidget->hide(); |
45 | |
46 | m_vpath = new VideoPath(this); |
47 | |
48 | // might need VideoCategory here |
49 | m_aoutput = new AudioOutput(Phonon::MusicCategory, this); |
50 | m_apath = new AudioPath(this); |
51 | |
52 | m_media = new MediaObject(this); |
53 | m_media->addVideoPath(m_vpath); |
54 | m_vpath->addOutput(m_vwidget); |
55 | m_media->addAudioPath(m_apath); |
56 | m_apath->addOutput(m_aoutput); |
57 | |
58 | m_controls = new MediaControls(this); |
59 | layout->addWidget(m_controls); |
60 | m_controls->setMediaProducer(m_media); |
61 | m_controls->setAudioOutput(m_aoutput); |
62 | |
63 | connect(m_media, SIGNAL(hasVideoChanged(bool)), SLOT(hasVideoChanged(bool))); |
64 | } |
65 | |
66 | void MediaPlayer::setUrl(const KUrl &url) |
67 | { |
68 | m_media->setUrl(url); |
69 | m_vwidget->setVisible(m_media->hasVideo()); |
70 | } |
71 | |
72 | void MediaPlayer::hasVideoChanged(bool hasVideo) |
73 | { |
74 | m_vwidget->setVisible(hasVideo); |
75 | } |
76 | |
77 | int main() |
78 | { |
79 | return 0; |
80 | } |
81 | |
82 | #include "videoplayback.moc" |
83 |
Warning: That file was not part of the compilation database. It may have many parsing errors.