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

List:       kde-commits
Subject:    [Phonon-VLC] b434a6c: Introducing emitAboutToFinish to make emission
From:       Harald Sitter <sitter.harald () gmail ! com>
Date:       2010-10-12 15:18:04
Message-ID: 201010121518.o9CFI4j1001146 () kore ! kollide ! net
[Download RAW message or body]

commit b434a6c875f36ca239e81a5d27cd678a0d9dba86
Author: Harald Sitter <sitter.harald@gmail.com>
Date:   Tue Oct 12 17:15:19 2010 +0200

    Introducing emitAboutToFinish to make emission of aboutToFinish also
    condition to its associated bool being false, even for calls from
    outside (obviously then this function must be used ;))

diff --git a/vlc/mediaobject.cpp b/vlc/mediaobject.cpp
index fa517c1..fa90ef2 100644
--- a/vlc/mediaobject.cpp
+++ b/vlc/mediaobject.cpp
@@ -170,11 +170,7 @@ void MediaObject::tickInternalSlot(qint64 currentTime)
             }
         }
         if (currentTime >= totalTime - ABOUT_TO_FINISH_TIME) {
-            if (!b_about_to_finish_emitted) {
-                // Track is about to finish
-                b_about_to_finish_emitted = true;
-                emit aboutToFinish();
-            }
+            emitAboutToFinish();
         }
     }
 }
@@ -454,6 +450,15 @@ void MediaObject::setTransitionTime(qint32 time)
     i_transition_time = time;
 }
 
+void MediaObject::emitAboutToFinish()
+{
+    if (!b_about_to_finish_emitted) {
+        // Track is about to finish
+        b_about_to_finish_emitted = true;
+        emit aboutToFinish();
+    }
+}
+
 /**
  * If the new state is different from the current state, the current state is
  * changed and the corresponding signal is emitted.
diff --git a/vlc/mediaobject.h b/vlc/mediaobject.h
index 7cfa9e2..2fb4ee0 100644
--- a/vlc/mediaobject.h
+++ b/vlc/mediaobject.h
@@ -103,6 +103,8 @@ public:
     qint32 transitionTime() const;
     void setTransitionTime(qint32);
 
+    void emitAboutToFinish();
+
 signals:
 
     void aboutToFinish();
[prev in list] [next in list] [prev in thread] [next in thread] 

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