[vlc-devel] [PATCH] VLC MiniMode Widget: SVG/CSS based Media Playback Notification and Controller

Rohit Yadav rohityadav89 at gmail.com
Wed Jun 10 02:26:17 CEST 2009

Greetings all,

For the past few days I was trying to add and fork the code as per the
suggestions of dev community.
First of all I tried to make a Ticker widget which scrolls the text in case
text's width exceeds widget's width. I used QPainter to do that but that
consumed a lot of CPU the way I coded then I used counters to scroll char
per unit time period which gave jerky output. So, I'm dropping the idea
right now.
If anyone wants to work on Ticker/Marquee widget, read my article on Ticker
in which i tried to describe few ways to do that and has CPP source code:

> +    /* Add Widgets to 'controls' container: Play/Pause, Previous, Next */
> +    QHBoxLayout *controls = new QHBoxLayout();
> +    QVBoxLayout *controlDock = new QVBoxLayout();
Why not a QGridLayout?
In this patch I used QGridLayout, but it showed inconsistency(Due to word
wrapping) as songs changed so I reverted back to QBoxLayouts. If not that, I
have to use at least two BoxLayouts with QGridLayout to avoid word-wrapping

Do we really need CSS, when using SvG?
The best way to customise a QWidget is to use CSS. The setStyleSheet() is a
part of QWidget and hence won't consume space for another module. I think Qt
software people have given us a nice API :-)
I also tried to hack in Qt4.5 source but could n't find good ways to
customise the QSliders(Found some ways by QPalette though, but the result
was dull) the way I did with CSS. So, kindly members of the community are
requested that if they have made their mind of not using CSS, they can
customise the widget (Even after wasting 4 days I got nothing) and do share
the code, I would like to learn.

> +    timer->setInterval( 5000 );
Use the same as FSC configuration variable.
JB-I don't know what you mean by that, my aim was to hide the widget and not
fade it(may be in future patches using Qt-Kinetics).

> +    connect( timer, SIGNAL( timeout() ), this, SLOT( hideWidget() ) );
All the coding style mistakes were corrected, but I using DISCONNECT() gave
compilation error. So, I used disconnect( timer, SIGNAL( timeout() ), this,
SLOT( hideWidget() ) instead.
Add DISCONNECT #define wherever CONNECT() is #define-d. Or edit it.

> +/* Volume Control Interfaces */
> +#define MNW_MAX_VOLUME 200
> +void MiniModeWidget::notifierVolumeChanged( int i_vol )
> +{
> +    int i_res = ( i_vol )  * ( AOUT_VOLUME_MAX / 2 ) / MNW_MAX_VOLUME;
> +    aout_VolumeSet( p_intf, i_res );
> +}
This should go to Action_Manager.hpp
I don't understand what exactly is wanted here. Refer that, this code was
forked from SoundWidget class that does n't use Action Manager. If this is
to be fixed then fix SoundWidget first in controller_widget.cpp/hpp

> +void MiniModeWidget::dropEvent( QDropEvent *event )
DO NOT duplicate code. Find a way to pass it to MI.
Fixed, passed a signal to MainInterface.

> +/* Sync UI Elements with Main Interface UI */
 > +void MiniModeWidget::syncNotifierController( const int &i_status )
> +{
> +    switch( i_status )
> +    {
> +        case 2: svgPlay->load(tr(":/svgs/pause.svg") ); b_toggle = false;
> +        case 4: /* STOP */
> +        case 3: svgPlay->load(tr(":/svgs/play.svg") );  b_toggle = true;
> +        default: break;
> +    }
> +}

States are generally better expressed with enumerated types instead of
bare numbers. Documenting the fall-through would be good, too.
Enums fixed, taken from vlc_input.h. Edit it if you think it's
algorithimically bad.

*Regarding SVGs*
Svgs has it's right for existence. The processing taken to render SVGs is
feasible and almost ~PNG.
Using QtSVG will add a module but with SVG we can increase the quality of
application. Like, my future aims are to re-construct the Fullscreen
Controller and into a cool UI like the one in Mac OSX or even better and
develop more widgets. Then, I can use the same SVGs use in this widget. So,
we can reuse our resources without affecting the quality. I can volunteer to
design all the pixmaps in SVGs. I think I have gained a certain amount of
artistic skills :-) to design them during the past 1-2 months.
I'm *not against not using SVGs*. I'm now working on forking the widget to
use PNGs instead of using SVG and will send that patch asap.

Ps. Devs, see to minor errors you can edit them :-) I'll be going on a short
vacation, so won't be available.

Comment. Forgive me for all my mistakes so far, do correct them. Thanks for
your all your support, esp. J-B, jpd, jetru.

Looking forward to your suggestion and comments.

Rohit Yadav
The Geek Says "Signing In and Signing Out".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090610/a9e9b41d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: miniMode-svg.patch
Type: text/x-patch
Size: 66442 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20090610/a9e9b41d/attachment.bin>

More information about the vlc-devel mailing list