| 1 |
/* This file is part of the KDE project. |
| 2 |
|
| 3 |
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
| 4 |
|
| 5 |
This library is free software: you can redistribute it and/or modify |
| 6 |
it under the terms of the GNU Lesser General Public License as published by |
| 7 |
the Free Software Foundation, either version 2.1 or 3 of the License. |
| 8 |
|
| 9 |
This library is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
GNU Lesser General Public License for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU Lesser General Public License |
| 15 |
along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 16 |
|
| 17 |
*/ |
| 18 |
|
| 19 |
#include <QResizeEvent> |
| 20 |
|
| 21 |
#include <QtCore/private/qcore_symbian_p.h> // for qt_TRect2QRect |
| 22 |
#include <QtGui/private/qwidget_p.h> // to access QWExtra |
| 23 |
|
| 24 |
#include "utils.h" |
| 25 |
#include "videooutput_surface.h" |
| 26 |
|
| 27 |
QT_BEGIN_NAMESPACE |
| 28 |
|
| 29 |
using namespace Phonon; |
| 30 |
using namespace Phonon::MMF; |
| 31 |
|
| 32 |
SurfaceVideoOutput::SurfaceVideoOutput(QWidget *parent) |
| 33 |
: AbstractVideoOutput(parent) |
| 34 |
{ |
| 35 |
TRACE_CONTEXT(SurfaceVideoOutput::SurfaceVideoOutput, EVideoInternal); |
| 36 |
TRACE_ENTRY("parent 0x%08x", parent); |
| 37 |
|
| 38 |
qt_widget_private(this)->createExtra(); |
| 39 |
qt_widget_private(this)->extraData()->nativePaintMode = QWExtra::Disable; |
| 40 |
|
| 41 |
TRACE_EXIT_0(); |
| 42 |
} |
| 43 |
|
| 44 |
SurfaceVideoOutput::~SurfaceVideoOutput() |
| 45 |
{ |
| 46 |
TRACE_CONTEXT(SurfaceVideoOutput::~SurfaceVideoOutput, EVideoInternal); |
| 47 |
TRACE_ENTRY_0(); |
| 48 |
|
| 49 |
TRACE_EXIT_0(); |
| 50 |
} |
| 51 |
|
| 52 |
//----------------------------------------------------------------------------- |
| 53 |
// Public functions |
| 54 |
//----------------------------------------------------------------------------- |
| 55 |
|
| 56 |
|
| 57 |
//----------------------------------------------------------------------------- |
| 58 |
// Private functions |
| 59 |
//----------------------------------------------------------------------------- |
| 60 |
|
| 61 |
void MMF::SurfaceVideoOutput::resizeEvent(QResizeEvent *event) |
| 62 |
{ |
| 63 |
TRACE_CONTEXT(SurfaceVideoOutput::resizeEvent, EVideoInternal); |
| 64 |
TRACE("%d %d -> %d %d", |
| 65 |
event->oldSize().width(), event->oldSize().height(), |
| 66 |
event->size().width(), event->size().height()); |
| 67 |
|
| 68 |
if (event->size() != event->oldSize()) |
| 69 |
emit videoWindowSizeChanged(); |
| 70 |
} |
| 71 |
|
| 72 |
bool MMF::SurfaceVideoOutput::event(QEvent *event) |
| 73 |
{ |
| 74 |
TRACE_CONTEXT(SurfaceVideoOutput::event, EVideoInternal); |
| 75 |
|
| 76 |
if (event->type() == QEvent::WinIdChange) { |
| 77 |
TRACE_0("WinIdChange"); |
| 78 |
emit videoWindowChanged(); |
| 79 |
return true; |
| 80 |
} else { |
| 81 |
return QWidget::event(event); |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
|
| 86 |
QT_END_NAMESPACE |