summaryrefslogtreecommitdiffstats
path: root/examples/audiorecorder
diff options
context:
space:
mode:
Diffstat (limited to 'examples/audiorecorder')
-rw-r--r--examples/audiorecorder/audiorecorder.cpp225
-rw-r--r--examples/audiorecorder/audiorecorder.h88
-rw-r--r--examples/audiorecorder/audiorecorder.pro29
-rw-r--r--examples/audiorecorder/audiorecorder.ui250
-rw-r--r--examples/audiorecorder/audiorecorder_small.ui266
-rw-r--r--examples/audiorecorder/main.cpp57
6 files changed, 915 insertions, 0 deletions
diff --git a/examples/audiorecorder/audiorecorder.cpp b/examples/audiorecorder/audiorecorder.cpp
new file mode 100644
index 000000000..e4d28df14
--- /dev/null
+++ b/examples/audiorecorder/audiorecorder.cpp
@@ -0,0 +1,225 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/qdir.h>
+#include <QtGui/qfiledialog.h>
+
+#include <qaudiocapturesource.h>
+#include <qmediarecorder.h>
+
+#include "audiorecorder.h"
+
+#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(SYMBIAN_S60_3X)
+#include "ui_audiorecorder_small.h"
+#else
+#include "ui_audiorecorder.h"
+#endif
+
+AudioRecorder::AudioRecorder(QWidget *parent)
+ :
+ QMainWindow(parent),
+ ui(new Ui::AudioRecorder),
+ outputLocationSet(false)
+{
+ ui->setupUi(this);
+
+ audiosource = new QAudioCaptureSource(this);
+ capture = new QMediaRecorder(audiosource, this);
+
+ //audio devices
+ ui->audioDeviceBox->addItem(tr("Default"), QVariant(QString()));
+ foreach(const QString &device, audiosource->audioInputs()) {
+ ui->audioDeviceBox->addItem(device, QVariant(device));
+ }
+
+ //audio codecs
+ ui->audioCodecBox->addItem(tr("Default"), QVariant(QString()));
+ foreach(const QString &codecName, capture->supportedAudioCodecs()) {
+ ui->audioCodecBox->addItem(codecName, QVariant(codecName));
+ }
+
+ //containers
+ ui->containerBox->addItem(tr("Default"), QVariant(QString()));
+ foreach(const QString &containerName, capture->supportedContainers()) {
+ ui->containerBox->addItem(containerName, QVariant(containerName));
+ }
+
+ //sample rate:
+ ui->sampleRateBox->addItem(tr("Default"), QVariant(0));
+ foreach(int sampleRate, capture->supportedAudioSampleRates()) {
+ ui->sampleRateBox->addItem(QString::number(sampleRate), QVariant(
+ sampleRate));
+ }
+
+ ui->qualitySlider->setRange(0, int(QtMultimediaKit::VeryHighQuality));
+ ui->qualitySlider->setValue(int(QtMultimediaKit::NormalQuality));
+
+ //bitrates:
+ ui->bitrateBox->addItem(QString("Default"), QVariant(0));
+ ui->bitrateBox->addItem(QString("32000"), QVariant(32000));
+ ui->bitrateBox->addItem(QString("64000"), QVariant(64000));
+ ui->bitrateBox->addItem(QString("96000"), QVariant(96000));
+ ui->bitrateBox->addItem(QString("128000"), QVariant(128000));
+
+ connect(capture, SIGNAL(durationChanged(qint64)), this,
+ SLOT(updateProgress(qint64)));
+ connect(capture, SIGNAL(stateChanged(QMediaRecorder::State)), this,
+ SLOT(updateState(QMediaRecorder::State)));
+ connect(capture, SIGNAL(error(QMediaRecorder::Error)), this,
+ SLOT(displayErrorMessage()));
+ }
+
+AudioRecorder::~AudioRecorder()
+{
+ delete capture;
+ delete audiosource;
+}
+
+void AudioRecorder::updateProgress(qint64 duration)
+{
+ if (capture->error() != QMediaRecorder::NoError || duration < 2000)
+ return;
+
+ ui->statusbar->showMessage(tr("Recorded %1 sec").arg(qRound(duration / 1000)));
+}
+
+void AudioRecorder::updateState(QMediaRecorder::State state)
+{
+ QString statusMessage;
+
+ switch (state) {
+ case QMediaRecorder::RecordingState:
+ ui->recordButton->setText(tr("Stop"));
+ ui->pauseButton->setText(tr("Pause"));
+ if (capture->outputLocation().isEmpty())
+ statusMessage = tr("Recording");
+ else
+ statusMessage = tr("Recording to %1").arg(
+ capture->outputLocation().toString());
+ break;
+ case QMediaRecorder::PausedState:
+ ui->recordButton->setText(tr("Stop"));
+ ui->pauseButton->setText(tr("Resume"));
+ statusMessage = tr("Paused");
+ break;
+ case QMediaRecorder::StoppedState:
+ ui->recordButton->setText(tr("Record"));
+ ui->pauseButton->setText(tr("Pause"));
+ statusMessage = tr("Stopped");
+ }
+
+ ui->pauseButton->setEnabled(state != QMediaRecorder::StoppedState);
+
+ if (capture->error() == QMediaRecorder::NoError)
+ ui->statusbar->showMessage(statusMessage);
+}
+
+static QVariant boxValue(const QComboBox *box)
+{
+ int idx = box->currentIndex();
+ if (idx == -1)
+ return QVariant();
+
+ return box->itemData(idx);
+}
+
+void AudioRecorder::toggleRecord()
+{
+ if (capture->state() == QMediaRecorder::StoppedState) {
+ audiosource->setAudioInput(boxValue(ui->audioDeviceBox).toString());
+
+ if (!outputLocationSet)
+ capture->setOutputLocation(generateAudioFilePath());
+
+ QAudioEncoderSettings settings;
+ settings.setCodec(boxValue(ui->audioCodecBox).toString());
+ settings.setSampleRate(boxValue(ui->sampleRateBox).toInt());
+ settings.setBitRate(boxValue(ui->bitrateBox).toInt());
+ settings.setQuality(QtMultimediaKit::EncodingQuality(ui->qualitySlider->value()));
+ settings.setEncodingMode(ui->constantQualityRadioButton->isChecked() ?
+ QtMultimediaKit::ConstantQualityEncoding :
+ QtMultimediaKit::ConstantBitRateEncoding);
+
+ QString container = boxValue(ui->containerBox).toString();
+
+ capture->setEncodingSettings(settings, QVideoEncoderSettings(), container);
+ capture->record();
+ }
+ else {
+ capture->stop();
+ }
+}
+
+void AudioRecorder::togglePause()
+{
+ if (capture->state() != QMediaRecorder::PausedState)
+ capture->pause();
+ else
+ capture->record();
+}
+
+void AudioRecorder::setOutputLocation()
+{
+ QString fileName = QFileDialog::getSaveFileName();
+ capture->setOutputLocation(QUrl(fileName));
+ outputLocationSet = true;
+}
+
+void AudioRecorder::displayErrorMessage()
+{
+ ui->statusbar->showMessage(capture->errorString());
+}
+
+QUrl AudioRecorder::generateAudioFilePath()
+{
+ QDir outputDir(QDir::rootPath());
+
+ int lastImage = 0;
+ int fileCount = 0;
+ foreach(QString fileName, outputDir.entryList(QStringList() << "testclip_*")) {
+ int imgNumber = fileName.mid(5, fileName.size() - 9).toInt();
+ lastImage = qMax(lastImage, imgNumber);
+ if (outputDir.exists(fileName))
+ fileCount += 1;
+ }
+ lastImage += fileCount;
+ QUrl location(QDir::toNativeSeparators(outputDir.canonicalPath() + QString("/testclip_%1").arg(lastImage + 1, 4, 10, QLatin1Char('0'))));
+ return location;
+}
diff --git a/examples/audiorecorder/audiorecorder.h b/examples/audiorecorder/audiorecorder.h
new file mode 100644
index 000000000..3bcebf6ed
--- /dev/null
+++ b/examples/audiorecorder/audiorecorder.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef AUDIORECORDER_H
+#define AUDIORECORDER_H
+
+#include <QtCore/qurl.h>
+#include <QtGui/qmainwindow.h>
+
+#include <qmediarecorder.h>
+
+
+QT_BEGIN_NAMESPACE
+
+namespace Ui {
+ class AudioRecorder;
+}
+
+class QAudioCaptureSource;
+QT_END_NAMESPACE
+
+QT_USE_NAMESPACE
+
+class AudioRecorder : public QMainWindow
+{
+ Q_OBJECT
+public:
+ AudioRecorder(QWidget *parent = 0);
+ ~AudioRecorder();
+
+private slots:
+ void setOutputLocation();
+ void togglePause();
+ void toggleRecord();
+
+ void updateState(QMediaRecorder::State);
+ void updateProgress(qint64 pos);
+ void displayErrorMessage();
+ QUrl generateAudioFilePath();
+
+private:
+ Ui::AudioRecorder *ui;
+
+ QAudioCaptureSource* audiosource;
+ QMediaRecorder* capture;
+ QAudioEncoderSettings audioSettings;
+ bool outputLocationSet;
+
+};
+
+#endif
diff --git a/examples/audiorecorder/audiorecorder.pro b/examples/audiorecorder/audiorecorder.pro
new file mode 100644
index 000000000..99502414e
--- /dev/null
+++ b/examples/audiorecorder/audiorecorder.pro
@@ -0,0 +1,29 @@
+TEMPLATE = app
+CONFIG += example
+
+INCLUDEPATH += ../../src/multimedia ../../src/multimedia/audio
+include(../mobility_examples.pri)
+
+CONFIG += mobility
+MOBILITY = multimedia
+
+QMAKE_RPATHDIR += $$DESTDIR
+
+HEADERS = \
+ audiorecorder.h
+
+SOURCES = \
+ main.cpp \
+ audiorecorder.cpp
+
+maemo*: {
+ FORMS += audiorecorder_small.ui
+}else:symbian:contains(S60_VERSION, 3.2)|contains(S60_VERSION, 3.1){
+ DEFINES += SYMBIAN_S60_3X
+ FORMS += audiorecorder_small.ui
+}else {
+ FORMS += audiorecorder.ui
+}
+symbian: {
+ TARGET.CAPABILITY = UserEnvironment ReadDeviceData WriteDeviceData
+}
diff --git a/examples/audiorecorder/audiorecorder.ui b/examples/audiorecorder/audiorecorder.ui
new file mode 100644
index 000000000..8ade5ce8c
--- /dev/null
+++ b/examples/audiorecorder/audiorecorder.ui
@@ -0,0 +1,250 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AudioRecorder</class>
+ <widget class="QMainWindow" name="AudioRecorder">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>297</width>
+ <height>374</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0" colspan="3">
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Input Device:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="audioDeviceBox"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Audio Codec:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QComboBox" name="audioCodecBox"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>File Container:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QComboBox" name="containerBox"/>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Sample rate:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QComboBox" name="sampleRateBox"/>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0" colspan="3">
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Encoding Mode:</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0" colspan="2">
+ <widget class="QRadioButton" name="constantQualityRadioButton">
+ <property name="text">
+ <string>Constant Quality:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSlider" name="qualitySlider">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="2">
+ <widget class="QRadioButton" name="constantBitrateRadioButton">
+ <property name="text">
+ <string>Constant Bitrate:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="1">
+ <widget class="QComboBox" name="bitrateBox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QPushButton" name="outputButton">
+ <property name="text">
+ <string>Output...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QPushButton" name="recordButton">
+ <property name="text">
+ <string>Record</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QPushButton" name="pauseButton">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Pause</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>constantQualityRadioButton</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>qualitySlider</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>113</x>
+ <y>197</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>115</x>
+ <y>223</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>constantBitrateRadioButton</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>bitrateBox</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>173</x>
+ <y>259</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>190</x>
+ <y>291</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>outputButton</sender>
+ <signal>clicked()</signal>
+ <receiver>AudioRecorder</receiver>
+ <slot>setOutputLocation()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>46</x>
+ <y>340</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>6</x>
+ <y>302</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>recordButton</sender>
+ <signal>clicked()</signal>
+ <receiver>AudioRecorder</receiver>
+ <slot>toggleRecord()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>191</x>
+ <y>340</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>113</x>
+ <y>317</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>pauseButton</sender>
+ <signal>clicked()</signal>
+ <receiver>AudioRecorder</receiver>
+ <slot>togglePause()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>252</x>
+ <y>334</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>258</x>
+ <y>346</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+ <slots>
+ <slot>setOutputLocation()</slot>
+ <slot>toggleRecord()</slot>
+ <slot>togglePause()</slot>
+ </slots>
+</ui>
diff --git a/examples/audiorecorder/audiorecorder_small.ui b/examples/audiorecorder/audiorecorder_small.ui
new file mode 100644
index 000000000..9d23c4267
--- /dev/null
+++ b/examples/audiorecorder/audiorecorder_small.ui
@@ -0,0 +1,266 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AudioRecorder</class>
+ <widget class="QMainWindow" name="AudioRecorder">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>420</width>
+ <height>346</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget">
+ <layout class="QGridLayout" name="gridLayout_5">
+ <item row="0" column="0" colspan="3">
+ <widget class="QScrollArea" name="scrollArea">
+ <property name="focusPolicy">
+ <enum>Qt::ClickFocus</enum>
+ </property>
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="scrollAreaWidgetContents">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>398</width>
+ <height>275</height>
+ </rect>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_4">
+ <item row="0" column="0">
+ <widget class="QWidget" name="widget" native="true">
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Input Device:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QComboBox" name="audioDeviceBox"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Audio Codec:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QComboBox" name="audioCodecBox"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>File Container:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QComboBox" name="containerBox"/>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Sample rate:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QComboBox" name="sampleRateBox"/>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QRadioButton" name="constantQualityRadioButton">
+ <property name="text">
+ <string>Quality:</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QRadioButton" name="constantBitrateRadioButton">
+ <property name="text">
+ <string>Bitrate:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QSlider" name="qualitySlider">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QComboBox" name="bitrateBox">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>1</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>29</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QPushButton" name="outputButton">
+ <property name="text">
+ <string>Output...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QPushButton" name="recordButton">
+ <property name="text">
+ <string>Record</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QPushButton" name="pauseButton">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Pause</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>constantQualityRadioButton</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>qualitySlider</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>113</x>
+ <y>197</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>115</x>
+ <y>223</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>constantBitrateRadioButton</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>bitrateBox</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>173</x>
+ <y>259</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>190</x>
+ <y>291</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>outputButton</sender>
+ <signal>clicked()</signal>
+ <receiver>AudioRecorder</receiver>
+ <slot>setOutputLocation()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>46</x>
+ <y>340</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>6</x>
+ <y>302</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>recordButton</sender>
+ <signal>clicked()</signal>
+ <receiver>AudioRecorder</receiver>
+ <slot>toggleRecord()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>191</x>
+ <y>340</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>113</x>
+ <y>317</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>pauseButton</sender>
+ <signal>clicked()</signal>
+ <receiver>AudioRecorder</receiver>
+ <slot>togglePause()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>252</x>
+ <y>334</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>258</x>
+ <y>346</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+ <slots>
+ <slot>setOutputLocation()</slot>
+ <slot>toggleRecord()</slot>
+ <slot>togglePause()</slot>
+ </slots>
+</ui>
diff --git a/examples/audiorecorder/main.cpp b/examples/audiorecorder/main.cpp
new file mode 100644
index 000000000..7dee4f807
--- /dev/null
+++ b/examples/audiorecorder/main.cpp
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Mobility Components.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
+** the names of its contributors may be used to endorse or promote
+** products derived from this software without specific prior written
+** permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "audiorecorder.h"
+
+#include <QtGui>
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ AudioRecorder recorder;
+#ifdef Q_OS_SYMBIAN
+ recorder.showMaximized();
+#else
+ recorder.show();
+#endif
+
+ return app.exec();
+};