00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef MPLAYERWIDGET_H_
00027 #define MPLAYERWIDGET_H_
00028 #include <QWidget>
00029 #include <QIcon>
00030 #include <QTimer>
00031 #include <QMouseEvent>
00032 #include "../../ui_mplayerWidget.h"
00033 #include "MPlayerControlAPI.h"
00034
00035
00036
00037
00038 class MPlayerControlAPI;
00039 class VideoOutputWidgetContainer;
00040 class VideoOutputWidget;
00041 class PlaylistEditorDialog;
00042
00043 class mplayerWidget: public QWidget {
00044 Q_OBJECT
00045 public:
00046 mplayerWidget(QWidget *parent = 0);
00047 virtual ~mplayerWidget();
00048 void refreshSize();
00049 void setInitialVolume(int volume);
00050 int getCurrentVolume();
00051 void setVolume(int volume);
00052 Ui_mplayerWidgetForm ui;
00053 QVBoxLayout *iVboxLayout;
00054 QString getMplayerVersion();
00055 int initMplayer();
00056 void setMouseTracker(QWidget *tracker);
00057 void HandleUiLanguageChange();
00058
00059 bool LoadPlaylist(const QString &playlistFilePathAndName);
00060 bool SavePlaylist(const QString &playlistFilePathAndName);
00061
00062 void PrepareToQuit();
00063
00064 void setInitialFile(const QString &filename);
00065
00066 PlaylistEditorDialog *iGlobalPlaylist;
00067 protected:
00068 QRect CalculateMplayerVideoOutputGeometry(QWidget *parent);
00069 void mouseMoveEvent ( QMouseEvent * event );
00070 private:
00071 void HandleMouseMovement();
00072 private:
00073 MPlayerControlAPI *iPlayerAPI;
00074 bool iSeeking;
00075 QWidget *iParent;
00076 QWidget *iMouseMovementReceiver;
00077 int iOldVolumeValue;
00078
00079
00080 QIcon *iMuteButtonMutedIcon;
00081 QIcon *iMuteButtonLowIcon;
00082 QIcon *iMuteButtonMediumIcon;
00083 QIcon *iMuteButtonHighIcon;
00084 QPixmap *iPlayPauseButtonIconPixmap;
00085
00086 QIcon *iToggleFullscreenButtonGoFullscreenIcon;
00087 QIcon *iToggleFullscreenButtonGoNormalIcon;
00088
00089 QTimer iButtonAnimationTimer;
00090
00091 QTimer iFullscreenControlsHideTimer;
00092
00093 int iPlayPauseButtonAlpha;
00094 bool iDecreaseAlpha;
00095 qreal iVideoAspectRatio;
00096 VideoOutputWidgetContainer *iVideoOutputContainer;
00097 QWidget *iExternalVideotargetWidget;
00098 QVBoxLayout *iExternalVideoLayout;
00099 public slots:
00100
00101 void progress(quint64 val);
00102 void setLength(qreal length);
00103 void FinishedPlayingCurrentFile();
00104 void SetVideoAspectRatio(qreal val);
00105
00106 void VolumeSliderValChanged(int newVal);
00107 void PositionSliderPress();
00108 void PositionSliderRelease();
00109
00110 void MuteClicked();
00111 void PlayPauseClicked();
00112 void StopClicked();
00113 void PreviousClicked();
00114 void NextClicked();
00115 void OpenfileButtonClicked();
00116 void FullScreenTogglePushButtonClicked();
00117
00118 void ButtonAnimationTimerTimeOut();
00119 void HideControlsTimerTimedOut();
00120
00121 void startPlaying(const QString &filenameWithFullpath);
00122
00123 void reCalculateVideoSize();
00124
00125 void controlWidgetGotMouse();
00126 void MouseMovementInMediaPlayer(const QMouseEvent &event);
00127
00128 void passMediaTitle(const QString &title);
00129 void passMediaArtist(const QString &artist);
00130 void passMediaCreationDate(const QString &creationDate);
00131 void passMediaAlbum(const QString &album);
00132 void passMediaFilename(const QString &filename);
00133
00134 void redirectVideoOut(QWidget *targetWidget);
00135 void takeBackVideoOut();
00136 signals:
00137
00138 void setprogressSliderVal(int val);
00139 void setvolumeSliderVal(int val);
00140 void videoWidgetSizeRecalculationRequired();
00141
00142 void nextInPlaylistRequested();
00143 void previousInPlaylistRequested();
00144 void currentInPlaylistRequested();
00145 void finishedPlayingFile();
00146 void playingStopped();
00147
00148 void wentFullscreen();
00149 void returnedNormal();
00150 void StartedPlaying( const QString& filename );
00151 void PlayingIconChange( const QIcon &icon );
00152 void gotMediaTitle(const QString &title);
00153 void gotMediaArtist(const QString &artist);
00154 void gotMediaCreationDate(const QString &creationDate);
00155 void gotMediaAlbum(const QString &album);
00156 void gotMediaFilename(const QString &filename);
00157
00158
00159 void PlayFile(const QString &filenameWithFullpath);
00160 };
00161
00162
00163
00164
00165
00166 class VideoOutputWidgetContainer : public QWidget
00167 {
00168 Q_OBJECT
00169 public:
00170 VideoOutputWidgetContainer(mplayerWidget *parent = 0):QWidget(parent)
00171 {
00172 iVideoOut = new QWidget(this);
00173 QObject::connect(this, SIGNAL(SizeChanged()), parent, SLOT(reCalculateVideoSize()));
00174 QObject::connect(this, SIGNAL(MouseLeft()), parent, SLOT(controlWidgetGotMouse()));
00175 QObject::connect(this, SIGNAL(MouseMoved(const QMouseEvent &)), parent, SLOT(MouseMovementInMediaPlayer(const QMouseEvent &)));
00176 setMouseTracking(true);
00177 iVideoOut->setMouseTracking(true);
00178 }
00179 virtual ~VideoOutputWidgetContainer()
00180 {
00181 delete iVideoOut;
00182 }
00183 QWidget *iVideoOut;
00184 protected:
00185 virtual void mouseMoveEvent ( QMouseEvent * event )
00186 {
00187 emit MouseMoved(QMouseEvent(*event));
00188 }
00189 virtual void resizeEvent( QResizeEvent * event)
00190 {
00191
00192
00193
00194
00195
00196 emit SizeChanged();
00197 }
00198 virtual void enterEvent( QEvent * event )
00199 {
00200 emit MouseEntered();
00201 }
00202 virtual void leaveEvent ( QEvent * event )
00203 {
00204
00205 if(!iVideoOut->underMouse())
00206 emit MouseLeft();
00207 }
00208 signals:
00209 void SizeChanged();
00210 void MouseEntered();
00211 void MouseLeft();
00212 void MouseMoved(const QMouseEvent &event);
00213 };
00214
00215
00216 #endif