src/gui/kernel/qsound_mac.mm
branchGCC_SURGE
changeset 31 5daf16870df6
parent 30 5dc02b23752f
equal deleted inserted replaced
27:93b982ccede2 31:5daf16870df6
    86 @end
    86 @end
    87 #endif
    87 #endif
    88 
    88 
    89 QT_USE_NAMESPACE
    89 QT_USE_NAMESPACE
    90 
    90 
    91 @interface QMacSoundDelegate : NSObject<NSSoundDelegate> {
    91 @interface QT_MANGLE_NAMESPACE(QMacSoundDelegate) : NSObject<NSSoundDelegate> {
    92     QSound *qSound; // may be null.
    92     QSound *qSound; // may be null.
    93     QAuServerMac* server;
    93     QAuServerMac* server;
    94 }
    94 }
    95 -(id)initWithQSound:(QSound*)sound:(QAuServerMac*)server;
    95 -(id)initWithQSound:(QSound*)sound:(QAuServerMac*)server;
    96 @end
    96 @end
    97 
    97 
    98 @implementation QMacSoundDelegate
    98 @implementation QT_MANGLE_NAMESPACE(QMacSoundDelegate)
    99 -(id)initWithQSound:(QSound*)s:(QAuServerMac*)serv {
    99 -(id)initWithQSound:(QSound*)s:(QAuServerMac*)serv {
   100     self = [super init];
   100     self = [super init];
   101     if(self) {
   101     if(self) {
   102         qSound = s;
   102         qSound = s;
   103         server = serv;
   103         server = serv;
   170 // Creates an NSSound object and installs a "sound finished" callack delegate on it.
   170 // Creates an NSSound object and installs a "sound finished" callack delegate on it.
   171 NSSound *QAuServerMac::createNSSound(const QString &fileName, QSound *qSound)
   171 NSSound *QAuServerMac::createNSSound(const QString &fileName, QSound *qSound)
   172 {
   172 {
   173     NSString *nsFileName = const_cast<NSString *>(reinterpret_cast<const NSString *>(QCFString::toCFStringRef(fileName)));
   173     NSString *nsFileName = const_cast<NSString *>(reinterpret_cast<const NSString *>(QCFString::toCFStringRef(fileName)));
   174     NSSound * const nsSound = [[NSSound alloc] initWithContentsOfFile: nsFileName byReference:YES];
   174     NSSound * const nsSound = [[NSSound alloc] initWithContentsOfFile: nsFileName byReference:YES];
   175     QMacSoundDelegate * const delegate = [[QMacSoundDelegate alloc] initWithQSound:qSound:this];
   175     QT_MANGLE_NAMESPACE(QMacSoundDelegate) * const delegate = [[QT_MANGLE_NAMESPACE(QMacSoundDelegate) alloc] initWithQSound:qSound:this];
   176     [nsSound setDelegate:delegate];
   176     [nsSound setDelegate:delegate];
   177     [nsFileName release];
   177     [nsFileName release];
   178     return nsSound;
   178     return nsSound;
   179 }
   179 }
   180 
   180