</widget>
</item>
<item row="1" column="1">
- <widget class="QSpinBox" name="verbosityBox">
+ <widget class="DebugLevelSpinBox" name="verbosityBox">
<property name="wrapping">
<bool>true</bool>
</property>
+ <property name="minimum">
+ <number>0</number>
+ </property>
<property name="maximum">
<number>2</number>
</property>
+ <property name="value">
+ <number>0</number>
+ </property>
</widget>
</item>
<item row="1" column="2">
</item>
</layout>
</widget>
+ <customwidgets>
+ <customwidget>
+ <class>DebugLevelSpinBox</class>
+ <extends>QSpinBox</extends>
+ <header>util/customwidgets.hpp</header>
+ </customwidget>
+ </customwidgets>
<resources/>
<connections/>
</ui>
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
***************************************************************************/
#include <QPushButton>
#include <QLabel>
#include <QStackedWidget>
+#include <QSpinBox>
/**
This class provides a QLineEdit which contains a greyed-out hinting
}
};
+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;