diff --git a/modules/gui/qt4/ui/messages_panel.ui b/modules/gui/qt4/ui/messages_panel.ui index 5832847e847e7beba7347e3f6f725a2b0846c44b..9efc353e095af818c6846085f1b6e6ecbb746dde 100644 --- a/modules/gui/qt4/ui/messages_panel.ui +++ b/modules/gui/qt4/ui/messages_panel.ui @@ -49,13 +49,19 @@ - + true + + 0 + 2 + + 0 + @@ -111,6 +117,13 @@ + + + DebugLevelSpinBox + QSpinBox +
util/customwidgets.hpp
+
+
diff --git a/modules/gui/qt4/util/customwidgets.cpp b/modules/gui/qt4/util/customwidgets.cpp index a83d94dbd9e44510cdcda725238805069f0e4fa7..3a661a2f8f8133195527bd7844a2e9beca89dd21 100644 --- a/modules/gui/qt4/util/customwidgets.cpp +++ b/modules/gui/qt4/util/customwidgets.cpp @@ -227,6 +227,30 @@ void QVLCElidingLabel::paintEvent( QPaintEvent * event ) p.drawText( r, fontMetrics().elidedText( text(), elideMode, r.width() ), alignment() ); } +QString DebugLevelSpinBox::textFromValue( int v ) const +{ + QString const texts[] = { + /* Note that min level 0 is 'errors' in Qt Ui + FIXME: fix debug levels accordingly to documentation */ + /* qtr("infos"),*/ + qtr("errors"), + qtr("warnings"), + qtr("debug") + }; + if ( v < 0 ) v = 0; + if ( v >= 2 ) v = 2; + + 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 64d08dda335b06e6fd31c6c4d3ad4aad65dda367..e2338c6baa7eef8899bfc4e45dfc0063267acc0d 100644 --- a/modules/gui/qt4/util/customwidgets.hpp +++ b/modules/gui/qt4/util/customwidgets.hpp @@ -31,6 +31,7 @@ #include #include #include +#include /** This class provides a QLineEdit which contains a greyed-out hinting @@ -112,6 +113,16 @@ public: } }; +class DebugLevelSpinBox : public QSpinBox +{ + Q_OBJECT +public: + DebugLevelSpinBox( QWidget *parent ) : QSpinBox( parent ) { }; +protected: + QString textFromValue( int ) const; + int mapTextToValue ( bool * ); +}; + /* VLC Key/Wheel hotkeys interactions */ class QKeyEvent;