X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Futil%2Fcustomwidgets.cpp;h=3a661a2f8f8133195527bd7844a2e9beca89dd21;hb=b3564a7d8180f0e72111a485aaf4d46ab0be868e;hp=a83d94dbd9e44510cdcda725238805069f0e4fa7;hpb=0ab13a3aba48c5428286acb4c568886ea5077392;p=vlc diff --git a/modules/gui/qt4/util/customwidgets.cpp b/modules/gui/qt4/util/customwidgets.cpp index a83d94dbd9..3a661a2f8f 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 ***************************************************************************/