author | mickeyl <mickeyl> | 2004-04-05 12:48:49 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-05 12:48:49 (UTC) |
commit | f1708be741dfb73ceaffb633b44093f2cb2b3d57 (patch) (unidiff) | |
tree | 0bdcab2ac6c5f0e5cac67eb58807a50bb79d82e0 /core | |
parent | 0b481957a2eebf28b05d9803780d05ad4232aa00 (diff) | |
download | opie-f1708be741dfb73ceaffb633b44093f2cb2b3d57.zip opie-f1708be741dfb73ceaffb633b44093f2cb2b3d57.tar.gz opie-f1708be741dfb73ceaffb633b44093f2cb2b3d57.tar.bz2 |
convert core/applets/* to Opie debug framework
-rw-r--r-- | core/applets/cardmon/cardmon.cpp | 20 | ||||
-rw-r--r-- | core/applets/clockapplet/clock.cpp | 4 | ||||
-rw-r--r-- | core/applets/irdaapplet/irda.cpp | 4 | ||||
-rw-r--r-- | core/applets/multikeyapplet/multikey.cpp | 2 | ||||
-rw-r--r-- | core/applets/restartapplet/restart.cpp | 2 | ||||
-rw-r--r-- | core/applets/restartapplet/restartappletimpl.cpp | 1 | ||||
-rw-r--r-- | core/applets/rotateapplet/rotate.cpp | 7 | ||||
-rw-r--r-- | core/applets/screenshotapplet/screenshot.cpp | 20 | ||||
-rw-r--r-- | core/applets/vmemo/vmemo.cpp | 34 | ||||
-rw-r--r-- | core/applets/vtapplet/vt.cpp | 25 | ||||
-rw-r--r-- | core/obex/obexsend.cpp | 29 | ||||
-rw-r--r-- | core/obex/receiver.cpp | 41 |
12 files changed, 100 insertions, 89 deletions
diff --git a/core/applets/cardmon/cardmon.cpp b/core/applets/cardmon/cardmon.cpp index 1ad8b55..3a6ad27 100644 --- a/core/applets/cardmon/cardmon.cpp +++ b/core/applets/cardmon/cardmon.cpp | |||
@@ -16,16 +16,19 @@ | |||
16 | * * | 16 | * * |
17 | ***************************************************************************/ | 17 | ***************************************************************************/ |
18 | 18 | ||
19 | #include "cardmon.h" | 19 | #include "cardmon.h" |
20 | 20 | ||
21 | /* OPIE */ | 21 | /* OPIE */ |
22 | #include <opie2/odebug.h> | ||
22 | #include <opie2/odevice.h> | 23 | #include <opie2/odevice.h> |
23 | #include <opie2/otaskbarapplet.h> | 24 | #include <opie2/otaskbarapplet.h> |
24 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
25 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | using namespace Opie::Core; | ||
28 | using namespace Opie::Ui; | ||
26 | 29 | ||
27 | /* QT */ | 30 | /* QT */ |
28 | #include <qcopchannel_qws.h> | 31 | #include <qcopchannel_qws.h> |
29 | #include <qpainter.h> | 32 | #include <qpainter.h> |
30 | #include <qfile.h> | 33 | #include <qfile.h> |
31 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
@@ -35,24 +38,17 @@ | |||
35 | /* STD */ | 38 | /* STD */ |
36 | #include <stdio.h> | 39 | #include <stdio.h> |
37 | #include <unistd.h> | 40 | #include <unistd.h> |
38 | #include <stdlib.h> | 41 | #include <stdlib.h> |
39 | #include <string.h> | 42 | #include <string.h> |
40 | #include <fcntl.h> | 43 | #include <fcntl.h> |
41 | |||
42 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 44 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
43 | #include <sys/vfs.h> | 45 | #include <sys/vfs.h> |
44 | #include <mntent.h> | 46 | #include <mntent.h> |
45 | #endif | 47 | #endif |
46 | 48 | ||
47 | using namespace Opie; | ||
48 | |||
49 | using namespace Opie::Ui; | ||
50 | using namespace Opie::Ui; | ||
51 | using namespace Opie::Core; | ||
52 | |||
53 | CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ), | 49 | CardMonitor::CardMonitor( QWidget * parent ) : QWidget( parent ), |
54 | pm( Resource::loadPixmap( "cardmon/pcmcia" ) ) | 50 | pm( Resource::loadPixmap( "cardmon/pcmcia" ) ) |
55 | { | 51 | { |
56 | 52 | ||
57 | QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this ); | 53 | QCopChannel * pcmciaChannel = new QCopChannel( "QPE/Card", this ); |
58 | connect( pcmciaChannel, | 54 | connect( pcmciaChannel, |
@@ -194,18 +190,18 @@ void CardMonitor::mousePressEvent( QMouseEvent * ) | |||
194 | 190 | ||
195 | 191 | ||
196 | void CardMonitor::cardMessage( const QCString & msg, const QByteArray & ) | 192 | void CardMonitor::cardMessage( const QCString & msg, const QByteArray & ) |
197 | { | 193 | { |
198 | if ( msg == "stabChanged()" ) | 194 | if ( msg == "stabChanged()" ) |
199 | { | 195 | { |
200 | // qDebug("Pcmcia: stabchanged"); | 196 | // odebug << "Pcmcia: stabchanged" << oendl; |
201 | getStatusPcmcia(); | 197 | getStatusPcmcia(); |
202 | } | 198 | } |
203 | else if ( msg == "mtabChanged()" ) | 199 | else if ( msg == "mtabChanged()" ) |
204 | { | 200 | { |
205 | // qDebug("CARDMONAPPLET: mtabchanged"); | 201 | // odebug << "CARDMONAPPLET: mtabchanged" << oendl; |
206 | getStatusSd(); | 202 | getStatusSd(); |
207 | } | 203 | } |
208 | } | 204 | } |
209 | 205 | ||
210 | bool CardMonitor::getStatusPcmcia( int showPopUp ) | 206 | bool CardMonitor::getStatusPcmcia( int showPopUp ) |
211 | { | 207 | { |
@@ -328,13 +324,13 @@ bool CardMonitor::getStatusPcmcia( int showPopUp ) | |||
328 | 324 | ||
329 | } | 325 | } |
330 | } | 326 | } |
331 | else | 327 | else |
332 | { | 328 | { |
333 | // no file found | 329 | // no file found |
334 | qDebug( "no file found" ); | 330 | odebug << "no file found" << oendl; |
335 | cardInPcmcia0 = FALSE; | 331 | cardInPcmcia0 = FALSE; |
336 | cardInPcmcia1 = FALSE; | 332 | cardInPcmcia1 = FALSE; |
337 | } | 333 | } |
338 | repaint( FALSE ); | 334 | repaint( FALSE ); |
339 | return ( ( cardWas0 == cardInPcmcia0 | 335 | return ( ( cardWas0 == cardInPcmcia0 |
340 | && cardWas1 == cardInPcmcia1 ) ? FALSE : TRUE ); | 336 | && cardWas1 == cardInPcmcia1 ) ? FALSE : TRUE ); |
@@ -354,13 +350,13 @@ bool CardMonitor::getStatusSd( int showPopUp ) | |||
354 | 350 | ||
355 | if ( mntfp ) | 351 | if ( mntfp ) |
356 | { | 352 | { |
357 | while ( ( me = getmntent( mntfp ) ) != 0 ) | 353 | while ( ( me = getmntent( mntfp ) ) != 0 ) |
358 | { | 354 | { |
359 | QString fs = me->mnt_fsname; | 355 | QString fs = me->mnt_fsname; |
360 | //qDebug( fs ); | 356 | //odebug << fs << oendl; |
361 | if ( fs.left( 14 ) == "/dev/mmc/part1" || fs.left( 7 ) == "/dev/sd" | 357 | if ( fs.left( 14 ) == "/dev/mmc/part1" || fs.left( 7 ) == "/dev/sd" |
362 | || fs.left( 9 ) == "/dev/mmcd" ) | 358 | || fs.left( 9 ) == "/dev/mmcd" ) |
363 | { | 359 | { |
364 | cardInSd = TRUE; | 360 | cardInSd = TRUE; |
365 | show(); | 361 | show(); |
366 | } | 362 | } |
@@ -382,13 +378,13 @@ bool CardMonitor::getStatusSd( int showPopUp ) | |||
382 | } | 378 | } |
383 | else | 379 | else |
384 | { | 380 | { |
385 | text += "Ejected: SD/MMC"; | 381 | text += "Ejected: SD/MMC"; |
386 | what = "off"; | 382 | what = "off"; |
387 | } | 383 | } |
388 | //qDebug("TEXT: " + text ); | 384 | //odebug << "TEXT: " + text << oendl; |
389 | #ifndef QT_NO_SOUND | 385 | #ifndef QT_NO_SOUND |
390 | QSound::play( Resource::findSound( "cardmon/card" + what ) ); | 386 | QSound::play( Resource::findSound( "cardmon/card" + what ) ); |
391 | #endif | 387 | #endif |
392 | popUp( text, "cardmon/ide" );// XX add SD pic | 388 | popUp( text, "cardmon/ide" );// XX add SD pic |
393 | } | 389 | } |
394 | #else | 390 | #else |
diff --git a/core/applets/clockapplet/clock.cpp b/core/applets/clockapplet/clock.cpp index 3b13d74..7d396e7 100644 --- a/core/applets/clockapplet/clock.cpp +++ b/core/applets/clockapplet/clock.cpp | |||
@@ -17,18 +17,22 @@ | |||
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include "clock.h" | 21 | #include "clock.h" |
22 | 22 | ||
23 | /* OPIE */ | ||
24 | #include <opie2/odebug.h> | ||
23 | #include <opie2/otaskbarapplet.h> | 25 | #include <opie2/otaskbarapplet.h> |
24 | #include <qpe/qpeapplication.h> | 26 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/qcopenvelope_qws.h> | 27 | #include <qpe/qcopenvelope_qws.h> |
26 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
27 | 29 | ||
30 | using namespace Opie::Core; | ||
28 | using namespace Opie::Ui; | 31 | using namespace Opie::Ui; |
32 | |||
29 | LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) | 33 | LauncherClock::LauncherClock( QWidget *parent ) : QLabel( parent ) |
30 | { | 34 | { |
31 | // If you want a sunken border around the clock do this: | 35 | // If you want a sunken border around the clock do this: |
32 | // setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 36 | // setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
33 | //setFont( QFont( "Helvetica", , QFont::Normal ) ); | 37 | //setFont( QFont( "Helvetica", , QFont::Normal ) ); |
34 | connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime() ) ); | 38 | connect( qApp, SIGNAL( timeChanged() ), this, SLOT( updateTime() ) ); |
diff --git a/core/applets/irdaapplet/irda.cpp b/core/applets/irdaapplet/irda.cpp index 2196d18..7122b40 100644 --- a/core/applets/irdaapplet/irda.cpp +++ b/core/applets/irdaapplet/irda.cpp | |||
@@ -204,25 +204,25 @@ void IrdaApplet::showDiscovered ( ) | |||
204 | const QString &line = *lit; | 204 | const QString &line = *lit; |
205 | 205 | ||
206 | if ( line. startsWith ( "nickname:" )) { | 206 | if ( line. startsWith ( "nickname:" )) { |
207 | discoveredDevice = line. mid ( line. find ( ':' ) + 2, line. find ( ',' ) - line. find ( ':' ) - 2 ); | 207 | discoveredDevice = line. mid ( line. find ( ':' ) + 2, line. find ( ',' ) - line. find ( ':' ) - 2 ); |
208 | deviceAddr = line. mid ( line. find ( "daddr:" ) + 9, 8 ); | 208 | deviceAddr = line. mid ( line. find ( "daddr:" ) + 9, 8 ); |
209 | 209 | ||
210 | // qDebug(discoveredDevice + "(" + deviceAddr + ")"); | 210 | // odebug << discoveredDevice + "(" + deviceAddr + ")" << oendl; |
211 | 211 | ||
212 | if ( !m_devices. contains ( deviceAddr )) { | 212 | if ( !m_devices. contains ( deviceAddr )) { |
213 | popup ( tr( "Found:" ) + " " + discoveredDevice ); | 213 | popup ( tr( "Found:" ) + " " + discoveredDevice ); |
214 | //snd_found. play ( ); | 214 | //snd_found. play ( ); |
215 | qcopsend = true; | 215 | qcopsend = true; |
216 | } | 216 | } |
217 | m_devices. replace ( deviceAddr, discoveredDevice ); | 217 | m_devices. replace ( deviceAddr, discoveredDevice ); |
218 | } | 218 | } |
219 | } | 219 | } |
220 | 220 | ||
221 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ) { | 221 | for ( it = m_devices. begin ( ); it != m_devices. end ( ); ) { |
222 | // qDebug("IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?"); | 222 | // odebug << "IrdaMon: delete " + it.currentKey() + "=" + *devicesAvailable[it.currentKey()] + "?" << oendl; |
223 | 223 | ||
224 | if ( it. data ( ). left ( 3 ) == "+++" ) { | 224 | if ( it. data ( ). left ( 3 ) == "+++" ) { |
225 | popup ( tr( "Lost:" ) + " " + it. data ( ). mid ( 3 )); | 225 | popup ( tr( "Lost:" ) + " " + it. data ( ). mid ( 3 )); |
226 | //snd_lost. play ( ); | 226 | //snd_lost. play ( ); |
227 | 227 | ||
228 | QMap <QString, QString>::Iterator tmp = it; | 228 | QMap <QString, QString>::Iterator tmp = it; |
diff --git a/core/applets/multikeyapplet/multikey.cpp b/core/applets/multikeyapplet/multikey.cpp index 195ada5..195d8a4 100644 --- a/core/applets/multikeyapplet/multikey.cpp +++ b/core/applets/multikeyapplet/multikey.cpp | |||
@@ -65,13 +65,13 @@ void Multikey::mouseReleaseEvent(QMouseEvent *ev) | |||
65 | { | 65 | { |
66 | if (!sw_maps.count()) | 66 | if (!sw_maps.count()) |
67 | return; | 67 | return; |
68 | 68 | ||
69 | lang = lang < sw_maps.count()-1 ? lang+1 : 0; | 69 | lang = lang < sw_maps.count()-1 ? lang+1 : 0; |
70 | QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); | 70 | QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); |
71 | //qDebug("Lang=%d, count=%d, lab=%s", lang, sw_maps.count(), labels[lang].ascii()); | 71 | //odebug << "Lang=" << lang << ", count=" << sw_maps.count() << ", lab=" << labels[lang].ascii() << "" << oendl; |
72 | e << sw_maps[lang]; | 72 | e << sw_maps[lang]; |
73 | setText(labels[lang]); | 73 | setText(labels[lang]); |
74 | } | 74 | } |
75 | 75 | ||
76 | void Multikey::message(const QCString &message, const QByteArray &data) | 76 | void Multikey::message(const QCString &message, const QByteArray &data) |
77 | { | 77 | { |
diff --git a/core/applets/restartapplet/restart.cpp b/core/applets/restartapplet/restart.cpp index 226c2a8..2e17608 100644 --- a/core/applets/restartapplet/restart.cpp +++ b/core/applets/restartapplet/restart.cpp | |||
@@ -50,23 +50,21 @@ static char *restart_xpm[] = { | |||
50 | " .. ", | 50 | " .. ", |
51 | " "}; | 51 | " "}; |
52 | RestartApplet::RestartApplet( QWidget *parent, const char *name ) | 52 | RestartApplet::RestartApplet( QWidget *parent, const char *name ) |
53 | : QWidget( parent, name ) { | 53 | : QWidget( parent, name ) { |
54 | setFixedHeight( 18 ); | 54 | setFixedHeight( 18 ); |
55 | setFixedWidth( 16 ); | 55 | setFixedWidth( 16 ); |
56 | qDebug("new restartapplet"); | ||
57 | show(); | 56 | show(); |
58 | } | 57 | } |
59 | 58 | ||
60 | RestartApplet::~RestartApplet() { | 59 | RestartApplet::~RestartApplet() { |
61 | } | 60 | } |
62 | 61 | ||
63 | void RestartApplet::mousePressEvent( QMouseEvent *) { | 62 | void RestartApplet::mousePressEvent( QMouseEvent *) { |
64 | QCopEnvelope e("QPE/System", "restart()"); | 63 | QCopEnvelope e("QPE/System", "restart()"); |
65 | } | 64 | } |
66 | 65 | ||
67 | void RestartApplet::paintEvent( QPaintEvent* ) { | 66 | void RestartApplet::paintEvent( QPaintEvent* ) { |
68 | QPainter p(this); | 67 | QPainter p(this); |
69 | qDebug("paint RESTART pixmap"); | ||
70 | p.drawPixmap( 0, 1, ( const char** ) restart_xpm ); | 68 | p.drawPixmap( 0, 1, ( const char** ) restart_xpm ); |
71 | } | 69 | } |
72 | 70 | ||
diff --git a/core/applets/restartapplet/restartappletimpl.cpp b/core/applets/restartapplet/restartappletimpl.cpp index d8e10d3..3adc80c 100644 --- a/core/applets/restartapplet/restartappletimpl.cpp +++ b/core/applets/restartapplet/restartappletimpl.cpp | |||
@@ -30,13 +30,12 @@ RestartAppletImpl::~RestartAppletImpl() | |||
30 | { | 30 | { |
31 | delete restart; | 31 | delete restart; |
32 | } | 32 | } |
33 | 33 | ||
34 | QWidget *RestartAppletImpl::applet( QWidget *parent ) | 34 | QWidget *RestartAppletImpl::applet( QWidget *parent ) |
35 | { | 35 | { |
36 | qDebug("restart applet"); | ||
37 | if ( !restart ) | 36 | if ( !restart ) |
38 | restart = new RestartApplet( parent ); | 37 | restart = new RestartApplet( parent ); |
39 | return restart; | 38 | return restart; |
40 | } | 39 | } |
41 | 40 | ||
42 | int RestartAppletImpl::position() const | 41 | int RestartAppletImpl::position() const |
diff --git a/core/applets/rotateapplet/rotate.cpp b/core/applets/rotateapplet/rotate.cpp index f621aa9..f23423d 100644 --- a/core/applets/rotateapplet/rotate.cpp +++ b/core/applets/rotateapplet/rotate.cpp | |||
@@ -28,12 +28,13 @@ | |||
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include "rotate.h" | 31 | #include "rotate.h" |
32 | 32 | ||
33 | /* OPIE */ | 33 | /* OPIE */ |
34 | #include <opie2/odebug.h> | ||
34 | #include <opie2/odevice.h> | 35 | #include <opie2/odevice.h> |
35 | #include <qpe/config.h> | 36 | #include <qpe/config.h> |
36 | #include <qpe/power.h> | 37 | #include <qpe/power.h> |
37 | #include <qpe/qcopenvelope_qws.h> | 38 | #include <qpe/qcopenvelope_qws.h> |
38 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
39 | using namespace Opie::Core; | 40 | using namespace Opie::Core; |
@@ -59,23 +60,23 @@ RotateApplet::~RotateApplet ( ) | |||
59 | 60 | ||
60 | /** | 61 | /** |
61 | * Qcop receive method. | 62 | * Qcop receive method. |
62 | */ | 63 | */ |
63 | void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) | 64 | void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data ) |
64 | { | 65 | { |
65 | qDebug( "RotateApplet::channelReceived( '%s' )", (const char*) msg ); | 66 | odebug << "RotateApplet::channelReceived( '" << msg << "' )" << oendl; |
66 | 67 | ||
67 | if ( ODevice::inst()->hasHingeSensor() ) | 68 | if ( ODevice::inst()->hasHingeSensor() ) |
68 | { | 69 | { |
69 | struct timespec interval; | 70 | struct timespec interval; |
70 | struct timespec remain; | 71 | struct timespec remain; |
71 | interval.tv_sec = 0; | 72 | interval.tv_sec = 0; |
72 | interval.tv_nsec = 600000; | 73 | interval.tv_nsec = 600000; |
73 | ::nanosleep( &interval, &remain ); | 74 | ::nanosleep( &interval, &remain ); |
74 | OHingeStatus status = ODevice::inst()->readHingeSensor(); | 75 | OHingeStatus status = ODevice::inst()->readHingeSensor(); |
75 | qDebug( "RotateApplet::readHingeSensor = %d", (int) status ); | 76 | odebug << "RotateApplet::readHingeSensor = " << (int) status << "" << oendl; |
76 | 77 | ||
77 | Config cfg( "apm" ); | 78 | Config cfg( "apm" ); |
78 | cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" ); | 79 | cfg.setGroup( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ? "AC" : "Battery" ); |
79 | int action = cfg.readNumEntry( "CloseHingeAction", 0 ); | 80 | int action = cfg.readNumEntry( "CloseHingeAction", 0 ); |
80 | 81 | ||
81 | if ( status == CASE_CLOSED ) | 82 | if ( status == CASE_CLOSED ) |
@@ -93,13 +94,13 @@ void RotateApplet::channelReceived( const QCString &msg, const QByteArray & data | |||
93 | { | 94 | { |
94 | case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 127 ); break; | 95 | case 1: /* DISPLAY OFF */ ODevice::inst()->setDisplayBrightness( 127 ); break; |
95 | case 2: /* SUSPEND */ /* How to wake up the device from kernel? */; break; | 96 | case 2: /* SUSPEND */ /* How to wake up the device from kernel? */; break; |
96 | default: /* IGNORE */ break; | 97 | default: /* IGNORE */ break; |
97 | } | 98 | } |
98 | } | 99 | } |
99 | qDebug( "RotateApplet::switchAction %d performed.", cfg.readNumEntry( "CloseHingeAction", 0 ) ); | 100 | odebug << "RotateApplet::switchAction " << cfg.readNumEntry( "CloseHingeAction" ) << " performed." << oendl; |
100 | } | 101 | } |
101 | 102 | ||
102 | QDataStream stream( data, IO_ReadOnly ); | 103 | QDataStream stream( data, IO_ReadOnly ); |
103 | if ( msg == "flip()" ) | 104 | if ( msg == "flip()" ) |
104 | { | 105 | { |
105 | activated ( ); | 106 | activated ( ); |
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp index 9aa012a..938ea0c 100644 --- a/core/applets/screenshotapplet/screenshot.cpp +++ b/core/applets/screenshotapplet/screenshot.cpp | |||
@@ -13,15 +13,18 @@ | |||
13 | **********************************************************************/ | 13 | **********************************************************************/ |
14 | 14 | ||
15 | #include "screenshot.h" | 15 | #include "screenshot.h" |
16 | #include "inputDialog.h" | 16 | #include "inputDialog.h" |
17 | 17 | ||
18 | /* OPIE */ | 18 | /* OPIE */ |
19 | #include <opie2/odebug.h> | ||
19 | #include <opie2/otaskbarapplet.h> | 20 | #include <opie2/otaskbarapplet.h> |
20 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/applnk.h> | 22 | #include <qpe/applnk.h> |
23 | using namespace Opie::Core; | ||
24 | using namespace Opie::Ui; | ||
22 | 25 | ||
23 | /* QT */ | 26 | /* QT */ |
24 | #include <qlineedit.h> | 27 | #include <qlineedit.h> |
25 | #include <qdir.h> | 28 | #include <qdir.h> |
26 | #include <qlabel.h> | 29 | #include <qlabel.h> |
27 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
@@ -36,13 +39,12 @@ | |||
36 | #include <sys/socket.h> | 39 | #include <sys/socket.h> |
37 | #include <netinet/in.h> | 40 | #include <netinet/in.h> |
38 | #include <netdb.h> | 41 | #include <netdb.h> |
39 | #include <unistd.h> | 42 | #include <unistd.h> |
40 | 43 | ||
41 | /* XPM */ | 44 | /* XPM */ |
42 | using namespace Opie::Ui; | ||
43 | static char * snapshot_xpm[] = { | 45 | static char * snapshot_xpm[] = { |
44 | "32 32 177 2", | 46 | "32 32 177 2", |
45 | " c None", | 47 | " c None", |
46 | ". c #042045", | 48 | ". c #042045", |
47 | "+ c #0D2B47", | 49 | "+ c #0D2B47", |
48 | "@ c #0E325E", | 50 | "@ c #0E325E", |
@@ -359,57 +361,57 @@ void ScreenshotControl::savePixmap() | |||
359 | //not sure why this is needed here, but it forgets fileName | 361 | //not sure why this is needed here, but it forgets fileName |
360 | // if this is below the braces | 362 | // if this is below the braces |
361 | 363 | ||
362 | if (fileName.right(3) != "png") | 364 | if (fileName.right(3) != "png") |
363 | fileName = fileName + ".png"; | 365 | fileName = fileName + ".png"; |
364 | lnk.setFile(fileName); //sets File property | 366 | lnk.setFile(fileName); //sets File property |
365 | qDebug("saving file " + fileName); | 367 | odebug << "saving file " + fileName << oendl; |
366 | snapshot.save( fileName, "PNG"); | 368 | snapshot.save( fileName, "PNG"); |
367 | QFileInfo fi( fileName); | 369 | QFileInfo fi( fileName); |
368 | lnk.setName( fi.fileName()); //sets file name | 370 | lnk.setName( fi.fileName()); //sets file name |
369 | 371 | ||
370 | if (!lnk.writeLink()) | 372 | if (!lnk.writeLink()) |
371 | qDebug("Writing doclink did not work"); | 373 | odebug << "Writing doclink did not work" << oendl; |
372 | } | 374 | } |
373 | else { | 375 | else { |
374 | 376 | ||
375 | fileName = "sc_" + QDateTime::currentDateTime().toString(); | 377 | fileName = "sc_" + QDateTime::currentDateTime().toString(); |
376 | fileName.replace(QRegExp("'"), ""); | 378 | fileName.replace(QRegExp("'"), ""); |
377 | fileName.replace(QRegExp(" "), "_"); | 379 | fileName.replace(QRegExp(" "), "_"); |
378 | fileName.replace(QRegExp(":"), "."); | 380 | fileName.replace(QRegExp(":"), "."); |
379 | fileName.replace(QRegExp(","), ""); | 381 | fileName.replace(QRegExp(","), ""); |
380 | QString dirName = QDir::homeDirPath() + "/Documents/image/png/"; | 382 | QString dirName = QDir::homeDirPath() + "/Documents/image/png/"; |
381 | 383 | ||
382 | if ( !QDir( dirName).exists() ) { | 384 | if ( !QDir( dirName).exists() ) { |
383 | qDebug("making dir " + dirName); | 385 | odebug << "making dir " + dirName << oendl; |
384 | QString msg = "mkdir -p " + dirName; | 386 | QString msg = "mkdir -p " + dirName; |
385 | system(msg.latin1()); | 387 | system(msg.latin1()); |
386 | } | 388 | } |
387 | fileName = dirName + fileName; | 389 | fileName = dirName + fileName; |
388 | if (fileName.right(3) != "png") | 390 | if (fileName.right(3) != "png") |
389 | fileName = fileName + ".png"; | 391 | fileName = fileName + ".png"; |
390 | lnk.setFile(fileName); //sets File property | 392 | lnk.setFile(fileName); //sets File property |
391 | qDebug("saving file " + fileName); | 393 | odebug << "saving file " + fileName << oendl; |
392 | snapshot.save( fileName, "PNG"); | 394 | snapshot.save( fileName, "PNG"); |
393 | QFileInfo fi( fileName); | 395 | QFileInfo fi( fileName); |
394 | lnk.setName( fi.fileName()); //sets file name | 396 | lnk.setName( fi.fileName()); //sets file name |
395 | 397 | ||
396 | if (!lnk.writeLink()) | 398 | if (!lnk.writeLink()) |
397 | qDebug("Writing doclink did not work"); | 399 | odebug << "Writing doclink did not work" << oendl; |
398 | 400 | ||
399 | } | 401 | } |
400 | 402 | ||
401 | QPEApplication::beep(); | 403 | QPEApplication::beep(); |
402 | } | 404 | } |
403 | 405 | ||
404 | void ScreenshotControl::performGrab() | 406 | void ScreenshotControl::performGrab() |
405 | { | 407 | { |
406 | snapshot = QPixmap::grabWindow( QPEApplication::desktop()->winId(), 0, 0, QApplication::desktop()->width(), QApplication::desktop()->height() ); | 408 | snapshot = QPixmap::grabWindow( QPEApplication::desktop()->winId(), 0, 0, QApplication::desktop()->width(), QApplication::desktop()->height() ); |
407 | 409 | ||
408 | if (buttonPushed == 1) { | 410 | if (buttonPushed == 1) { |
409 | qDebug("grabbing screen"); | 411 | odebug << "grabbing screen" << oendl; |
410 | grabTimer->stop(); | 412 | grabTimer->stop(); |
411 | show(); | 413 | show(); |
412 | qApp->processEvents(); | 414 | qApp->processEvents(); |
413 | savePixmap(); | 415 | savePixmap(); |
414 | } else { | 416 | } else { |
415 | grabTimer->stop(); | 417 | grabTimer->stop(); |
@@ -417,13 +419,13 @@ void ScreenshotControl::performGrab() | |||
417 | struct sockaddr_in raddr; | 419 | struct sockaddr_in raddr; |
418 | struct hostent *rhost_info; | 420 | struct hostent *rhost_info; |
419 | int sock = -1; | 421 | int sock = -1; |
420 | bool ok = false; | 422 | bool ok = false; |
421 | 423 | ||
422 | QString displayEnv = getenv("QWS_DISPLAY"); | 424 | QString displayEnv = getenv("QWS_DISPLAY"); |
423 | qDebug(displayEnv); | 425 | odebug << displayEnv << oendl; |
424 | 426 | ||
425 | if(( displayEnv.left(2) != ":0" ) && (!displayEnv.isEmpty())) { | 427 | if(( displayEnv.left(2) != ":0" ) && (!displayEnv.isEmpty())) { |
426 | 428 | ||
427 | if (( rhost_info = (struct hostent *) ::gethostbyname ((char *) SCAP_hostname )) != 0 ) { | 429 | if (( rhost_info = (struct hostent *) ::gethostbyname ((char *) SCAP_hostname )) != 0 ) { |
428 | ::memset ( &raddr, 0, sizeof (struct sockaddr_in)); | 430 | ::memset ( &raddr, 0, sizeof (struct sockaddr_in)); |
429 | ::memcpy ( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length ); | 431 | ::memcpy ( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length ); |
@@ -454,13 +456,13 @@ void ScreenshotControl::performGrab() | |||
454 | "Content-Type: image/png\n" | 456 | "Content-Type: image/png\n" |
455 | "Host: %4\n" // 4: scap host | 457 | "Host: %4\n" // 4: scap host |
456 | "\n"; | 458 | "\n"; |
457 | 459 | ||
458 | 460 | ||
459 | header = header.arg( SCAP_model).arg( ::getenv( "USER" ) ).arg( img.numBytes() ).arg( SCAP_hostname ); | 461 | header = header.arg( SCAP_model).arg( ::getenv( "USER" ) ).arg( img.numBytes() ).arg( SCAP_hostname ); |
460 | qDebug(header); | 462 | odebug << header << oendl; |
461 | 463 | ||
462 | if ( !pix.isNull() ) { | 464 | if ( !pix.isNull() ) { |
463 | const char *ascii = header.latin1( ); | 465 | const char *ascii = header.latin1( ); |
464 | uint ascii_len = ::strlen( ascii ); | 466 | uint ascii_len = ::strlen( ascii ); |
465 | ::write ( sock, ascii, ascii_len ); | 467 | ::write ( sock, ascii, ascii_len ); |
466 | ::write ( sock, img.bits(), img.numBytes() ); | 468 | ::write ( sock, img.bits(), img.numBytes() ); |
diff --git a/core/applets/vmemo/vmemo.cpp b/core/applets/vmemo/vmemo.cpp index 7dd5b4b..622b1df 100644 --- a/core/applets/vmemo/vmemo.cpp +++ b/core/applets/vmemo/vmemo.cpp | |||
@@ -9,12 +9,16 @@ | |||
9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
10 | ** | 10 | ** |
11 | ************************************************************************************/ | 11 | ************************************************************************************/ |
12 | // copyright 2002 Jeremy Cowgar <jc@cowgar.com> | 12 | // copyright 2002 Jeremy Cowgar <jc@cowgar.com> |
13 | // copyright 2002 and 2003 L.J.Potter <ljp@llornkcor.com> | 13 | // copyright 2002 and 2003 L.J.Potter <ljp@llornkcor.com> |
14 | 14 | ||
15 | /* OPIE */ | ||
16 | #include <opie2/odebug.h> | ||
17 | using namespace Opie::Core; | ||
18 | |||
15 | extern "C" { | 19 | extern "C" { |
16 | #include "adpcm.h" | 20 | #include "adpcm.h" |
17 | } | 21 | } |
18 | 22 | ||
19 | #include <unistd.h> | 23 | #include <unistd.h> |
20 | #include <stdio.h> | 24 | #include <stdio.h> |
@@ -204,13 +208,13 @@ VMemo::VMemo( QWidget *parent, const char *_name ) | |||
204 | 208 | ||
205 | Config vmCfg("Vmemo"); | 209 | Config vmCfg("Vmemo"); |
206 | vmCfg.setGroup("Defaults"); | 210 | vmCfg.setGroup("Defaults"); |
207 | int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); | 211 | int toggleKey = setToggleButton(vmCfg.readNumEntry("toggleKey", -1)); |
208 | useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); | 212 | useADPCM = vmCfg.readBoolEntry("use_ADPCM", 0); |
209 | 213 | ||
210 | qDebug("toggleKey %d", toggleKey); | 214 | odebug << "toggleKey " << toggleKey << "" << oendl; |
211 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 215 | if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
212 | systemZaurus=TRUE; | 216 | systemZaurus=TRUE; |
213 | else | 217 | else |
214 | systemZaurus=FALSE; | 218 | systemZaurus=FALSE; |
215 | 219 | ||
216 | myChannel = new QCopChannel( "QPE/VMemo", this ); | 220 | myChannel = new QCopChannel( "QPE/VMemo", this ); |
@@ -242,13 +246,13 @@ VMemo::~VMemo() { | |||
242 | int VMemo::position() | 246 | int VMemo::position() |
243 | { | 247 | { |
244 | return 6; | 248 | return 6; |
245 | } | 249 | } |
246 | 250 | ||
247 | void VMemo::receive( const QCString &msg, const QByteArray &data ) { | 251 | void VMemo::receive( const QCString &msg, const QByteArray &data ) { |
248 | qDebug("receive"); | 252 | odebug << "receive" << oendl; |
249 | QDataStream stream( data, IO_ReadOnly ); | 253 | QDataStream stream( data, IO_ReadOnly ); |
250 | 254 | ||
251 | if (msg == "toggleRecord()") { | 255 | if (msg == "toggleRecord()") { |
252 | if (recording) { | 256 | if (recording) { |
253 | fromToggle = TRUE; | 257 | fromToggle = TRUE; |
254 | stopRecording(); | 258 | stopRecording(); |
@@ -290,13 +294,13 @@ bool VMemo::startRecording() { | |||
290 | 294 | ||
291 | msgLabel = new QLabel( 0, "alertLabel" ); | 295 | msgLabel = new QLabel( 0, "alertLabel" ); |
292 | msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); | 296 | msgLabel->setText("<B><P><font size=+2>VMemo-Recording</font></B>"); |
293 | msgLabel->show(); | 297 | msgLabel->show(); |
294 | } | 298 | } |
295 | 299 | ||
296 | qDebug("Start recording engines"); | 300 | odebug << "Start recording engines" << oendl; |
297 | recording = TRUE; | 301 | recording = TRUE; |
298 | 302 | ||
299 | if (openDSP() == -1) { | 303 | if (openDSP() == -1) { |
300 | recording = FALSE; | 304 | recording = FALSE; |
301 | return FALSE; | 305 | return FALSE; |
302 | } | 306 | } |
@@ -315,26 +319,26 @@ bool VMemo::startRecording() { | |||
315 | fileName = config.readEntry("RecLocation", fName); | 319 | fileName = config.readEntry("RecLocation", fName); |
316 | 320 | ||
317 | int s; | 321 | int s; |
318 | s=fileName.find(':'); | 322 | s=fileName.find(':'); |
319 | if(s) | 323 | if(s) |
320 | fileName=fileName.right(fileName.length()-s-2); | 324 | fileName=fileName.right(fileName.length()-s-2); |
321 | qDebug("pathname will be "+fileName); | 325 | odebug << "pathname will be "+fileName << oendl; |
322 | 326 | ||
323 | if( fileName.left(1).find('/') == -1) | 327 | if( fileName.left(1).find('/') == -1) |
324 | fileName="/"+fileName; | 328 | fileName="/"+fileName; |
325 | if( fileName.right(1).find('/') == -1) | 329 | if( fileName.right(1).find('/') == -1) |
326 | fileName+="/"; | 330 | fileName+="/"; |
327 | fName = "vm_"+ date+ ".wav"; | 331 | fName = "vm_"+ date+ ".wav"; |
328 | 332 | ||
329 | fileName+=fName; | 333 | fileName+=fName; |
330 | qDebug("filename is "+fileName); | 334 | odebug << "filename is "+fileName << oendl; |
331 | // open tmp file here | 335 | // open tmp file here |
332 | char *pointer; | 336 | char *pointer; |
333 | pointer=tmpnam(NULL); | 337 | pointer=tmpnam(NULL); |
334 | qDebug("Opening tmp file %s",pointer); | 338 | odebug << "Opening tmp file " << pointer << "" << oendl; |
335 | 339 | ||
336 | if(openWAV(pointer ) == -1) { | 340 | if(openWAV(pointer ) == -1) { |
337 | 341 | ||
338 | QString err("Could not open the temp file\n"); | 342 | QString err("Could not open the temp file\n"); |
339 | err += fileName; | 343 | err += fileName; |
340 | QMessageBox::critical(0, "vmemo", err, "Abort"); | 344 | QMessageBox::critical(0, "vmemo", err, "Abort"); |
@@ -368,13 +372,13 @@ bool VMemo::startRecording() { | |||
368 | return FALSE; | 372 | return FALSE; |
369 | 373 | ||
370 | } | 374 | } |
371 | 375 | ||
372 | void VMemo::stopRecording() { | 376 | void VMemo::stopRecording() { |
373 | show(); | 377 | show(); |
374 | qDebug("Stopped recording"); | 378 | odebug << "Stopped recording" << oendl; |
375 | recording = FALSE; | 379 | recording = FALSE; |
376 | if(useAlerts) { | 380 | if(useAlerts) { |
377 | msgLabel->close(); | 381 | msgLabel->close(); |
378 | msgLabel=0; | 382 | msgLabel=0; |
379 | delete msgLabel; | 383 | delete msgLabel; |
380 | } | 384 | } |
@@ -396,13 +400,13 @@ int VMemo::openDSP() { | |||
396 | resolution = 16; | 400 | resolution = 16; |
397 | } else { | 401 | } else { |
398 | format = AFMT_U8; | 402 | format = AFMT_U8; |
399 | resolution = 8; | 403 | resolution = 8; |
400 | } | 404 | } |
401 | 405 | ||
402 | qDebug("samplerate: %d, channels %d, resolution %d", speed, channels, resolution); | 406 | odebug << "samplerate: " << speed << ", channels " << channels << ", resolution " << resolution << "" << oendl; |
403 | 407 | ||
404 | if(systemZaurus) { | 408 | if(systemZaurus) { |
405 | dsp = open("/dev/dsp1", O_RDONLY); //Zaurus needs /dev/dsp1 | 409 | dsp = open("/dev/dsp1", O_RDONLY); //Zaurus needs /dev/dsp1 |
406 | channels=1; //zaurus has one input channel | 410 | channels=1; //zaurus has one input channel |
407 | } else { | 411 | } else { |
408 | dsp = open("/dev/dsp", O_RDONLY); | 412 | dsp = open("/dev/dsp", O_RDONLY); |
@@ -480,24 +484,24 @@ int VMemo::openWAV(const char *filename) { | |||
480 | 484 | ||
481 | bool VMemo::record() { | 485 | bool VMemo::record() { |
482 | length=0; | 486 | length=0; |
483 | int result, value; | 487 | int result, value; |
484 | QString msg; | 488 | QString msg; |
485 | msg.sprintf("Recording format %d", format); | 489 | msg.sprintf("Recording format %d", format); |
486 | qDebug(msg); | 490 | odebug << msg << oendl; |
487 | Config config("Vmemo"); | 491 | Config config("Vmemo"); |
488 | config.setGroup("Record"); | 492 | config.setGroup("Record"); |
489 | int sRate=config.readNumEntry("SizeLimit", 30); | 493 | int sRate=config.readNumEntry("SizeLimit", 30); |
490 | if(sRate > 0) | 494 | if(sRate > 0) |
491 | t_timer->start( sRate * 1000+1000, TRUE); | 495 | t_timer->start( sRate * 1000+1000, TRUE); |
492 | 496 | ||
493 | // if(systemZaurus) { | 497 | // if(systemZaurus) { |
494 | // } else { // 16 bit only capabilities | 498 | // } else { // 16 bit only capabilities |
495 | 499 | ||
496 | msg.sprintf("Recording format other"); | 500 | msg.sprintf("Recording format other"); |
497 | qDebug(msg); | 501 | odebug << msg << oendl; |
498 | 502 | ||
499 | int bufsize=1024; | 503 | int bufsize=1024; |
500 | int bytesWritten=0; | 504 | int bytesWritten=0; |
501 | signed short sound[1024], monoBuffer[1024]; | 505 | signed short sound[1024], monoBuffer[1024]; |
502 | char abuf[bufsize/2]; | 506 | char abuf[bufsize/2]; |
503 | short sbuf[bufsize]; | 507 | short sbuf[bufsize]; |
@@ -510,13 +514,13 @@ bool VMemo::record() { | |||
510 | if(useADPCM) | 514 | if(useADPCM) |
511 | result = read( dsp, sbuf, bufsize); // 8192 | 515 | result = read( dsp, sbuf, bufsize); // 8192 |
512 | else | 516 | else |
513 | result = read(dsp, sound, 1024); // 8192 | 517 | result = read(dsp, sound, 1024); // 8192 |
514 | if( result <= 0) { | 518 | if( result <= 0) { |
515 | perror("recording error "); | 519 | perror("recording error "); |
516 | // qDebug(currentFileName); | 520 | // odebug << currentFileName << oendl; |
517 | QMessageBox::message(tr("Note"),tr("error recording")); | 521 | QMessageBox::message(tr("Note"),tr("error recording")); |
518 | recording=FALSE; | 522 | recording=FALSE; |
519 | break; | 523 | break; |
520 | return FALSE; | 524 | return FALSE; |
521 | } | 525 | } |
522 | 526 | ||
@@ -537,13 +541,13 @@ bool VMemo::record() { | |||
537 | recording=false; | 541 | recording=false; |
538 | perror("dev/dsp's is a lookin' messy"); | 542 | perror("dev/dsp's is a lookin' messy"); |
539 | QMessageBox::message("Vmemo","Error writing to file\n"+ fileName); | 543 | QMessageBox::message("Vmemo","Error writing to file\n"+ fileName); |
540 | break; | 544 | break; |
541 | return FALSE; | 545 | return FALSE; |
542 | } | 546 | } |
543 | // printf("%d\r",length); | 547 | // odebug << "" << length << "\r" << oendl; |
544 | // fflush(stdout); | 548 | // fflush(stdout); |
545 | qApp->processEvents(); | 549 | qApp->processEvents(); |
546 | } | 550 | } |
547 | // qDebug("file has length of %d lasting %d seconds", | 551 | // qDebug("file has length of %d lasting %d seconds", |
548 | // length, (( length / speed) / channels) / 2 ); | 552 | // length, (( length / speed) / channels) / 2 ); |
549 | // } | 553 | // } |
@@ -556,13 +560,13 @@ bool VMemo::record() { | |||
556 | write(wav, &value, 4); | 560 | write(wav, &value, 4); |
557 | lseek(wav, 40, SEEK_SET); | 561 | lseek(wav, 40, SEEK_SET); |
558 | 562 | ||
559 | write(wav, &length, 4); | 563 | write(wav, &length, 4); |
560 | 564 | ||
561 | track.close(); | 565 | track.close(); |
562 | qDebug("Track closed"); | 566 | odebug << "Track closed" << oendl; |
563 | 567 | ||
564 | if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1) | 568 | if( ioctl( dsp, SNDCTL_DSP_RESET,0) == -1) |
565 | perror("ioctl(\"SNDCTL_DSP_RESET\")"); | 569 | perror("ioctl(\"SNDCTL_DSP_RESET\")"); |
566 | 570 | ||
567 | ::close(dsp); | 571 | ::close(dsp); |
568 | 572 | ||
@@ -580,17 +584,17 @@ bool VMemo::record() { | |||
580 | cfgO.writeEntry( QString::number( nFiles + 1), currentFile); | 584 | cfgO.writeEntry( QString::number( nFiles + 1), currentFile); |
581 | cfgO.writeEntry( currentFile, currentFileName); | 585 | cfgO.writeEntry( currentFile, currentFileName); |
582 | 586 | ||
583 | QString time; | 587 | QString time; |
584 | time.sprintf("%.2f", numberOfRecordedSeconds); | 588 | time.sprintf("%.2f", numberOfRecordedSeconds); |
585 | cfgO.writeEntry( currentFileName, time ); | 589 | cfgO.writeEntry( currentFileName, time ); |
586 | // qDebug("writing config numberOfRecordedSeconds "+time); | 590 | // odebug << "writing config numberOfRecordedSeconds "+time << oendl; |
587 | 591 | ||
588 | cfgO.write(); | 592 | cfgO.write(); |
589 | 593 | ||
590 | qDebug("done recording "+fileName); | 594 | odebug << "done recording "+fileName << oendl; |
591 | 595 | ||
592 | Config cfg("qpe"); | 596 | Config cfg("qpe"); |
593 | cfg.setGroup("Volume"); | 597 | cfg.setGroup("Volume"); |
594 | QString foo = cfg.readEntry("Mute","TRUE"); | 598 | QString foo = cfg.readEntry("Mute","TRUE"); |
595 | if(foo.find("TRUE",0,TRUE) != -1) | 599 | if(foo.find("TRUE",0,TRUE) != -1) |
596 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute | 600 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; //mute |
diff --git a/core/applets/vtapplet/vt.cpp b/core/applets/vtapplet/vt.cpp index bd39093..aec63c3 100644 --- a/core/applets/vtapplet/vt.cpp +++ b/core/applets/vtapplet/vt.cpp | |||
@@ -1,34 +1,37 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2003 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2003-2004 Michael 'Mickey' Lauer <mickey@Vanille.de> |
3 | ** | ||
4 | ** Contact me @ mickeyl@handhelds.org | ||
5 | ** | 3 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 4 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 5 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 6 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 7 | ** packaging of this file. |
10 | ** | 8 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 9 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 10 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 11 | ** |
14 | **********************************************************************/ | 12 | **********************************************************************/ |
15 | 13 | ||
14 | #include "vt.h" | ||
15 | |||
16 | /* OPIE */ | ||
17 | #include <opie2/odebug.h> | ||
16 | #include <qpe/resource.h> | 18 | #include <qpe/resource.h> |
19 | using namespace Opie::Core; | ||
17 | 20 | ||
21 | /* QT */ | ||
18 | #include <qpopupmenu.h> | 22 | #include <qpopupmenu.h> |
19 | 23 | ||
24 | /* STD */ | ||
20 | #include <fcntl.h> | 25 | #include <fcntl.h> |
21 | #include <unistd.h> | 26 | #include <unistd.h> |
22 | #include <sys/types.h> | 27 | #include <sys/types.h> |
23 | #include <sys/stat.h> | 28 | #include <sys/stat.h> |
24 | #include <sys/ioctl.h> | 29 | #include <sys/ioctl.h> |
25 | #include <linux/vt.h> | 30 | #include <linux/vt.h> |
26 | 31 | ||
27 | #include "vt.h" | ||
28 | |||
29 | VTApplet::VTApplet ( ) | 32 | VTApplet::VTApplet ( ) |
30 | : QObject ( 0, "VTApplet" ) | 33 | : QObject ( 0, "VTApplet" ) |
31 | { | 34 | { |
32 | } | 35 | } |
33 | 36 | ||
34 | VTApplet::~VTApplet ( ) | 37 | VTApplet::~VTApplet ( ) |
@@ -71,13 +74,13 @@ QIconSet VTApplet::icon ( ) const | |||
71 | pix. convertFromImage ( img. smoothScale ( 14, 14 )); | 74 | pix. convertFromImage ( img. smoothScale ( 14, 14 )); |
72 | return pix; | 75 | return pix; |
73 | } | 76 | } |
74 | 77 | ||
75 | QPopupMenu *VTApplet::popup ( QWidget* parent ) const | 78 | QPopupMenu *VTApplet::popup ( QWidget* parent ) const |
76 | { | 79 | { |
77 | qDebug( "VTApplet::popup" ); | 80 | odebug << "VTApplet::popup" << oendl; |
78 | 81 | ||
79 | struct vt_stat vtstat; | 82 | struct vt_stat vtstat; |
80 | int fd = ::open( "/dev/tty0", O_RDWR ); | 83 | int fd = ::open( "/dev/tty0", O_RDWR ); |
81 | if ( fd == -1 ) return 0; | 84 | if ( fd == -1 ) return 0; |
82 | if ( ioctl( fd, VT_GETSTATE, &vtstat ) == -1 ) return 0; | 85 | if ( ioctl( fd, VT_GETSTATE, &vtstat ) == -1 ) return 0; |
83 | 86 | ||
@@ -96,48 +99,48 @@ QPopupMenu *VTApplet::popup ( QWidget* parent ) const | |||
96 | return m_subMenu; | 99 | return m_subMenu; |
97 | } | 100 | } |
98 | 101 | ||
99 | 102 | ||
100 | void VTApplet::changeVT( int index ) | 103 | void VTApplet::changeVT( int index ) |
101 | { | 104 | { |
102 | //qDebug( "VTApplet::changeVT( %d )", index-500 ); | 105 | //odebug << "VTApplet::changeVT( " << index-500 << " )" << oendl; |
103 | 106 | ||
104 | int fd = ::open("/dev/tty0", O_RDWR); | 107 | int fd = ::open("/dev/tty0", O_RDWR); |
105 | if ( fd == -1 ) return; | 108 | if ( fd == -1 ) return; |
106 | ioctl( fd, VT_ACTIVATE, index-500 ); | 109 | ioctl( fd, VT_ACTIVATE, index-500 ); |
107 | } | 110 | } |
108 | 111 | ||
109 | 112 | ||
110 | void VTApplet::updateMenu() | 113 | void VTApplet::updateMenu() |
111 | { | 114 | { |
112 | //qDebug( "VTApplet::updateMenu()" ); | 115 | //odebug << "VTApplet::updateMenu()" << oendl; |
113 | 116 | ||
114 | int fd = ::open( "/dev/console", O_RDONLY ); | 117 | int fd = ::open( "/dev/console", O_RDONLY ); |
115 | if ( fd == -1 ) return; | 118 | if ( fd == -1 ) return; |
116 | 119 | ||
117 | for ( int i = 1; i < 10; ++i ) | 120 | for ( int i = 1; i < 10; ++i ) |
118 | { | 121 | { |
119 | int result = ioctl( fd, VT_DISALLOCATE, i ); | 122 | int result = ioctl( fd, VT_DISALLOCATE, i ); |
120 | 123 | ||
121 | /* | 124 | /* |
122 | if ( result == -1 ) | 125 | if ( result == -1 ) |
123 | qDebug( "VT %d disallocated == free", i ); | 126 | odebug << "VT " << i << " disallocated == free" << oendl; |
124 | else | 127 | else |
125 | qDebug( "VT %d _not_ disallocated == busy", i ); | 128 | odebug << "VT " << i << " _not_ disallocated == busy" << oendl; |
126 | */ | 129 | */ |
127 | 130 | ||
128 | m_subMenu->setItemEnabled( 500+i, result == -1 ); | 131 | m_subMenu->setItemEnabled( 500+i, result == -1 ); |
129 | } | 132 | } |
130 | 133 | ||
131 | ::close( fd ); | 134 | ::close( fd ); |
132 | } | 135 | } |
133 | 136 | ||
134 | 137 | ||
135 | void VTApplet::activated() | 138 | void VTApplet::activated() |
136 | { | 139 | { |
137 | qDebug( "VTApplet::activated()" ); | 140 | odebug << "VTApplet::activated()" << oendl; |
138 | } | 141 | } |
139 | 142 | ||
140 | 143 | ||
141 | QRESULT VTApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) | 144 | QRESULT VTApplet::queryInterface ( const QUuid &uuid, QUnknownInterface **iface ) |
142 | { | 145 | { |
143 | *iface = 0; | 146 | *iface = 0; |
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp index cd8d58e..f3dd11c 100644 --- a/core/obex/obexsend.cpp +++ b/core/obex/obexsend.cpp | |||
@@ -1,22 +1,23 @@ | |||
1 | #include "obex.h" | ||
2 | #include "obexsend.h" | ||
3 | using namespace OpieObex; | ||
4 | |||
5 | /* OPIE */ | ||
6 | #include <opie2/odebug.h> | ||
7 | #include <qpe/qcopenvelope_qws.h> | ||
8 | using namespace Opie::Core; | ||
9 | |||
10 | /* QT */ | ||
1 | #include <qpushbutton.h> | 11 | #include <qpushbutton.h> |
2 | #include <qlabel.h> | 12 | #include <qlabel.h> |
3 | #include <qlayout.h> | 13 | #include <qlayout.h> |
4 | #include <qtimer.h> | 14 | #include <qtimer.h> |
5 | 15 | ||
6 | |||
7 | #include <qpe/qcopenvelope_qws.h> | ||
8 | |||
9 | #include "obex.h" | ||
10 | #include "obexsend.h" | ||
11 | |||
12 | using namespace OpieObex; | ||
13 | |||
14 | /* TRANSLATOR OpieObex::SendWidget */ | 16 | /* TRANSLATOR OpieObex::SendWidget */ |
15 | 17 | ||
16 | |||
17 | SendWidget::SendWidget( QWidget* parent, const char* name ) | 18 | SendWidget::SendWidget( QWidget* parent, const char* name ) |
18 | : QWidget( parent, name ) { | 19 | : QWidget( parent, name ) { |
19 | initUI(); | 20 | initUI(); |
20 | } | 21 | } |
21 | SendWidget::~SendWidget() { | 22 | SendWidget::~SendWidget() { |
22 | } | 23 | } |
@@ -101,13 +102,13 @@ void SendWidget::send( const QString& file, const QString& desc ) { | |||
101 | QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); | 102 | QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); |
102 | QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); | 103 | QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); |
103 | QCopEnvelope e3("QPE/Bluetooth", "listDevices()"); | 104 | QCopEnvelope e3("QPE/Bluetooth", "listDevices()"); |
104 | } | 105 | } |
105 | } | 106 | } |
106 | void SendWidget::slotIrDaDevices( const QStringList& list) { | 107 | void SendWidget::slotIrDaDevices( const QStringList& list) { |
107 | qWarning("slot it irda devices "); | 108 | owarn << "slot it irda devices " << oendl; |
108 | for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) { | 109 | for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) { |
109 | int id = m_devBox->addDevice( (*it), DeviceBox::IrDa, tr("Scheduling for beam.") ); | 110 | int id = m_devBox->addDevice( (*it), DeviceBox::IrDa, tr("Scheduling for beam.") ); |
110 | m_irDa.insert( id, (*it) ); | 111 | m_irDa.insert( id, (*it) ); |
111 | } | 112 | } |
112 | m_devBox->removeDevice( m_irDeSearch ); | 113 | m_devBox->removeDevice( m_irDeSearch ); |
113 | m_irDaIt = m_irDa.begin(); | 114 | m_irDaIt = m_irDa.begin(); |
@@ -120,22 +121,22 @@ void SendWidget::slotBTDevices( const QMap<QString, QString>& str ) { | |||
120 | int id = m_devBox->addDevice( it.key(), DeviceBox::BT, tr("Click to beam") ); | 121 | int id = m_devBox->addDevice( it.key(), DeviceBox::BT, tr("Click to beam") ); |
121 | m_bt.insert( id, Pair( it.key(), it.data() ) ); | 122 | m_bt.insert( id, Pair( it.key(), it.data() ) ); |
122 | } | 123 | } |
123 | m_devBox->removeDevice( m_btDeSearch ); | 124 | m_devBox->removeDevice( m_btDeSearch ); |
124 | } | 125 | } |
125 | void SendWidget::slotSelectedDevice( int name, int dev ) { | 126 | void SendWidget::slotSelectedDevice( int name, int dev ) { |
126 | qWarning("Start beam? %d %d", name, dev ); | 127 | owarn << "Start beam? " << name << " " << dev << "" << oendl; |
127 | if ( name == m_irDeSearch ) { | 128 | if ( name == m_irDeSearch ) { |
128 | for (QMap<int, QString>::Iterator it= m_irDa.begin(); it != m_irDa.end(); ++it ) | 129 | for (QMap<int, QString>::Iterator it= m_irDa.begin(); it != m_irDa.end(); ++it ) |
129 | m_devBox->removeDevice( it.key() ); | 130 | m_devBox->removeDevice( it.key() ); |
130 | 131 | ||
131 | QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); | 132 | QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); |
132 | } | 133 | } |
133 | } | 134 | } |
134 | void SendWidget::dispatchIrda( const QCString& str, const QByteArray& ar ) { | 135 | void SendWidget::dispatchIrda( const QCString& str, const QByteArray& ar ) { |
135 | qWarning("dispatch irda %s", str.data() ); | 136 | owarn << "dispatch irda " << str.data() << "" << oendl; |
136 | if ( str == "devices(QStringList)" ) { | 137 | if ( str == "devices(QStringList)" ) { |
137 | QDataStream stream( ar, IO_ReadOnly ); | 138 | QDataStream stream( ar, IO_ReadOnly ); |
138 | QStringList list; | 139 | QStringList list; |
139 | stream >> list; | 140 | stream >> list; |
140 | slotIrDaDevices( list ); | 141 | slotIrDaDevices( list ); |
141 | } | 142 | } |
@@ -144,13 +145,13 @@ void SendWidget::dispatchBt( const QCString&, const QByteArray& ) { | |||
144 | 145 | ||
145 | } | 146 | } |
146 | void SendWidget::slotIrError( int ) { | 147 | void SendWidget::slotIrError( int ) { |
147 | 148 | ||
148 | } | 149 | } |
149 | void SendWidget::slotIrSent( bool b) { | 150 | void SendWidget::slotIrSent( bool b) { |
150 | qWarning("irda sent!!"); | 151 | owarn << "irda sent!!" << oendl; |
151 | QString text = b ? tr("Sent") : tr("Failure"); | 152 | QString text = b ? tr("Sent") : tr("Failure"); |
152 | m_devBox->setStatus( m_irDaIt.key(), text ); | 153 | m_devBox->setStatus( m_irDaIt.key(), text ); |
153 | ++m_irDaIt; | 154 | ++m_irDaIt; |
154 | slotStartIrda(); | 155 | slotStartIrda(); |
155 | } | 156 | } |
156 | void SendWidget::slotIrTry(unsigned int trI) { | 157 | void SendWidget::slotIrTry(unsigned int trI) { |
@@ -201,13 +202,13 @@ void DeviceBox::removeDevice( int id ) { | |||
201 | void DeviceBox::setStatus( int id, const QString& status ) { | 202 | void DeviceBox::setStatus( int id, const QString& status ) { |
202 | if ( !m_dev.contains(id) ) return; | 203 | if ( !m_dev.contains(id) ) return; |
203 | m_dev[id].setStatus(status ); | 204 | m_dev[id].setStatus(status ); |
204 | setText( allText() ); | 205 | setText( allText() ); |
205 | } | 206 | } |
206 | void DeviceBox::setSource( const QString& str ) { | 207 | void DeviceBox::setSource( const QString& str ) { |
207 | qWarning("SetSource:%d", str.toInt() ); | 208 | owarn << "SetSource:" << str.toInt() << "" << oendl; |
208 | int id = str.toInt(); | 209 | int id = str.toInt(); |
209 | emit selectedDevice( id, m_dev[id].device() ); | 210 | emit selectedDevice( id, m_dev[id].device() ); |
210 | } | 211 | } |
211 | int DeviceBox::idFor ( int id ) { | 212 | int DeviceBox::idFor ( int id ) { |
212 | static int irId = 1501; | 213 | static int irId = 1501; |
213 | static int irBT = 1001; | 214 | static int irBT = 1001; |
diff --git a/core/obex/receiver.cpp b/core/obex/receiver.cpp index ee2668b..8885256 100644 --- a/core/obex/receiver.cpp +++ b/core/obex/receiver.cpp | |||
@@ -1,27 +1,30 @@ | |||
1 | #include <sys/types.h> | 1 | #include "obex.h" |
2 | #include <sys/stat.h> | 2 | #include "receiver.h" |
3 | #include <sys/mman.h> | 3 | using namespace OpieObex; |
4 | #include <stdlib.h> // int system | ||
5 | #include <unistd.h> | ||
6 | 4 | ||
7 | #include <fcntl.h> | 5 | /* OPIE */ |
6 | #include <opie2/odebug.h> | ||
7 | #include <qpe/applnk.h> | ||
8 | #include <qpe/qpeapplication.h> | ||
9 | #include <qpe/qcopenvelope_qws.h> | ||
10 | using namespace Opie::Core; | ||
8 | 11 | ||
12 | /* QT */ | ||
9 | #include <qfileinfo.h> | 13 | #include <qfileinfo.h> |
10 | #include <qlabel.h> | 14 | #include <qlabel.h> |
11 | #include <qtextview.h> | 15 | #include <qtextview.h> |
12 | #include <qpushbutton.h> | 16 | #include <qpushbutton.h> |
13 | 17 | ||
14 | #include <qpe/applnk.h> | 18 | /* STD */ |
15 | #include <qpe/qpeapplication.h> | 19 | #include <sys/types.h> |
16 | #include <qpe/qcopenvelope_qws.h> | 20 | #include <sys/stat.h> |
17 | 21 | #include <sys/mman.h> | |
18 | #include "obex.h" | 22 | #include <stdlib.h> // int system |
19 | #include "receiver.h" | 23 | #include <unistd.h> |
20 | 24 | #include <fcntl.h> | |
21 | using namespace OpieObex; | ||
22 | 25 | ||
23 | /* TRANSLATOR OpieObex::Receiver */ | 26 | /* TRANSLATOR OpieObex::Receiver */ |
24 | 27 | ||
25 | Receiver::Receiver() { | 28 | Receiver::Receiver() { |
26 | m_obex = new Obex(this, "Receiver"); | 29 | m_obex = new Obex(this, "Receiver"); |
27 | connect(m_obex, SIGNAL(receivedFile(const QString&) ), | 30 | connect(m_obex, SIGNAL(receivedFile(const QString&) ), |
@@ -72,20 +75,20 @@ void Receiver::tidyUp( QString& _file, const QString& ending) { | |||
72 | if ( fd == -1 ) | 75 | if ( fd == -1 ) |
73 | return; | 76 | return; |
74 | 77 | ||
75 | (void)::strncat( foo, ending.latin1(), 4 ); | 78 | (void)::strncat( foo, ending.latin1(), 4 ); |
76 | _file = QString::fromLatin1( foo ); | 79 | _file = QString::fromLatin1( foo ); |
77 | QString cmd = QString("sed -e \"s/^\\(X-MICROSOFT-BODYINK\\)\\;/\\1:/;\" < %2 > %2 ").arg( Global::shellQuote(file)).arg( Global::shellQuote(_file) ); | 80 | QString cmd = QString("sed -e \"s/^\\(X-MICROSOFT-BODYINK\\)\\;/\\1:/;\" < %2 > %2 ").arg( Global::shellQuote(file)).arg( Global::shellQuote(_file) ); |
78 | qWarning("Executing: %s", cmd.latin1() ); | 81 | owarn << "Executing: " << cmd << "" << oendl; |
79 | (void)::system( cmd.latin1() ); | 82 | (void)::system( cmd.latin1() ); |
80 | 83 | ||
81 | cmd = QString("rm %1").arg( Global::shellQuote(file) ); | 84 | cmd = QString("rm %1").arg( Global::shellQuote(file) ); |
82 | (void)::system( cmd.latin1() ); | 85 | (void)::system( cmd.latin1() ); |
83 | } | 86 | } |
84 | int Receiver::checkFile( QString& file ) { | 87 | int Receiver::checkFile( QString& file ) { |
85 | qWarning("check file!! %s", file.latin1() ); | 88 | owarn << "check file!! " << file << "" << oendl; |
86 | int ret; | 89 | int ret; |
87 | QString ending; | 90 | QString ending; |
88 | 91 | ||
89 | if (file.right(4) == ".vcs" ) { | 92 | if (file.right(4) == ".vcs" ) { |
90 | ret = Datebook; | 93 | ret = Datebook; |
91 | ending = QString::fromLatin1(".vcs"); | 94 | ending = QString::fromLatin1(".vcs"); |
@@ -104,13 +107,13 @@ int Receiver::checkFile( QString& file ) { | |||
104 | * and M$ likes to send that. So we will executed a small | 107 | * and M$ likes to send that. So we will executed a small |
105 | * tidy up system sed script | 108 | * tidy up system sed script |
106 | * At this point we can also remove umlaute from the filename | 109 | * At this point we can also remove umlaute from the filename |
107 | */ | 110 | */ |
108 | tidyUp( file, ending ); | 111 | tidyUp( file, ending ); |
109 | 112 | ||
110 | qWarning("check it now %d", ret ); | 113 | owarn << "check it now " << ret << "" << oendl; |
111 | return ret; | 114 | return ret; |
112 | } | 115 | } |
113 | 116 | ||
114 | /* TRANSLATOR OpieObex::OtherHandler */ | 117 | /* TRANSLATOR OpieObex::OtherHandler */ |
115 | 118 | ||
116 | OtherHandler::OtherHandler() | 119 | OtherHandler::OtherHandler() |
@@ -145,13 +148,13 @@ OtherHandler::~OtherHandler() { | |||
145 | 148 | ||
146 | } | 149 | } |
147 | void OtherHandler::handle( const QString& file ) { | 150 | void OtherHandler::handle( const QString& file ) { |
148 | m_file = file; | 151 | m_file = file; |
149 | m_na->setText(file); | 152 | m_na->setText(file); |
150 | DocLnk lnk(file); | 153 | DocLnk lnk(file); |
151 | qWarning(" %s %s", lnk.type().latin1(), lnk.icon().latin1() ); | 154 | owarn << " " << lnk.type() << " " << lnk.icon() << "" << oendl; |
152 | 155 | ||
153 | QString str = tr("<p>You received a file of type %1 (<img src=\"%2\"> )What do you want to do?").arg(lnk.type() ).arg(lnk.icon() ); | 156 | QString str = tr("<p>You received a file of type %1 (<img src=\"%2\"> )What do you want to do?").arg(lnk.type() ).arg(lnk.icon() ); |
154 | m_view->setText( str ); | 157 | m_view->setText( str ); |
155 | } | 158 | } |
156 | 159 | ||
157 | /* | 160 | /* |
@@ -188,12 +191,12 @@ QString OtherHandler::targetName( const QString& file ) { | |||
188 | 191 | ||
189 | return newFile; | 192 | return newFile; |
190 | } | 193 | } |
191 | 194 | ||
192 | /* fast cpy */ | 195 | /* fast cpy */ |
193 | void OtherHandler::copy(const QString& src, const QString& file) { | 196 | void OtherHandler::copy(const QString& src, const QString& file) { |
194 | qWarning("src %s, dest %s", src.latin1(),file.latin1() ); | 197 | owarn << "src " << src << ", dest " << file << "" << oendl; |
195 | QString cmd = QString("mv %1 %2").arg( Global::shellQuote( src )). | 198 | QString cmd = QString("mv %1 %2").arg( Global::shellQuote( src )). |
196 | arg( Global::shellQuote( file ) ); | 199 | arg( Global::shellQuote( file ) ); |
197 | ::system( cmd.latin1() ); | 200 | ::system( cmd.latin1() ); |
198 | // done | 201 | // done |
199 | } | 202 | } |