[vlmc-devel] NotificationZone: Remove progress(float) overload

Hugo Beauzée-Luyssen git at videolan.org
Mon Jul 4 15:34:41 CEST 2016


vlmc | branch: medialibrary | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Jun  6 01:10:43 2016 +0200| [81b65d80306981bff5c6eb22866923fec5f88906] | committer: Hugo Beauzée-Luyssen

NotificationZone: Remove progress(float) overload

> https://code.videolan.org/videolan/vlmc/commit/81b65d80306981bff5c6eb22866923fec5f88906
---

 src/Gui/widgets/NotificationZone.cpp | 6 ------
 src/Gui/widgets/NotificationZone.h   | 7 +------
 src/Media/Transcoder.cpp             | 7 ++++---
 src/Media/Transcoder.h               | 2 +-
 4 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/src/Gui/widgets/NotificationZone.cpp b/src/Gui/widgets/NotificationZone.cpp
index 7e15ea8..e3e3ff3 100644
--- a/src/Gui/widgets/NotificationZone.cpp
+++ b/src/Gui/widgets/NotificationZone.cpp
@@ -51,12 +51,6 @@ NotificationZone::notify( const QString &message )
 }
 
 void
-NotificationZone::progressUpdated( float ratio )
-{
-    progressUpdated( static_cast<int>( ratio * 100.0f ) );
-}
-
-void
 NotificationZone::progressUpdated( int percent )
 {
     m_ui->progressBar->show();
diff --git a/src/Gui/widgets/NotificationZone.h b/src/Gui/widgets/NotificationZone.h
index a697730..b093411 100644
--- a/src/Gui/widgets/NotificationZone.h
+++ b/src/Gui/widgets/NotificationZone.h
@@ -47,12 +47,7 @@ class NotificationZone : public QWidget, public Singleton<NotificationZone>
 
     public slots:
         void        notify( const QString& message );
-        /**
-         *  \brief  Update the progress bar.
-         *
-         *  \param  ratio   The progress ratio, from 0.0 to 1.0
-         */
-        void        progressUpdated( float ratio );
+
         /**
          *  \brief  Update the progress bar.
          *
diff --git a/src/Media/Transcoder.cpp b/src/Media/Transcoder.cpp
index 0c5aa9e..41e1222 100644
--- a/src/Media/Transcoder.cpp
+++ b/src/Media/Transcoder.cpp
@@ -38,8 +38,7 @@ Transcoder::Transcoder( Media* media )
     connect( this, &Transcoder::notify,
              NotificationZone::instance(), &NotificationZone::notify );
     connect( this, &Transcoder::progress,
-             NotificationZone::instance(),
-             static_cast<void(NotificationZone::*)(float)>(&NotificationZone::progressUpdated) );
+             NotificationZone::instance(), &NotificationZone::progressUpdated );
     m_eventWatcher = new Backend::VLC::RendererEventWatcher;
 }
 
@@ -62,7 +61,9 @@ Transcoder::transcodeToPs()
     m_destinationFile = outputDir + '/' + m_media->fileInfo()->baseName() + ".ps";
     m_renderer->setOutputFile( qPrintable( m_destinationFile ) );
     m_renderer->setName( qPrintable( QString( "Transcoder " ) + m_media->fileInfo()->baseName() ) );
-    connect( m_eventWatcher, &Backend::VLC::RendererEventWatcher::positionChanged, this, &Transcoder::progress );
+    connect( m_eventWatcher, &Backend::VLC::RendererEventWatcher::positionChanged, [this](float pos) {
+        emit progress(static_cast<int>( pos * 100 ) );
+    });
     connect( m_eventWatcher, &Backend::VLC::RendererEventWatcher::endReached, this, &Transcoder::transcodeFinished );
     emit notify( "Transcoding " + m_media->fileInfo()->absoluteFilePath() + " to " + m_destinationFile );
     m_renderer->start();
diff --git a/src/Media/Transcoder.h b/src/Media/Transcoder.h
index 72f93c6..12fcf2d 100644
--- a/src/Media/Transcoder.h
+++ b/src/Media/Transcoder.h
@@ -56,7 +56,7 @@ class Transcoder : public QObject
         void        transcodeFinished();
 
     signals:
-        void        progress( float pos );
+        void        progress( int percent );
         void        done();
         //used for notification:
         void        notify( QString );



More information about the Vlmc-devel mailing list