videowidget.h

Go to the documentation of this file.
00001 /*  This file is part of the KDE project
00002     Copyright (C) 2005-2007 Matthias Kretz <kretz@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Lesser General Public
00006     License as published by the Free Software Foundation; either
00007     version 2.1 of the License, or (at your option) version 3, or any
00008     later version accepted by the membership of KDE e.V. (or its
00009     successor approved by the membership of KDE e.V.), Nokia Corporation 
00010     (or its successors, if any) and the KDE Free Qt Foundation, which shall
00011     act as a proxy defined in Section 6 of version 3 of the license.
00012 
00013     This library is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016     Lesser General Public License for more details.
00017 
00018     You should have received a copy of the GNU Lesser General Public 
00019     License along with this library.  If not, see <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 #ifndef Phonon_VIDEOWIDGET_H
00023 #define Phonon_VIDEOWIDGET_H
00024 
00025 #include "phonon_export.h"
00026 #include "phonondefs.h"
00027 #include "abstractvideooutput.h"
00028 #include <QtGui/QWidget>
00029 
00030 QT_BEGIN_HEADER
00031 QT_BEGIN_NAMESPACE
00032 
00033 class QString;
00034 
00035 #ifndef QT_NO_PHONON_VIDEO
00036 
00037 namespace Phonon
00038 {
00039 class AbstractVideoOutput;
00040     class VideoWidgetPrivate;
00056     class PHONON_EXPORT VideoWidget : public QWidget, public Phonon::AbstractVideoOutput
00057     {
00058         K_DECLARE_PRIVATE(VideoWidget)
00059         Q_OBJECT
00060         Q_ENUMS(AspectRatio ScaleMode)
00078         Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen)
00085         Q_PROPERTY(AspectRatio aspectRatio READ aspectRatio WRITE setAspectRatio)
00086 
00096         Q_PROPERTY(ScaleMode scaleMode READ scaleMode WRITE setScaleMode)
00097 
00103         Q_PROPERTY(qreal brightness READ brightness WRITE setBrightness)
00109         Q_PROPERTY(qreal contrast READ contrast WRITE setContrast)
00115         Q_PROPERTY(qreal hue READ hue WRITE setHue)
00121         Q_PROPERTY(qreal saturation READ saturation WRITE setSaturation)
00122 
00123         public:
00127             enum AspectRatio
00128             {
00133                 AspectRatioAuto = 0,
00139                 AspectRatioWidget = 1,
00144                 AspectRatio4_3 = 2,
00149                 AspectRatio16_9 = 3
00150 //X                 /**
00151 //X                  * Assume that every pixel of the video image needs to be displayed with the same
00152 //X                  * physical width and height. (1:1 image pixels, not imagewidth
00153 //X                  * = imageheight)
00154 //X                  */
00155 //X                 AspectRatioSquare = 4,
00156             };
00157 
00158             enum ScaleMode {
00159                 FitInView = 0,
00160                 ScaleAndCrop = 1
00161             };
00162 
00166             VideoWidget(QWidget *parent = 0);
00167 
00168             AspectRatio aspectRatio() const;
00169             ScaleMode scaleMode() const;
00170 
00171             qreal brightness() const;
00172             qreal contrast() const;
00173             qreal hue() const;
00174             qreal saturation() const;
00175             QImage snapshot() const;
00176 
00177             //TODO: bar colors property
00178         public Q_SLOTS:
00179             void setFullScreen(bool fullscreen);
00180 
00184             void exitFullScreen();
00185 
00189             void enterFullScreen();
00190 
00191             void setAspectRatio(AspectRatio);
00192             void setScaleMode(ScaleMode);
00193 
00194             void setBrightness(qreal value);
00195             void setContrast(qreal value);
00196             void setHue(qreal value);
00197             void setSaturation(qreal value);
00198 
00199         protected:
00206             VideoWidget(VideoWidgetPrivate &d, QWidget *parent);
00207 
00208             void mouseMoveEvent(QMouseEvent *);
00209             bool event(QEvent *);
00210     };
00211 
00212 } //namespace Phonon
00213 
00214 #endif //QT_NO_PHONON_VIDEO
00215 
00216 QT_END_NAMESPACE
00217 QT_END_HEADER
00218 
00219 // vim: sw=4 ts=4 tw=80
00220 #endif // Phonon_VIDEOWIDGET_H