[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: kdesupport/phonon
From:       Matthias Kretz <kretz () kde ! org>
Date:       2009-04-23 10:28:05
Message-ID: 200904231228.06678.kretz () kde ! org
[Download RAW message or body]

Good, only one small thing remaining for perfection.

On Thursday 23 April 2009 12:00:49 Marco Gulino wrote:
> -#define PHONON_INTERFACENAME VideoWidgetInterface
> +#define IFACES2 VideoWidgetInterface44
> +#define IFACES1 IFACES2
> +#define IFACES0 VideoWidgetInterface43, IFACES1
> +#define PHONON_INTERFACENAME IFACES0
>  
>  QT_BEGIN_NAMESPACE
>  
> @@ -102,8 +104,7 @@
>  
>  
>  QImage VideoWidget::snapshot() const {
> -    Iface<VideoWidgetInterface4> iface((VideoWidgetPrivate*) (k_ptr));
> -    std::cerr << "interface: " << iface << "\n";
> +    Iface<VideoWidgetInterface44> iface((VideoWidgetPrivate*) (k_ptr));

make this

#define IFACES4 VideoWidgetInterface44
#define IFACES0 VideoWidgetInterface43, IFACES4
#define PHONON_INTERFACENAME IFACES0

...

QImage VideoWidget::snapshot() const
{
    K_D(const VideoWidget);
    ConstIface<IFACES4> iface(d);


The macros are meant such that when interface 4.5 is added you have
#define IFACES4 VideoWidgetInterface44, VideoWidgetInterface45

and then the code expands to 
ConstIface<VideoWidgetInterface44, VideoWidgetInterface45> iface(d);

Which is very important to make the code use the 4.5 interface. Otherwise the 
interface will be zero again...

Also, never access k_ptr (same as Qt's d_ptr) yourself (and never use C-casts 
anyway, you were casting away constness for no good reason). Always use the 
K_D macro or at least the k_func (d_func in Qt).

Regards,
	Matthias


-- 
________________________________________________________
Matthias Kretz (Germany)                            <><
http://Vir.homelinux.org/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic