summaryrefslogtreecommitdiff
path: root/core
authorllornkcor <llornkcor>2002-05-19 17:00:41 (UTC)
committer llornkcor <llornkcor>2002-05-19 17:00:41 (UTC)
commit61a917bec9006516115d94be8c49acadf4eba222 (patch) (unidiff)
tree5cf91393455b95749978f28ab3f2a251c4c08b07 /core
parent602ff2a6f588584bf47afa6faae08ce60b49047f (diff)
downloadopie-61a917bec9006516115d94be8c49acadf4eba222.zip
opie-61a917bec9006516115d94be8c49acadf4eba222.tar.gz
opie-61a917bec9006516115d94be8c49acadf4eba222.tar.bz2
changed keypress stuff, and added a secret key/button for zaurus, available from config [Defaults] toggleKey = 4148 (or the int for the wanted keypress), ipaqs is 4096=KeyEscape -record button
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/vmemo/vmemo.cpp116
-rw-r--r--core/applets/vmemo/vmemo.h5
2 files changed, 63 insertions, 58 deletions
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp
index e14d532..7e91ef0 100644
--- a/core/applets/vmemo/vmemo.cpp
+++ b/core/applets/vmemo/vmemo.cpp
@@ -199,25 +199,35 @@ VMemo::VMemo( QWidget *parent, const char *_name )
199{ 199{
200 setFixedHeight( 18 ); 200 setFixedHeight( 18 );
201 setFixedWidth( 14 ); 201 setFixedWidth( 14 );
202 202
203 recording = FALSE; 203 recording = FALSE;
204 204
205 struct utsname name; /* check for embedix kernel running on the zaurus*/ 205 struct utsname name; /* check for embedix kernel running on the zaurus*/
206 if (uname(&name) != -1) { 206 if (uname(&name) != -1) {
207 QString release=name.release; 207 QString release=name.release;
208 if(release.find("embedix",0,TRUE) !=-1) 208 Config vmCfg("VMemo");
209 systemZaurus=TRUE; 209 vmCfg.setGroup("Defaults");
210 else { 210
211 systemZaurus=FALSE; 211 if(release.find("embedix",0,TRUE) !=-1) {
212 myChannel = new QCopChannel( "QPE/VMemo", this ); 212 int toggleKey = vmCfg.readNumEntry("toggleKey", -1);
213 connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)), 213 systemZaurus=TRUE;
214 this, SLOT(receive(const QCString&, const QByteArray&)) ); 214 } else {
215 215 int toggleKey = vmCfg.readNumEntry("toggleKey", 4096);
216// // Register the REC key press, for ipaq only 216//default key for ipaq record button is Key_Escape = 4096
217 QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)"); 217 systemZaurus=FALSE;
218 e << 4096; 218 }
219 e << QString("QPE/VMemo"); 219
220 e << QString("toggleRecord()"); 220 myChannel = new QCopChannel( "QPE/VMemo", this );
221 } 221 connect( myChannel, SIGNAL(received(const QCString&, const QByteArray&)),
222 } 222 this, SLOT(receive(const QCString&, const QByteArray&)) );
223
224 if( toggleKey != -1 ) {
225 QCopEnvelope e("QPE/Desktop", "keyRegister(int key, QString channel, QString message)");
226// e << 4096; // Key_Escape
227// e << Key_F5; //4148
228 e << toggleKey;
229 e << QString("QPE/VMemo");
230 e << QString("toggleRecord()");
231 }
232 }
223} 233}
@@ -230,9 +240,12 @@ void VMemo::receive( const QCString &msg, const QByteArray &data )
230{ 240{
231 QDataStream stream( data, IO_ReadOnly ); 241 QDataStream stream( data, IO_ReadOnly );
232 if (msg == "toggleRecord()") { 242 if (msg == "toggleRecord()") {
233 if (recording) 243 if (recording) {
234 mouseReleaseEvent(NULL); 244 fromToggle = TRUE;
235 else 245 stopRecording();
236 mousePressEvent(NULL); 246 } else {
237 } 247 fromToggle = TRUE;
248 startRecording();
249 }
250 }
238} 251}
@@ -245,19 +258,16 @@ void VMemo::paintEvent( QPaintEvent* )
245 258
246void VMemo::mousePressEvent( QMouseEvent *me ) 259void VMemo::mousePressEvent( QMouseEvent * )
247{ 260{
248 // just to be safe 261 startRecording();
249 if (recording) { 262}
250 recording = FALSE; 263
251 return; 264void VMemo::mouseReleaseEvent( QMouseEvent * )
252 } 265{
266 stopRecording();
267}
268
269bool VMemo::startRecording() {
253 270
254 /* 271 if ( recording)
255 No mousePress/mouseRelease recording on the iPAQ. The REC button on the iPAQ calls these functions 272 return FALSE;;
256 mousePressEvent and mouseReleaseEvent with a NULL parameter.
257 */
258// #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
259// if (!systemZaurus )
260// return;
261// #endif
262
263 Config config( "Sound" ); 273 Config config( "Sound" );
@@ -278,3 +288,3 @@ void VMemo::mousePressEvent( QMouseEvent *me )
278 recording = FALSE; 288 recording = FALSE;
279 return; 289 return FALSE;
280 } 290 }
@@ -287,4 +297,4 @@ void VMemo::mousePressEvent( QMouseEvent *me )
287 QString fName; 297 QString fName;
288 Config cfg( "Sound" ); 298 Config cfg( "Sound" );
289 cfg.setGroup( "System" ); 299 cfg.setGroup( "System" );
290 fName = QPEApplication::documentDir() ; 300 fName = QPEApplication::documentDir() ;
@@ -299,8 +309,2 @@ void VMemo::mousePressEvent( QMouseEvent *me )
299 fileName+="/"; 309 fileName+="/";
300
301// if(systemZaurus)
302// fileName=vmCfg.readEntry("Dir", "/mnt/cf/"); // zaurus does not have /mnt/ramfs
303// else
304// fileName=vmCfg.readEntry("Dir", "/mnt/ramfs/");
305
306 fName = "vm_"+ dt.toString()+ ".wav"; 310 fName = "vm_"+ dt.toString()+ ".wav";
@@ -320,3 +324,3 @@ void VMemo::mousePressEvent( QMouseEvent *me )
320 close(dsp); 324 close(dsp);
321 return; 325 return FALSE;
322 } 326 }
@@ -336,6 +340,6 @@ void VMemo::mousePressEvent( QMouseEvent *me )
336 record(); 340 record();
341 return TRUE;
337} 342}
338 343
339void VMemo::mouseReleaseEvent( QMouseEvent * ) 344void VMemo::stopRecording() {
340{
341 recording = FALSE; 345 recording = FALSE;
@@ -481,3 +485,3 @@ void VMemo::record(void)
481 485
482 } else { 486 } else { // this is specific for ipaqs that do not have 8 bit capabilities
483 487
diff --git a/core/applets/vmemo/vmemo.h b/core/applets/vmemo/vmemo.h
index 3972877..701663f 100644
--- a/core/applets/vmemo/vmemo.h
+++ b/core/applets/vmemo/vmemo.h
@@ -39,3 +39,4 @@ public slots:
39 void receive( const QCString &msg, const QByteArray &data ); 39 void receive( const QCString &msg, const QByteArray &data );
40 40 bool startRecording();
41 void stopRecording();
41private: 42private:
@@ -46,3 +47,3 @@ private:
46 int openWAV(const char *filename); 47 int openWAV(const char *filename);
47 48 bool fromToggle;
48 QPixmap vmemoPixmap; 49 QPixmap vmemoPixmap;