QAudioInput/Output documentation: Fix slot naming in snippets
authorTopi Reinio <topi.reinio@digia.com>
Mon, 14 Jan 2013 11:11:09 +0000 (12:11 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 25 Jan 2013 15:33:50 +0000 (16:33 +0100)
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>
examples/multimedia/audioinput/audioinput.cpp
examples/multimedia/audioinput/audioinput.h
examples/multimedia/audiooutput/audiooutput.cpp
examples/multimedia/audiooutput/audiooutput.h
src/multimedia/doc/snippets/multimedia-snippets/audio.cpp

index 7609368..4f9408a 100644 (file)
@@ -313,7 +313,7 @@ void InputTest::createAudioInput()
 {
     m_audioInput = new QAudioInput(m_device, m_format, this);
     connect(m_audioInput, SIGNAL(notify()), SLOT(notified()));
-    connect(m_audioInput, SIGNAL(stateChanged(QAudio::State)), SLOT(stateChanged(QAudio::State)));
+    connect(m_audioInput, SIGNAL(stateChanged(QAudio::State)), SLOT(handleStateChanged(QAudio::State)));
     m_volumeSlider->setValue(m_audioInput->volume() * 100);
     m_audioInfo->start();
     m_audioInput->start(m_audioInfo);
@@ -377,7 +377,7 @@ void InputTest::toggleSuspend()
     }
 }
 
-void InputTest::stateChanged(QAudio::State state)
+void InputTest::handleStateChanged(QAudio::State state)
 {
     qWarning() << "state = " << state;
 }
index b1cc1c2..82def56 100644 (file)
@@ -114,7 +114,7 @@ private slots:
     void readMore();
     void toggleMode();
     void toggleSuspend();
-    void stateChanged(QAudio::State state);
+    void handleStateChanged(QAudio::State state);
     void deviceChanged(int index);
     void sliderChanged(int value);
 
index f361dd0..847f72d 100644 (file)
@@ -241,7 +241,7 @@ void AudioTest::createAudioOutput()
     m_audioOutput = 0;
     m_audioOutput = new QAudioOutput(m_device, m_format, this);
     connect(m_audioOutput, SIGNAL(notify()), SLOT(notified()));
-    connect(m_audioOutput, SIGNAL(stateChanged(QAudio::State)), SLOT(stateChanged(QAudio::State)));
+    connect(m_audioOutput, SIGNAL(stateChanged(QAudio::State)), SLOT(handleStateChanged(QAudio::State)));
     m_generator->start();
     m_audioOutput->start(m_generator);
     m_volumeSlider->setValue(int(m_audioOutput->volume()*100.0f));
@@ -328,7 +328,7 @@ void AudioTest::toggleSuspendResume()
     }
 }
 
-void AudioTest::stateChanged(QAudio::State state)
+void AudioTest::handleStateChanged(QAudio::State state)
 {
     qWarning() << "state = " << state;
 }
index 3ca6a0d..30cf353 100644 (file)
@@ -114,7 +114,7 @@ private slots:
     void pullTimerExpired();
     void toggleMode();
     void toggleSuspendResume();
-    void stateChanged(QAudio::State state);
+    void handleStateChanged(QAudio::State state);
     void deviceChanged(int index);
     void volumeChanged(int);
 };
index 42f5a40..f5901f1 100644 (file)
@@ -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();
 };