summaryrefslogtreecommitdiff
path: root/src/multimedia/audio/qaudiodeviceinfo.cpp
diff options
context:
space:
mode:
authorMichael Goddard <michael.goddard@nokia.com>2012-01-23 11:52:42 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-23 07:30:16 +0100
commit01e7cb99500790861aeba8fc1a9ff7f4355aaace (patch)
tree32bf06c55e4152ded134fed2acd78d33ec508887 /src/multimedia/audio/qaudiodeviceinfo.cpp
parent7d826e38e70f763541ccceaabef4574d02fe9c5b (diff)
downloadqtmultimedia-01e7cb99500790861aeba8fc1a9ff7f4355aaace.tar.gz
Implement QAudioDeviceInfo operator==/!=
Compares some of the useful parts, but perhaps should be made more tolerant. Also refactored the auto test to properly skip if there are no (output) devices, rather than manually skip. Task-number: QTBUG-13723 Change-Id: I3b83f87a440a83f4237fa119a23009bc99e7626a Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com> Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
Diffstat (limited to 'src/multimedia/audio/qaudiodeviceinfo.cpp')
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp
index f806fa5d1..a2a9f5d64 100644
--- a/src/multimedia/audio/qaudiodeviceinfo.cpp
+++ b/src/multimedia/audio/qaudiodeviceinfo.cpp
@@ -186,7 +186,31 @@ QAudioDeviceInfo& QAudioDeviceInfo::operator=(const QAudioDeviceInfo &other)
}
/*!
- Returns whether this QAudioDeviceInfo object holds a device definition.
+ Returns true if this QAudioDeviceInfo class represents the
+ same audio device as \a other.
+*/
+bool QAudioDeviceInfo::operator ==(const QAudioDeviceInfo &other) const
+{
+ if (d == other.d)
+ return true;
+ if (d->realm == other.d->realm
+ && d->mode == other.d->mode
+ && d->handle == other.d->handle
+ && deviceName() == other.deviceName())
+ return true;
+}
+
+/*!
+ Returns true if this QAudioDeviceInfo class represents a
+ different audio device than \a other
+*/
+bool QAudioDeviceInfo::operator !=(const QAudioDeviceInfo &other) const
+{
+ return !operator==(other);
+}
+
+/*!
+ Returns whether this QAudioDeviceInfo object holds a valid device definition.
*/
bool QAudioDeviceInfo::isNull() const
{