diff framework/MainWindowBase.cpp @ 486:3dbc964f5907 recording

Add status bar "Recording" message and timer while recording
author Chris Cannam
date Wed, 16 Sep 2015 12:04:26 +0100
parents 493f2af85497
children 66b92c188cbd
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Tue Sep 15 16:34:08 2015 +0100
+++ b/framework/MainWindowBase.cpp	Wed Sep 16 12:04:26 2015 +0100
@@ -233,6 +233,8 @@
     if (m_soundOptions & WithAudioInput) {
         m_recordTarget = new AudioRecordTarget(m_viewManager,
                                                QApplication::applicationName());
+        connect(m_recordTarget, SIGNAL(recordDurationChanged(sv_frame_t, sv_samplerate_t)),
+                this, SLOT(recordDurationChanged(sv_frame_t, sv_samplerate_t)));
     }
 
     connect(m_playSource, SIGNAL(sampleRateMismatch(sv_samplerate_t, sv_samplerate_t, bool)),
@@ -3359,6 +3361,17 @@
 }
 
 void
+MainWindowBase::recordDurationChanged(sv_frame_t frame, sv_samplerate_t rate)
+{
+    RealTime duration = RealTime::frame2RealTime(frame, rate);
+    QString durStr = duration.toSecText().c_str();
+    
+    m_myStatusMessage = tr("Recording: %1").arg(durStr);
+
+    getStatusLabel()->setText(m_myStatusMessage);
+}
+
+void
 MainWindowBase::globalCentreFrameChanged(sv_frame_t )
 {
     if ((m_playSource && m_playSource->isPlaying()) || !getMainModel()) return;