summaryrefslogtreecommitdiff
authorjeremy <jeremy>2002-02-15 17:01:32 (UTC)
committer jeremy <jeremy>2002-02-15 17:01:32 (UTC)
commit3a3b4465992439e6a52190fdfc757166aa3de880 (patch) (side-by-side diff)
treee795a6dfe4cf9e517121dd2c1b35111d6e3f89bc
parent379e66393a2986e218baad0e585c1b4a0dd7d045 (diff)
downloadopie-3a3b4465992439e6a52190fdfc757166aa3de880.zip
opie-3a3b4465992439e6a52190fdfc757166aa3de880.tar.gz
opie-3a3b4465992439e6a52190fdfc757166aa3de880.tar.bz2
Trying to make QCop to work
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp12
-rw-r--r--core/applets/vmemo/vmemo.h1
2 files changed, 11 insertions, 2 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index 8875cdf..5ce6fa9 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -97,181 +97,189 @@ static char * vmemo_xpm[] = {
"_ c #353535",
": c #0E0E0E",
"< c #080808",
"[ c #262626",
"} c #121212",
"| c #7F7F7F",
"1 c #464646",
"2 c #0C0C0C",
"3 c #727272",
"4 c #292929",
"5 c #656565",
"6 c #565656",
"7 c #434343",
"8 c #272727",
"9 c #0F0F0F",
"0 c #3A3A3A",
"a c #090909",
"b c #535353",
"c c #545454",
"d c #494949",
"e c #7A7A7A",
"f c #202020",
"g c #3D3D3D",
"h c #1F1F1F",
" .+@ ",
" #$%&* ",
" =-;>,')",
" .$;!~,)",
" ;#{]!)",
" ^~/(_)",
" ./:@<[)",
" }. .|]1;;2 ",
" #-$;^/3&;;4@ ",
".$;;#5:67;89 ",
":%;0%&ab;8. ",
"@cd%e!fg49 ",
" h0,!_;2@ ",
" ))))) "};
VMemo::VMemo( QWidget *parent, const char *name )
: QWidget( parent, name )
{
setFixedHeight( 18 );
setFixedWidth( 14 );
recording = FALSE;
myChannel = new QCopChannel( "QPE/VMemo", this );
+ connect( myChannel, SIGNAL(sayHi()), this, SLOT(sayHi()) );
connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)),
this, SLOT(receive(const QCString&, const QByteArray&)) );
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;
qWarning("System release: %s\n", name.release);
if(release.find("embedix",0,TRUE) !=-1)
systemZaurus=TRUE;
else
{
int fr;
systemZaurus=FALSE;
if ((fr = fork()) == -1)
{
qWarning("Fork failed");
}
else if (fr == 0)
{
int key, max;
fd_set fdr;
char buffer[10];
key = open("/dev/touchscreen/key", O_RDONLY);
if (key == -1)
{
qWarning("Could not open key");
exit(1);
}
while(1)
{
FD_ZERO(&fdr);
FD_SET(key, &fdr);
max = key;
qWarning("while");
read(key, buffer, 10);
if(*buffer == (char)129)
{
qWarning("REC = stop");
QCopEnvelope( "QPE/VMemo", "toggleRecord()");
- activate_signal("toggleRecordNow()");
+ QCopEnvelope( "QPE/VMemo", "sayHi()");
}
else if(*buffer == (char)1)
{
qWarning("REC = start");
QCopEnvelope( "QPE/VMemo", "toggleRecord()");
- activate_signal("toggleRecordNow()");
+ QCopEnvelope( "QPE/VMemo", "sayHi()");
}
}
}
else if(fr)
qWarning("parent: Fork = good");
}
}
qWarning("VMemo done init");
}
VMemo::~VMemo()
{
}
+void VMemo::sayHi()
+{
+ qWarning("Hi");
+}
+
void VMemo::receive( const QCString &msg, const QByteArray &data )
{
QDataStream stream( data, IO_ReadOnly );
qWarning(msg);
if ( msg == "toggleRecord()" ) {
qWarning("Hello");
}
}
void VMemo::paintEvent( QPaintEvent* )
{
QPainter p(this);
p.drawPixmap( 0, 1,( const char** ) vmemo_xpm );
}
void VMemo::mousePressEvent( QMouseEvent * )
{
+ QCopEnvelope( "QPE/VMemo", "sayHi()");
+
// just to be safe
if (recording)
{
recording = FALSE;
return;
}
qWarning("VMemo::mousePress()");
QSound::play(Resource::findSound("vmemob"));
recording = TRUE;
qWarning("VMemo::mousePress() -> Starting to record");
if (openDSP() == -1)
{
// ### Display an error box
QMessageBox::critical(0, "VMemo", "Could not open dsp device.", "Abort");
recording = FALSE;
return;
}
Config vmCfg("VMemo");
vmCfg.setGroup("Defaults");
QDateTime dt = QDateTime::currentDateTime();
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(" "),"_");
fileName.replace(QRegExp(":"),".");
fileName.replace(QRegExp(","),"");
if(openWAV(fileName.latin1()) == -1)
{
// ### Display an error box
qWarning("VMemo::mousePress() -> WAV error");
close(dsp);
return;
}
diff --git a/core/applets/vmemo/vmemo.h b/core/applets/vmemo/vmemo.h
index d96cd94..824309e 100644
--- a/core/applets/vmemo/vmemo.h
+++ b/core/applets/vmemo/vmemo.h
@@ -1,54 +1,55 @@
/**************************************************************************************94x78**
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
*********************************************************************************************/
/*
* $Id$
*/
#ifndef __VMEMO_H__
#define __VMEMO_H__
#include <qwidget.h>
#include <qpixmap.h>
#include <qpe/applnk.h>
#include <qfile.h>
#include <qpe/qcopenvelope_qws.h>
class VMemo : public QWidget
{
Q_OBJECT
public:
VMemo( QWidget *parent, const char *name = NULL);
~VMemo();
QFile track;
public slots:
void record();
void mousePressEvent( QMouseEvent * );
void mouseReleaseEvent( QMouseEvent * );
void receive( const QCString &msg, const QByteArray &data );
+ void sayHi();
private:
void paintEvent( QPaintEvent* );
int openDSP();
int openWAV(const char *filename);
QPixmap vmemoPixmap;
QCopChannel *myChannel;
bool systemZaurus;
int dsp, wav, rate, speed, channels, format, resolution;
bool recording;
};
#endif // __VMEMO_H__