summaryrefslogtreecommitdiffstats
path: root/examples/multimedia/audioinput/audioinput.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/multimedia/audioinput/audioinput.cpp')
-rw-r--r--examples/multimedia/audioinput/audioinput.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/examples/multimedia/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp
index 48763c9..10941ca 100644
--- a/examples/multimedia/audioinput/audioinput.cpp
+++ b/examples/multimedia/audioinput/audioinput.cpp
@@ -53,6 +53,11 @@
#include "audioinput.h"
+const QString InputTest::PushModeLabel(tr("Enable push mode"));
+const QString InputTest::PullModeLabel(tr("Enable pull mode"));
+const QString InputTest::SuspendLabel(tr("Suspend recording"));
+const QString InputTest::ResumeLabel(tr("Resume recording"));
+
const int BufferSize = 4096;
AudioInfo::AudioInfo(const QAudioFormat &format, QObject *parent)
@@ -232,12 +237,12 @@ void InputTest::initializeWindow()
layout->addWidget(m_deviceBox);
m_modeButton = new QPushButton(this);
- m_modeButton->setText(tr("Click for Push Mode"));
+ m_modeButton->setText(PushModeLabel);
connect(m_modeButton, SIGNAL(clicked()), SLOT(toggleMode()));
layout->addWidget(m_modeButton);
m_suspendResumeButton = new QPushButton(this);
- m_suspendResumeButton->setText(tr("Click To Suspend"));
+ m_suspendResumeButton->setText(SuspendLabel);
connect(m_suspendResumeButton, SIGNAL(clicked()), SLOT(toggleSuspend()));
layout->addWidget(m_suspendResumeButton);
@@ -305,17 +310,17 @@ void InputTest::toggleMode()
m_audioInput->stop();
if (m_pullMode) {
- m_modeButton->setText(tr("Click for Pull Mode"));
+ m_modeButton->setText(PullModeLabel);
m_input = m_audioInput->start();
connect(m_input, SIGNAL(readyRead()), SLOT(readMore()));
m_pullMode = false;
} else {
- m_modeButton->setText(tr("Click for Push Mode"));
+ m_modeButton->setText(PushModeLabel);
m_pullMode = true;
m_audioInput->start(m_audioInfo);
}
- m_suspendResumeButton->setText("Click To Suspend");
+ m_suspendResumeButton->setText(SuspendLabel);
}
void InputTest::toggleSuspend()
@@ -324,15 +329,15 @@ void InputTest::toggleSuspend()
if(m_audioInput->state() == QAudio::SuspendedState) {
qWarning() << "status: Suspended, resume()";
m_audioInput->resume();
- m_suspendResumeButton->setText("Click To Suspend");
+ m_suspendResumeButton->setText(SuspendLabel);
} else if (m_audioInput->state() == QAudio::ActiveState) {
qWarning() << "status: Active, suspend()";
m_audioInput->suspend();
- m_suspendResumeButton->setText("Click To Resume");
+ m_suspendResumeButton->setText(ResumeLabel);
} else if (m_audioInput->state() == QAudio::StoppedState) {
qWarning() << "status: Stopped, resume()";
m_audioInput->resume();
- m_suspendResumeButton->setText("Click To Suspend");
+ m_suspendResumeButton->setText(SuspendLabel);
} else if (m_audioInput->state() == QAudio::IdleState) {
qWarning() << "status: IdleState";
}