[vlc-commits] commit: Qt: misc simplifications and corrections (Jean-Baptiste Kempf )

git at videolan.org git at videolan.org
Tue Nov 30 21:47:07 CET 2010


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Nov 30 21:46:47 2010 +0100| [0734535dafba5a8ce68e1fa5b7778b92544fbb81] | committer: Jean-Baptiste Kempf 

Qt: misc simplifications and corrections

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0734535dafba5a8ce68e1fa5b7778b92544fbb81
---

 modules/gui/qt4/util/customwidgets.cpp |   17 ++---------------
 modules/gui/qt4/util/customwidgets.hpp |   11 +++++++----
 2 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/modules/gui/qt4/util/customwidgets.cpp b/modules/gui/qt4/util/customwidgets.cpp
index 13df63a..ffd7b4e 100644
--- a/modules/gui/qt4/util/customwidgets.cpp
+++ b/modules/gui/qt4/util/customwidgets.cpp
@@ -38,7 +38,7 @@
 #include <vlc_keys.h>
 
 QVLCFramelessButton::QVLCFramelessButton( QWidget *parent )
-  : QPushButton( parent )
+                    : QPushButton( parent )
 {
     setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
 }
@@ -51,13 +51,8 @@ void QVLCFramelessButton::paintEvent( QPaintEvent * )
     painter.drawPixmap( QRect( pos.x(), pos.y(), pix.width(), pix.height() ), pix );
 }
 
-QSize QVLCFramelessButton::sizeHint() const
-{
-    return iconSize();
-}
-
 QVLCElidingLabel::QVLCElidingLabel( const QString &s, Qt::TextElideMode mode, QWidget * parent )
-  : elideMode( mode ), QLabel( s, parent )
+                 : elideMode( mode ), QLabel( s, parent )
 { }
 
 void QVLCElidingLabel::setElideMode( Qt::TextElideMode mode )
@@ -90,14 +85,6 @@ QString DebugLevelSpinBox::textFromValue( int v ) const
     return QString( "%1 (%2)" ).arg( v ).arg( texts[v] );
 }
 
-int DebugLevelSpinBox::mapTextToValue ( bool *ok )
-{
-    int parsedvalue = cleanText().toInt();
-    /* fix range */
-    *ok = ( parsedvalue < 0 || parsedvalue > 2 )? FALSE : TRUE;
-    return parsedvalue;
-}
-
 /***************************************************************************
  * Hotkeys converters
  ***************************************************************************/
diff --git a/modules/gui/qt4/util/customwidgets.hpp b/modules/gui/qt4/util/customwidgets.hpp
index 79d8ec4..2385910 100644
--- a/modules/gui/qt4/util/customwidgets.hpp
+++ b/modules/gui/qt4/util/customwidgets.hpp
@@ -38,7 +38,7 @@ class QVLCFramelessButton : public QPushButton
     Q_OBJECT
 public:
     QVLCFramelessButton( QWidget *parent = NULL );
-    QSize sizeHint() const;
+    virtual QSize sizeHint() const { return iconSize(); }
 protected:
     virtual void paintEvent( QPaintEvent * event );
 };
@@ -51,11 +51,13 @@ public:
                       Qt::TextElideMode mode = Qt::ElideRight,
                       QWidget * parent = NULL );
     void setElideMode( Qt::TextElideMode );
+protected:
+    virtual void paintEvent( QPaintEvent * event );
 private:
-    void paintEvent( QPaintEvent * event );
     Qt::TextElideMode elideMode;
 };
 
+
 class QVLCStackedWidget : public QStackedWidget
 {
 public:
@@ -72,8 +74,9 @@ class DebugLevelSpinBox : public QSpinBox
 public:
     DebugLevelSpinBox( QWidget *parent ) : QSpinBox( parent ) { };
 protected:
-    QString textFromValue( int ) const;
-    int mapTextToValue ( bool * );
+    virtual QString textFromValue( int ) const;
+    /* DebugLevelSpinBox is read-only */
+    virtual int valueFromText( const QString& ) const { return -1; }
 };
 
 /* VLC Key/Wheel hotkeys interactions */



More information about the vlc-commits mailing list