-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 32 | ||||
-rw-r--r-- | core/applets/vmemo/vmemo.h | 2 |
2 files changed, 21 insertions, 13 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 6f04c66..6bd1622 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp @@ -9,16 +9,17 @@ ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** *********************************************************************************************/ /* * $Id$ */ +#include <sys/utsname.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> #include <stdio.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/ioctl.h> #include <linux/soundcard.h> @@ -131,16 +132,27 @@ static char * vmemo_xpm[] = { VMemo::VMemo( QWidget *parent, const char *name ) : QWidget( parent, name ) { setFixedHeight( 18 ); setFixedWidth( 14 ); recording = FALSE; + + struct utsname name; //check for embedix kernel running on the zaurus, if lineo change string, this break + if (uname(&name) != -1) { + QString release=name.release; + if(release.find("embedix",0,TRUE) !=-1) { + systemZaurus=TRUE; + printf("System release: %s\n", name.release); + } else + systemZaurus=FALSE; + } + } VMemo::~VMemo() { } void VMemo::paintEvent( QPaintEvent* ) { @@ -162,22 +174,21 @@ void VMemo::mousePressEvent( QMouseEvent * ) recording = FALSE; return; } Config vmCfg("VMemo"); vmCfg.setGroup("Defaults"); QDateTime dt = QDateTime::currentDateTime(); - -#if defined(QT_QWS_EBX) //if zaurus - QString fileName(vmCfg.readEntry("Dir", "/mnt/cf/")); // zaurus does not have /mnt/ramfs -#else - QString fileName(vmCfg.readEntry("Dir", "/mnt/ramfs/")); -#endif + QString fileName; + if(systemZaurus) + fileName=vmCfg.readEntry("Dir", "/mnt/cf/"); // zaurus does not have /mnt/ramfs + else + fileName=vmCfg.readEntry("Dir", "/mnt/ramfs/"); fileName += "vm_"; fileName += dt.toString(); fileName += ".wav"; // No spaces in the filename fileName.replace(QRegExp("'"),""); fileName.replace(QRegExp(" "),"_"); @@ -227,23 +238,20 @@ int VMemo::openDSP() resolution = 16; } else { format = AFMT_U8; resolution = 8; } -#if defined(QT_QWS_EBX) //if zaurus - //dsp = open("/dev/dsp1", O_RDONLY); //on the Zaurus this needs to be /dev/dsp1 !!!! - dsp = open("/dev/dsp1", O_RDWR); //on the Zaurus this needs to be /dev/dsp1 !!!! -#else - //dsp = open("/dev/dsp", O_RDONLY); + if(systemZaurus) + dsp = open("/dev/dsp1", O_RDWR); //Zaurus needs /dev/dsp1 + else dsp = open("/dev/dsp", O_RDWR); -#endif qWarning("speed = %i", speed); if(dsp == -1) { perror("open(\"/dev/dsp\")"); return -1; } diff --git a/core/applets/vmemo/vmemo.h b/core/applets/vmemo/vmemo.h index 9ce08f2..ee375b0 100644 --- a/core/applets/vmemo/vmemo.h +++ b/core/applets/vmemo/vmemo.h @@ -36,15 +36,15 @@ public slots: private: void paintEvent( QPaintEvent* ); int openDSP(); int openWAV(const char *filename); QPixmap vmemoPixmap; - + bool systemZaurus; int dsp, wav, rate, speed, channels, format, resolution; bool recording; }; #endif // __VMEMO_H__ |