diff framework/MainWindowBase.cpp @ 485:21d3cf5c8f21 tony-2.0-integration

Add status bar "Recording" message and timer while recording
author Chris Cannam
date Wed, 16 Sep 2015 12:04:26 +0100
parents 01aeda073720
children 6eb28350050d
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Tue Sep 15 16:38:09 2015 +0100
+++ b/framework/MainWindowBase.cpp	Wed Sep 16 12:04:26 2015 +0100
@@ -231,6 +231,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)),
@@ -3357,6 +3359,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;