]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/util/customwidgets.cpp
Qt: emit video window resize events
[vlc] / modules / gui / qt4 / util / customwidgets.cpp
index f6e0e8a76f0095755407f0ac036eaeaac2bdeab3..8b766ead8aa16e7d3555470acae6ea975838e799 100644 (file)
@@ -87,6 +87,25 @@ QString QVLCDebugLevelSpinBox::textFromValue( int v ) const
     return QString( "%1 (%2)" ).arg( v ).arg( texts[v] );
 }
 
+VLCQDial::VLCQDial( QWidget *parent ) : QDial( parent )
+{
+
+}
+
+void VLCQDial::paintEvent( QPaintEvent *event )
+{
+    QDial::paintEvent( event );
+    QPainter painter( this );
+    painter.setPen( QPen( palette().color( QPalette::WindowText ) ) );
+    float radius = 0.5 * 0.707106 * qMin( size().width(), size().height() );
+    painter.drawText( QRectF( rect().center().x() + radius,
+                              rect().center().y() + radius,
+                              size().width(),
+                              size().height() ),
+                      0, QString::number( value() ), 0 );
+    painter.end();
+}
+
 /***************************************************************************
  * Hotkeys converters
  ***************************************************************************/
@@ -116,8 +135,8 @@ static const vlc_qt_key_t keys[] =
     { Qt::Key_Enter,                 '\r' }, // numeric pad
     { Qt::Key_Insert,                KEY_INSERT },
     { Qt::Key_Delete,                KEY_DELETE },
-    // Qt::Key_Pause
-    // Qt::Key_Print
+    { Qt::Key_Pause,                 KEY_PAUSE },
+    { Qt::Key_Print,                 KEY_PRINT },
     // Qt::Key_SysReq
     // Qt::Key_Clear
     { Qt::Key_Home,                  KEY_HOME },
@@ -234,7 +253,8 @@ static const vlc_qt_key_t keys[] =
     // Qt::Key_LaunchMail
     // Qt::Key_LaunchMedia
     /* Qt::Key_Launch0 through Qt::Key_LaunchF */
-    // Qt::Key_MediaLast
+    /* ... */
+    { Qt::Key_Reload,                KEY_BROWSER_REFRESH },
 };
 
 static int keycmp( const void *a, const void *b )
@@ -286,9 +306,9 @@ int qtWheelEventToVLCKey( QWheelEvent *e )
     return i_vlck;
 }
 
-QString VLCKeyToString( unsigned val )
+QString VLCKeyToString( unsigned val, bool locale )
 {
-    char *base = vlc_keycode2str (val, true);
+    char *base = vlc_keycode2str (val, locale);
     if (base == NULL)
         return qtr( "Unset" );
 
@@ -298,28 +318,6 @@ QString VLCKeyToString( unsigned val )
     return r;
 }
 
-PixmapAnimator::PixmapAnimator( QWidget *parent, QList<QString> frames )
-    : QAbstractAnimation( parent ), current_frame( 0 )
-{
-    foreach( QString name, frames )
-        pixmaps.append( new QPixmap( name ) );
-    currentPixmap = pixmaps.at( 0 );
-    setFps( frames.count() ); /* default to 1 sec loop */
-    setLoopCount( -1 );
-}
-
-void PixmapAnimator::updateCurrentTime( int msecs )
-{
-    int i = msecs / interval;
-    if ( i >= pixmaps.count() ) i = pixmaps.count() - 1; /* roundings */
-    if ( i != current_frame )
-    {
-        current_frame = i;
-        currentPixmap = pixmaps.at( current_frame );
-        emit pixmapReady( *currentPixmap );
-    }
-}
-
 /* Animated Icon implementation */
 SpinningIcon::SpinningIcon( QWidget *parent ) : QLabel( parent )
 {
@@ -400,3 +398,18 @@ void QToolButtonExt::clickedSlot()
     else if( shortClick )
         emit shortClicked();
 }
+
+YesNoCheckBox::YesNoCheckBox( QWidget *parent ) : QCheckBox( parent )
+{
+    setEnabled( false );
+    setStyleSheet("\
+                  QCheckBox::indicator:unchecked:hover,\
+                  QCheckBox::indicator:unchecked {\
+                      image: url(:/menu/quit);\
+                  }\
+                  QCheckBox::indicator:checked:hover,\
+                  QCheckBox::indicator:checked {\
+                      image: url(:/valid);\
+                  }\
+        ");
+}