From d34dc773591a2d467c68875a68a671d6a809f861 Mon Sep 17 00:00:00 2001 From: eilers Date: Mon, 03 Nov 2003 16:52:18 +0000 Subject: Porting Opie to MacOS-X. The base system and all platform independent applications and platforms should work. Please see $OPIEDIR/development/macosx for details --- (limited to 'library/qpeapplication.cpp') diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index d4734ae..a97efc0 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -20,7 +20,9 @@ #define QTOPIA_INTERNAL_LANGLIST #include #include +#ifndef Q_OS_MACX #include // needed for some toolchains (PATH_MAX) +#endif #include #include #ifdef Q_WS_QWS @@ -89,8 +91,9 @@ #include #include #include +#ifndef QT_NO_SOUND #include - +#endif #include "qt_override_p.h" @@ -233,7 +236,11 @@ public: void loadTextCodecs() { QString path = QPEApplication::qpeDir() + "/plugins/textcodecs"; +#ifdef Q_OS_MACX + QDir dir( path, "lib*.dylib" ); +#else QDir dir( path, "lib*.so" ); +#endif QStringList list; if ( dir. exists ( )) list = dir.entryList(); @@ -258,7 +265,11 @@ public: void loadImageCodecs() { QString path = QPEApplication::qpeDir() + "/plugins/imagecodecs"; +#ifdef Q_OS_MACX + QDir dir( path, "lib*.dylib" ); +#else QDir dir( path, "lib*.so" ); +#endif QStringList list; if ( dir. exists ( )) list = dir.entryList(); @@ -340,6 +351,7 @@ static void setVolume( int t = 0, int percent = -1 ) cfg.setGroup( "Volume" ); if ( percent < 0 ) percent = cfg.readNumEntry( "VolumePercent", 50 ); +#ifndef QT_NO_SOUND int fd = 0; if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { int vol = muted ? 0 : percent; @@ -348,6 +360,7 @@ static void setVolume( int t = 0, int percent = -1 ) ioctl( fd, MIXER_WRITE( 0 ), &vol ); ::close( fd ); } +#endif } break; } @@ -362,12 +375,14 @@ static void setMic( int t = 0, int percent = -1 ) if ( percent < 0 ) percent = cfg.readNumEntry( "Mic", 50 ); +#ifndef QT_NO_SOUND int fd = 0; int mic = micMuted ? 0 : percent; if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); ::close( fd ); } +#endif } break; } @@ -383,12 +398,14 @@ static void setBass( int t = 0, int percent = -1 ) if ( percent < 0 ) percent = cfg.readNumEntry( "BassPercent", 50 ); +#ifndef QT_NO_SOUND int fd = 0; int bass = percent; if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); ::close( fd ); } +#endif } break; } @@ -404,12 +421,14 @@ static void setTreble( int t = 0, int percent = -1 ) if ( percent < 0 ) percent = cfg.readNumEntry( "TreblePercent", 50 ); +#ifndef QT_NO_SOUND int fd = 0; int treble = percent; if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); ::close( fd ); } +#endif } break; } @@ -1649,11 +1668,17 @@ void QPEApplication::internalSetStyle( const QString &style ) QStyle *sty = 0; QString path = QPEApplication::qpeDir ( ) + "/plugins/styles/"; +#ifdef Q_OS_MACX + if ( style. find ( ".dylib" ) > 0 ) + path += style; + else + path = path + "lib" + style. lower ( ) + ".dylib"; // compatibility +#else if ( style. find ( ".so" ) > 0 ) path += style; else path = path + "lib" + style. lower ( ) + ".so"; // compatibility - +#endif static QLibrary *lastlib = 0; static StyleInterface *lastiface = 0; -- cgit v0.9.0.2