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

List:       kde-commits
Subject:    extragear/multimedia/amarok/playground/src/context
From:       Leo Franchi <lfranchi () kde ! org>
Date:       2009-05-28 14:02:27
Message-ID: 1243519347.216677.23711.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 974116 by lfranchi:

show video is new track playing has video to be shown, also clean up on
delete

 M  +31 -16    applets/videoclip/VideoclipApplet.cpp  
 M  +6 -4      applets/videoclip/VideoclipApplet.h  
 M  +2 -1      engines/videoclip/VideoclipEngine.cpp  


--- trunk/extragear/multimedia/amarok/playground/src/context/applets/videoclip/VideoclipApplet.cpp \
#974115:974116 @@ -58,8 +58,9 @@
 {
     DEBUG_BLOCK
     setHasConfigurationInterface( false );
-    m_mediaObject = const_cast<Phonon::MediaObject*>( \
                The::engineController()->phononMediaObject() );
-
+    
+    if( The::engineController() )
+        m_mediaObject = const_cast<Phonon::MediaObject*>( \
The::engineController()->phononMediaObject() );  }
 
 
@@ -116,19 +117,43 @@
     connect( dataEngine( "amarok-videoclip" ), SIGNAL( sourceAdded( const QString & \
) ),  this, SLOT( connectSource( const QString & ) ) );
 
+    engineNewTrackPlaying();// kickstart
 }
 
 VideoclipApplet::~VideoclipApplet()
 {
     DEBUG_BLOCK
-//    delete m_videoWidget;
+    delete m_videoWidget;
 }
 
-void EngineNewTrackPlaying()
+void 
+VideoclipApplet::engineNewTrackPlaying()
 {
-   // DEBUG_BLOCK
+    DEBUG_BLOCK
+    if( The::engineController() && !m_mediaObject )
+        m_mediaObject = const_cast<Phonon::MediaObject*>( \
The::engineController()->phononMediaObject() ); +    if ( m_videoWidget && \
m_mediaObject && m_mediaObject->hasVideo() ) +    {
+        debug() << " VideoclipApplet | Show VideoWidget";
+        m_videoWidget->show();
+    }
+    else if( m_videoWidget )
+    {
+        m_videoWidget->hide();
+    }
 }
 
+void 
+VideoclipApplet::enginePlaybackEnded( int finalPosition, int trackLength, \
PlaybackEndedReason reason ) +{
+    Q_UNUSED( finalPosition )
+    Q_UNUSED( trackLength )
+    Q_UNUSED( reason )
+    
+    if( m_videoWidget )
+        m_videoWidget->hide();
+}
+
 void VideoclipApplet::constraintsEvent( Plasma::Constraints constraints )
 {
     Q_UNUSED( constraints );
@@ -173,16 +198,6 @@
 {
     DEBUG_BLOCK
     Q_UNUSED( name )
-     // HACK
-    if ( m_mediaObject->hasVideo() )
-    {
-        debug() << " VideoclipApplet | Show VideoWidget";
-        m_videoWidget->show();
-    }
-    else
-    {
-        m_videoWidget->hide();
-    }
     
     int width = 130;
     // Properly delete previsouly allocated item
@@ -192,7 +207,7 @@
         m_layout->removeWidget( m_layoutWidgetList.front() );
         m_layoutWidgetList.pop_front();
     }
-
+    
     // if we get a message, show it
     if ( data.contains( "message" ) )
     {
--- trunk/extragear/multimedia/amarok/playground/src/context/applets/videoclip/VideoclipApplet.h \
#974115:974116 @@ -52,15 +52,17 @@
 
         void    constraintsEvent( Plasma::Constraints constraints = \
                Plasma::AllConstraints );
         QSizeF  sizeHint( Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) \
                const;
-
+        
+        // inherited from EngineObserver
+        virtual void engineNewTrackPlaying();
+        virtual void enginePlaybackEnded( int finalPosition, int trackLength, \
PlaybackEndedReason reason ); +        
+        
     public slots:
         void    dataUpdated( const QString& name, const Plasma::DataEngine::Data& \
data );  void    connectSource( const QString &source );
         void    appendVideoClip( );
 
-    protected:
-        void    EngineNewTrackPlaying();
-
     private:
         Phonon::MediaObject *m_mediaObject;
         Phonon::VideoWidget *m_videoWidget;
--- trunk/extragear/multimedia/amarok/playground/src/context/engines/videoclip/VideoclipEngine.cpp \
#974115:974116 @@ -68,6 +68,7 @@
 
 void VideoclipEngine::message( const ContextState& state )
 {
+    DEBUG_BLOCK
     if ( state == Current && m_requested )
         update();
 }
@@ -82,7 +83,7 @@
 
 void VideoclipEngine::update()
 {
-//   DEBUG_BLOCK
+    DEBUG_BLOCK
     QString tmpYoutStr;
     // prevent
     Meta::TrackPtr currentTrack = The::engineController()->currentTrack();


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

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