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>
This commit is contained in:
committed by
The Qt Project
parent
101c78983a
commit
52ad3219f0
@@ -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();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user