summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-05-19 17:13:43 (UTC)
committer llornkcor <llornkcor>2002-05-19 17:13:43 (UTC)
commit396ca2a131b398b1562fee1cdc8cbe9bc629b37f (patch) (side-by-side diff)
tree77a2bc6bb9a9887acb37ce887ef7bf9ed739002e
parent61a917bec9006516115d94be8c49acadf4eba222 (diff)
downloadopie-396ca2a131b398b1562fee1cdc8cbe9bc629b37f.zip
opie-396ca2a131b398b1562fee1cdc8cbe9bc629b37f.tar.gz
opie-396ca2a131b398b1562fee1cdc8cbe9bc629b37f.tar.bz2
can hide the icon by adding in VMemo.conf [Defaults] hideIcon = 1
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index 7e91ef0..c27050d 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -186,70 +186,69 @@ static char * vmemo_xpm[] = {
" d e f g h i j 3 k l m n ",
" o p q r s t u v w n ",
" o x y z A B C D E n ",
" F G H I J K L M N O ",
" P Q R S T U V W X ",
" Y Z ` b ...+. ",
" @.#.$.%.&. ",
" *.B =. ",
" n n n n n n n n n "};
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 (uname(&name) != -1) {
QString release=name.release;
Config vmCfg("VMemo");
vmCfg.setGroup("Defaults");
+ int toggleKey = vmCfg.readNumEntry("toggleKey", -1);
- if(release.find("embedix",0,TRUE) !=-1) {
- int toggleKey = vmCfg.readNumEntry("toggleKey", -1);
+ if(release.find("embedix",0,TRUE) !=-1)
systemZaurus=TRUE;
- } else {
- int toggleKey = vmCfg.readNumEntry("toggleKey", 4096);
-//default key for ipaq record button is Key_Escape = 4096
+ else
systemZaurus=FALSE;
- }
myChannel = new QCopChannel( "QPE/VMemo", this );
connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)),
this, SLOT(receive(const QCString&, const QByteArray&)) );
if( toggleKey != -1 ) {
QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)");
// e << 4096; // Key_Escape
// e << Key_F5; //4148
e << toggleKey;
e << QString("QPE/VMemo");
e << QString("toggleRecord()");
}
+ if( vmCfg.readNumEntry("hideIcon",0) == 1)
+ hide();
}
}
VMemo::~VMemo()
{
}
void VMemo::receive( const QCString &msg, const QByteArray &data )
{
QDataStream stream( data, IO_ReadOnly );
if (msg == "toggleRecord()") {
if (recording) {
fromToggle = TRUE;
stopRecording();
} else {
fromToggle = TRUE;
startRecording();
}
}
}
void VMemo::paintEvent( QPaintEvent* )
{
QPainter p(this);
@@ -356,64 +355,60 @@ int VMemo::openDSP()
format = AFMT_S16_LE;
resolution = 16;
} else {
format = AFMT_U8;
resolution = 8;
}
qDebug("samplerate: %d, channels %d, resolution %d", speed, channels, resolution);
if(systemZaurus) {
dsp = open("/dev/dsp1", O_RDWR); //Zaurus needs /dev/dsp1
channels=1; //zaurus has one input channel
} else {
dsp = open("/dev/dsp", O_RDWR);
}
if(dsp == -1) {
perror("open(\"/dev/dsp\")");
errorMsg="open(\"/dev/dsp\")\n "+(QString)strerror(errno);
return -1;
}
if(ioctl(dsp, SNDCTL_DSP_SETFMT , &format)==-1) {
perror("ioctl(\"SNDCTL_DSP_SETFMT\")");
- errorMsg="ioctl(\"SNDCTL_DSP_SETFMT\")\n%d\n"+(QString)strerror(errno),format;
return -1;
}
if(ioctl(dsp, SNDCTL_DSP_CHANNELS , &channels)==-1) {
perror("ioctl(\"SNDCTL_DSP_CHANNELS\")");
- errorMsg="ioctl(\"SNDCTL_DSP_CHANNELS\")\n%d\n"+(QString)strerror(errno),channels;
return -1;
}
if(ioctl(dsp, SNDCTL_DSP_SPEED , &speed)==-1) {
perror("ioctl(\"SNDCTL_DSP_SPEED\")");
- errorMsg="ioctl(\"SNDCTL_DSP_SPEED\")\n%d\n"+(QString)strerror(errno),speed;
return -1;
}
if(ioctl(dsp, SOUND_PCM_READ_RATE , &rate)==-1) {
perror("ioctl(\"SOUND_PCM_READ_RATE\")");
- errorMsg="ioctl(\"SOUND_PCM_READ_RATE\")\n%d\n"+(QString)strerror(errno),rate;
return -1;
}
return 1;
}
int VMemo::openWAV(const char *filename)
{
track.setName(filename);
if(!track.open(IO_WriteOnly|IO_Truncate|IO_Raw)) {
errorMsg=filename;
return -1;
}
wav=track.handle();
WaveHeader wh;
wh.main_chunk = RIFF;
wh.length=0;
wh.chunk_type = WAVE;
wh.sub_chunk = FMT;
wh.sc_len = 16;
wh.format = PCM_CODE;