summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/multimedia/audioinput/audioinput.cpp21
-rw-r--r--examples/multimedia/audioinput/audioinput.h5
2 files changed, 18 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";
}
diff --git a/examples/multimedia/audioinput/audioinput.h b/examples/multimedia/audioinput/audioinput.h
index a32a374..f1ab254 100644
--- a/examples/multimedia/audioinput/audioinput.h
+++ b/examples/multimedia/audioinput/audioinput.h
@@ -126,5 +126,10 @@ private:
QIODevice *m_input;
bool m_pullMode;
QByteArray m_buffer;
+
+ static const QString PushModeLabel;
+ static const QString PullModeLabel;
+ static const QString SuspendLabel;
+ static const QString ResumeLabel;
};