summaryrefslogtreecommitdiffstats
path: root/examples/multimedia/audioinput
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-02-16 17:35:38 (GMT)
committerGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-02-16 18:18:49 (GMT)
commit81a96e9da45cbdf0bab221e3dd0b617ec7dcb890 (patch)
tree2d78541829a5ac01353f9e51b0dee46ebc7e2c1f /examples/multimedia/audioinput
parent77818e65f47fe211f328649085a297c9d2baeb45 (diff)
downloadQt-81a96e9da45cbdf0bab221e3dd0b617ec7dcb890.zip
Qt-81a96e9da45cbdf0bab221e3dd0b617ec7dcb890.tar.gz
Qt-81a96e9da45cbdf0bab221e3dd0b617ec7dcb890.tar.bz2
Removed redundant strings from audio input example
Reviewed-by: trustme
Diffstat (limited to 'examples/multimedia/audioinput')
-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;
};