interface_widgets.hpp
Go to the documentation of this file.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 _INTFWIDGETS_H_
00027 #define _INTFWIDGETS_H_
00028
00029 #ifdef HAVE_CONFIG_H
00030 # include "config.h"
00031 #endif
00032
00033 #include "main_interface.hpp"
00034 #include "input_manager.hpp"
00035
00036 #include "components/controller.hpp"
00037 #include "components/controller_widget.hpp"
00038
00039 #include <QWidget>
00040 #include <QFrame>
00041 #include <QLabel>
00042 #include <QMouseEvent>
00043
00044 class ResizeEvent;
00045 class QPixmap;
00046 class QHBoxLayout;
00047 class QMenu;
00048 class QSlider;
00049 class ReparentableWidget;
00050
00051
00052 class VideoWidget : public QFrame
00053 {
00054 Q_OBJECT
00055 friend class ReparentableWidget;
00056
00057 public:
00058 VideoWidget( intf_thread_t * );
00059 virtual ~VideoWidget();
00060
00061 WId request( int *, int *, unsigned int *, unsigned int *, bool );
00062 void release( void );
00063 int control( void *, int, va_list );
00064
00065 protected:
00066 virtual QPaintEngine *paintEngine() const
00067 {
00068 return NULL;
00069 }
00070
00071 private:
00072 intf_thread_t *p_intf;
00073
00074 QWidget *reparentable;
00075 QLayout *layout;
00076 virtual bool eventFilter ( QObject * watched, QEvent * event );
00077 signals:
00078 void keyPressed( QKeyEvent * );
00079 void sizeChanged( int, int );
00080
00081 public slots:
00082 void SetSizing( unsigned int, unsigned int );
00083 void SetFullScreen( bool );
00084 };
00085
00086
00087 class BackgroundWidget : public QWidget
00088 {
00089 Q_OBJECT
00090 public:
00091 BackgroundWidget( intf_thread_t * );
00092 void setExpandstoHeight( bool b_expand ) { b_expandPixmap = b_expand; }
00093 private:
00094 QString pixmapUrl;
00095 bool b_expandPixmap;
00096 virtual void contextMenuEvent( QContextMenuEvent *event );
00097 intf_thread_t *p_intf;
00098 protected:
00099 void paintEvent( QPaintEvent *e );
00100 static const int MARGIN = 5;
00101 public slots:
00102 void toggle(){ TOGGLEV( this ); }
00103 void updateArt( const QString& );
00104 };
00105
00106 #if 0
00107 class VisualSelector : public QFrame
00108 {
00109 Q_OBJECT
00110 public:
00111 VisualSelector( intf_thread_t *);
00112 virtual ~VisualSelector();
00113 private:
00114 intf_thread_t *p_intf;
00115 QLabel *current;
00116 private slots:
00117 void prev();
00118 void next();
00119 };
00120 #endif
00121
00122 class TimeLabel : public QLabel
00123 {
00124 Q_OBJECT
00125 public:
00126 TimeLabel( intf_thread_t *_p_intf );
00127 protected:
00128 virtual void mousePressEvent( QMouseEvent *event )
00129 {
00130 toggleTimeDisplay();
00131 event->accept();
00132 }
00133 virtual void mouseDoubleClickEvent( QMouseEvent *event )
00134 {
00135 event->accept();
00136 toggleTimeDisplay();
00137 emit timeLabelDoubleClicked();
00138 }
00139 private:
00140 intf_thread_t *p_intf;
00141 bool b_remainingTime;
00142 int cachedLength;
00143 QTimer *bufTimer;
00144 float bufVal;
00145 bool buffering;
00146 bool showBuffering;
00147 char psz_length[MSTRTIME_MAX_SIZE];
00148 char psz_time[MSTRTIME_MAX_SIZE];
00149 void toggleTimeDisplay();
00150 void paintEvent( QPaintEvent* );
00151 signals:
00152 void timeLabelDoubleClicked();
00153 private slots:
00154 void setDisplayPosition( float pos, int64_t time, int length );
00155 void setDisplayPosition( float pos );
00156 void updateBuffering( float );
00157 void updateBuffering();
00158 };
00159
00160 class SpeedLabel : public QLabel
00161 {
00162 Q_OBJECT
00163 public:
00164 SpeedLabel( intf_thread_t *, QWidget * );
00165 virtual ~SpeedLabel();
00166
00167 protected:
00168 virtual void mousePressEvent ( QMouseEvent * event )
00169 {
00170 showSpeedMenu( event->pos() );
00171 }
00172 private slots:
00173 void showSpeedMenu( QPoint );
00174 void setRate( float );
00175 private:
00176 intf_thread_t *p_intf;
00177 QMenu *speedControlMenu;
00178 QString tooltipStringPattern;
00179 SpeedControlWidget *speedControl;
00180 };
00181
00182
00183 class SpeedControlWidget : public QFrame
00184 {
00185 Q_OBJECT
00186 public:
00187 SpeedControlWidget( intf_thread_t *, QWidget * );
00188 void updateControls( float );
00189 private:
00190 intf_thread_t *p_intf;
00191 QSlider *speedSlider;
00192 int lastValue;
00193
00194 public slots:
00195 void activateOnState();
00196
00197 private slots:
00198 void updateRate( int );
00199 void resetRate();
00200 };
00201
00202 class CoverArtLabel : public QLabel
00203 {
00204 Q_OBJECT
00205 public:
00206 CoverArtLabel( QWidget *parent, intf_thread_t * );
00207 virtual ~CoverArtLabel();
00208
00209 private:
00210 intf_thread_t *p_intf;
00211
00212 public slots:
00213 void requestUpdate() { emit updateRequested(); }
00214 void update( )
00215 {
00216 requestUpdate();
00217 }
00218 void showArtUpdate( const QString& );
00219
00220 private slots:
00221 void askForUpdate();
00222
00223 signals:
00224 void updateRequested();
00225 };
00226
00227 #endif