44 #include <private/qt_mac_p.h> 47 #import <AppKit/AppKit.h> 49 #include <AppKit/NSSound.h> 75 bool okay() {
return true; }
83 #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 84 @protocol NSSoundDelegate <NSObject>
85 -(void)sound:(NSSound *)sound didFinishPlaying:(BOOL)aBool;
91 @interface QT_MANGLE_NAMESPACE(QMacSoundDelegate) : NSObject<NSSoundDelegate> {
98 @implementation QT_MANGLE_NAMESPACE(QMacSoundDelegate)
109 -(void)sound:(NSSound *)sound didFinishPlaying:(BOOL)finishedOk
121 if (finishedOk ==
false) {
129 if (qSound->loops() == -1) {
134 const int remainingIterations = server->
decLoop(qSound);
135 if (remainingIterations > 0) {
160 sounds[qSound] = nsSound;
173 NSString *nsFileName =
const_cast<NSString *
>(
reinterpret_cast<const NSString *
>(
QCFString::toCFStringRef(fileName)));
174 NSSound *
const nsSound = [[NSSound alloc] initWithContentsOfFile: nsFileName byReference:YES];
176 [nsSound setDelegate:delegate];
177 [nsFileName release];
188 #include "qsound_mac.moc" 190 #endif // QT_NO_SOUND
The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash...
#define QT_END_NAMESPACE
This macro expands to.
int remove(const Key &key)
Removes all the items that have the key from the hash.
#define it(className, varName)
QHash< QSound *, NSSound const * > Sounds
QAuServerMac(QObject *parent)
static CFStringRef toCFStringRef(const QString &str)
void play(const QString &filename)
The QString class provides a Unicode character string.
The QHash class is a template class that provides a hash-table-based dictionary.
int decLoop(QSound *)
Decrements the QSound::loopRemaining() value for sound s, returning the result.
The QObject class is the base class of all Qt objects.
#define QT_BEGIN_NAMESPACE
This macro expands to.
const_iterator constFind(const Key &key) const
Returns an iterator pointing to the item with the key in the hash.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the hash...
NSSound * createNSSound(const QString &filename, QSound *qSound)
#define QT_MANGLE_NAMESPACE(name)
QObject * parent() const
Returns a pointer to the parent object.
QAuServer * qt_new_audio_server()
#define QT_USE_NAMESPACE
This macro expands to using QT_NAMESPACE if QT_NAMESPACE is defined and nothing otherwise.
QString fileName() const
Returns the filename associated with this QSound object.
The QSound class provides access to the platform audio facilities.
static QString fileName(const QString &fileUrl)