diff options
author | Topi Reinio <topi.reinio@digia.com> | 2013-01-14 12:11:09 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-25 16:33:50 +0100 |
commit | 52ad3219f073b87cfc1c57ced77266e3e7fad7ee (patch) | |
tree | bb98e94c12be777521c1af7f4c82d5cd4e4e53a8 /src/multimedia/doc/snippets/multimedia-snippets | |
parent | 101c78983a8acd6cc7a7cb314700fabd6e8909dc (diff) | |
download | qtmultimedia-52ad3219f073b87cfc1c57ced77266e3e7fad7ee.tar.gz |
QAudioInput/Output documentation: Fix slot naming in snippets
Having a code snippet use a slot (stateChanged) with a name
identical to a signal in QAudioInput / QAudioOutput classes causes
problems (incorrect links) in class documentation that refer to
the snippet code.
This change renames the slots according to standard Qt convention.
Same change is applied to example applications as well.
Task-number: QTBUG-26688
Change-Id: I0c6181240237d0c642b73fe18f3ddb5137b7f207
Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@gmail.com>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Diffstat (limited to 'src/multimedia/doc/snippets/multimedia-snippets')
-rw-r--r-- | src/multimedia/doc/snippets/multimedia-snippets/audio.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/multimedia/doc/snippets/multimedia-snippets/audio.cpp b/src/multimedia/doc/snippets/multimedia-snippets/audio.cpp index 42f5a4065..f5901f1aa 100644 --- a/src/multimedia/doc/snippets/multimedia-snippets/audio.cpp +++ b/src/multimedia/doc/snippets/multimedia-snippets/audio.cpp @@ -58,12 +58,12 @@ public: public Q_SLOTS: void stopRecording(); - void stateChanged(QAudio::State newState); + void handleStateChanged(QAudio::State newState); private: //! [Audio input class members] - QFile destinationFile; // class member. - QAudioInput* audio; // class member. + QFile destinationFile; // Class member + QAudioInput* audio; // Class member //! [Audio input class members] }; @@ -75,7 +75,7 @@ void AudioInputExample::setup() destinationFile.open( QIODevice::WriteOnly | QIODevice::Truncate ); QAudioFormat format; - // set up the format you want, eg. + // Set up the desired format, for example: format.setSampleRate(8000); format.setChannelCount(1); format.setSampleSize(8); @@ -85,12 +85,12 @@ void AudioInputExample::setup() QAudioDeviceInfo info = QAudioDeviceInfo::defaultInputDevice(); if (!info.isFormatSupported(format)) { - qWarning()<<"default format not supported try to use nearest"; + qWarning() << "Default format not supported, trying to use the nearest."; format = info.nearestFormat(format); } audio = new QAudioInput(format, this); - connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(stateChanged(QAudio::State))); + connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State))); QTimer::singleShot(3000, this, SLOT(stopRecording())); audio->start(&destinationFile); @@ -108,7 +108,7 @@ void AudioInputExample::stopRecording() //! [Audio input stop recording] //! [Audio input state changed] -void AudioInputExample::stateChanged(QAudio::State newState) +void AudioInputExample::handleStateChanged(QAudio::State newState) { switch (newState) { case QAudio::StoppedState: @@ -137,7 +137,7 @@ public: void setup(); public Q_SLOTS: - void stateChanged(QAudio::State newState); + void handleStateChanged(QAudio::State newState); private: //! [Audio output class members] @@ -164,18 +164,18 @@ void AudioOutputExample::setup() QAudioDeviceInfo info(QAudioDeviceInfo::defaultOutputDevice()); if (!info.isFormatSupported(format)) { - qWarning() << "raw audio format not supported by backend, cannot play audio."; + qWarning() << "Raw audio format not supported by backend, cannot play audio."; return; } audio = new QAudioOutput(format, this); - connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(stateChanged(QAudio::State))); + connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State))); audio->start(&sourceFile); } //! [Audio output setup] //! [Audio output state changed] -void AudioOutputExample::stateChanged(QAudio::State newState) +void AudioOutputExample::handleStateChanged(QAudio::State newState) { switch (newState) { case QAudio::IdleState: @@ -225,7 +225,7 @@ public: void decode(); public Q_SLOTS: - void stateChanged(QAudio::State newState); + void handleStateChanged(QAudio::State newState); void readBuffer(); }; |