Diffstat (limited to 'core/applets/screenshotapplet/screenshot.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/applets/screenshotapplet/screenshot.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp index 938ea0c..042f390 100644 --- a/core/applets/screenshotapplet/screenshot.cpp +++ b/core/applets/screenshotapplet/screenshot.cpp | |||
@@ -17,14 +17,14 @@ | |||
17 | 17 | ||
18 | /* OPIE */ | 18 | /* OPIE */ |
19 | #include <opie2/odebug.h> | 19 | #include <opie2/odebug.h> |
20 | #include <opie2/otaskbarapplet.h> | 20 | #include <opie2/otaskbarapplet.h> |
21 | #include <qpe/qpeapplication.h> | 21 | #include <qpe/qpeapplication.h> |
22 | #include <qpe/applnk.h> | 22 | #include <qpe/applnk.h> |
23 | using namespace Opie::Core; | 23 | #include <qpe/qcopenvelope_qws.h> |
24 | using namespace Opie::Ui; | 24 | |
25 | 25 | ||
26 | /* QT */ | 26 | /* QT */ |
27 | #include <qlineedit.h> | 27 | #include <qlineedit.h> |
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qlabel.h> | 29 | #include <qlabel.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
@@ -251,12 +251,16 @@ static char * snapshot_xpm[] = { | |||
251 | " $ . s.d 6 B A p H.S.L.H.q B.Q.Q.M.M.. ; ", | 251 | " $ . s.d 6 B A p H.S.L.H.q B.Q.Q.M.M.. ; ", |
252 | " ; 9 . 6 L.p L.d L.H.d Q.M.M.. 9 ; ] ", | 252 | " ; 9 . 6 L.p L.d L.H.d Q.M.M.. 9 ; ] ", |
253 | " | > e L.d L.H.e M.. ; ] ] ", | 253 | " | > e L.d L.H.e M.. ; ] ] ", |
254 | " > 9 . S.Q.. ; ] ", | 254 | " > 9 . S.Q.. ; ] ", |
255 | " T.; ] "}; | 255 | " T.; ] "}; |
256 | 256 | ||
257 | |||
258 | using namespace Opie::Core; | ||
259 | using namespace Opie::Ui; | ||
260 | |||
257 | static const char *SCAP_hostname = "www.handhelds.org"; | 261 | static const char *SCAP_hostname = "www.handhelds.org"; |
258 | static const int SCAP_port = 80; | 262 | static const int SCAP_port = 80; |
259 | 263 | ||
260 | 264 | ||
261 | ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name ) | 265 | ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name ) |
262 | : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) | 266 | : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) |
@@ -289,12 +293,16 @@ ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name ) | |||
289 | hbox = new QHBoxLayout ( vbox ); | 293 | hbox = new QHBoxLayout ( vbox ); |
290 | 294 | ||
291 | grabItButton = new QPushButton( tr( "File" ), this, "GrabButton" ); | 295 | grabItButton = new QPushButton( tr( "File" ), this, "GrabButton" ); |
292 | grabItButton ->setFocusPolicy( QWidget::TabFocus ); | 296 | grabItButton ->setFocusPolicy( QWidget::TabFocus ); |
293 | hbox-> addWidget ( grabItButton ); | 297 | hbox-> addWidget ( grabItButton ); |
294 | 298 | ||
299 | QPushButton* drawPadButton = new QPushButton( tr("Opie drawpad"), this, "DrawPadButton" ); | ||
300 | drawPadButton->setFocusPolicy( QWidget::TabFocus ); | ||
301 | hbox->addWidget( drawPadButton ); | ||
302 | |||
295 | scapButton = new QPushButton( tr( "Scap" ), this, "ScapButton" ); | 303 | scapButton = new QPushButton( tr( "Scap" ), this, "ScapButton" ); |
296 | scapButton ->setFocusPolicy( QWidget::TabFocus ); | 304 | scapButton ->setFocusPolicy( QWidget::TabFocus ); |
297 | hbox-> addWidget ( scapButton ); | 305 | hbox-> addWidget ( scapButton ); |
298 | 306 | ||
299 | setFixedSize ( sizeHint ( )); | 307 | setFixedSize ( sizeHint ( )); |
300 | setFocusPolicy ( QWidget::NoFocus ); | 308 | setFocusPolicy ( QWidget::NoFocus ); |
@@ -302,12 +310,13 @@ ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name ) | |||
302 | 310 | ||
303 | grabTimer = new QTimer ( this, "grab timer"); | 311 | grabTimer = new QTimer ( this, "grab timer"); |
304 | 312 | ||
305 | connect ( grabTimer, SIGNAL( timeout()), this, SLOT( performGrab())); | 313 | connect ( grabTimer, SIGNAL( timeout()), this, SLOT( performGrab())); |
306 | connect ( grabItButton, SIGNAL( clicked()), SLOT( slotGrab())); | 314 | connect ( grabItButton, SIGNAL( clicked()), SLOT( slotGrab())); |
307 | connect ( scapButton, SIGNAL( clicked()), SLOT( slotScap())); | 315 | connect ( scapButton, SIGNAL( clicked()), SLOT( slotScap())); |
316 | connect ( drawPadButton, SIGNAL(clicked()), SLOT(slotDrawpad()) ); | ||
308 | } | 317 | } |
309 | 318 | ||
310 | void ScreenshotControl::slotGrab() | 319 | void ScreenshotControl::slotGrab() |
311 | { | 320 | { |
312 | buttonPushed = 1; | 321 | buttonPushed = 1; |
313 | hide(); | 322 | hide(); |
@@ -347,12 +356,21 @@ void ScreenshotControl::slotScap() | |||
347 | if ( delaySpin->value() ) | 356 | if ( delaySpin->value() ) |
348 | grabTimer->start( delaySpin->value() * 1000, true ); | 357 | grabTimer->start( delaySpin->value() * 1000, true ); |
349 | else | 358 | else |
350 | show(); | 359 | show(); |
351 | } | 360 | } |
352 | 361 | ||
362 | void ScreenshotControl::slotDrawpad() | ||
363 | { | ||
364 | buttonPushed = 3; | ||
365 | hide(); | ||
366 | if ( delaySpin->value() ) | ||
367 | grabTimer->start( delaySpin->value()*1000, true ); | ||
368 | else | ||
369 | show(); | ||
370 | } | ||
353 | 371 | ||
354 | void ScreenshotControl::savePixmap() | 372 | void ScreenshotControl::savePixmap() |
355 | { | 373 | { |
356 | DocLnk lnk; | 374 | DocLnk lnk; |
357 | QString fileName; | 375 | QString fileName; |
358 | 376 | ||
@@ -410,12 +428,17 @@ void ScreenshotControl::performGrab() | |||
410 | if (buttonPushed == 1) { | 428 | if (buttonPushed == 1) { |
411 | odebug << "grabbing screen" << oendl; | 429 | odebug << "grabbing screen" << oendl; |
412 | grabTimer->stop(); | 430 | grabTimer->stop(); |
413 | show(); | 431 | show(); |
414 | qApp->processEvents(); | 432 | qApp->processEvents(); |
415 | savePixmap(); | 433 | savePixmap(); |
434 | }else if ( buttonPushed == 3 ) { | ||
435 | grabTimer->stop(); | ||
436 | show(); | ||
437 | QCopEnvelope env("QPE/Application/drawpad", "importPixmap(QPixmap)" ); | ||
438 | env << snapshot; | ||
416 | } else { | 439 | } else { |
417 | grabTimer->stop(); | 440 | grabTimer->stop(); |
418 | 441 | ||
419 | struct sockaddr_in raddr; | 442 | struct sockaddr_in raddr; |
420 | struct hostent *rhost_info; | 443 | struct hostent *rhost_info; |
421 | int sock = -1; | 444 | int sock = -1; |