author | zecke <zecke> | 2004-04-08 00:43:00 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-08 00:43:00 (UTC) |
commit | 5badc8e0aba089d73fdbfb1b1383b937aa30a301 (patch) (unidiff) | |
tree | 07c82bb19e05c608a570f7de286e5c31fb9501c2 | |
parent | 5afca2540a2d6bf733c89ea97748496a679bc576 (diff) | |
download | opie-5badc8e0aba089d73fdbfb1b1383b937aa30a301.zip opie-5badc8e0aba089d73fdbfb1b1383b937aa30a301.tar.gz opie-5badc8e0aba089d73fdbfb1b1383b937aa30a301.tar.bz2 |
Allow to take a ScreenShot, Open it directly with drawpad
Comment it and send via email
-rw-r--r-- | core/applets/screenshotapplet/screenshot.cpp | 27 | ||||
-rw-r--r-- | core/applets/screenshotapplet/screenshot.h | 11 |
2 files changed, 31 insertions, 7 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 | |||
@@ -19,10 +19,10 @@ | |||
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> |
@@ -253,8 +253,12 @@ static char * snapshot_xpm[] = { | |||
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 | ||
@@ -291,8 +295,12 @@ ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name ) | |||
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 | ||
@@ -304,8 +312,9 @@ ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name ) | |||
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 | { |
@@ -349,8 +358,17 @@ void ScreenshotControl::slotScap() | |||
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; |
@@ -412,8 +430,13 @@ void ScreenshotControl::performGrab() | |||
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; |
diff --git a/core/applets/screenshotapplet/screenshot.h b/core/applets/screenshotapplet/screenshot.h index b753583..e7b6040 100644 --- a/core/applets/screenshotapplet/screenshot.h +++ b/core/applets/screenshotapplet/screenshot.h | |||
@@ -11,10 +11,10 @@ | |||
11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
12 | ** | 12 | ** |
13 | **********************************************************************/ | 13 | **********************************************************************/ |
14 | 14 | ||
15 | #ifndef __SCREENSHOT_APPLET_H__ | 15 | #ifndef SCREENSHOT_APPLET_H__ |
16 | #define __SCREENSHOT_APPLET_H__ | 16 | #define SCREENSHOT_APPLET_H__ |
17 | 17 | ||
18 | 18 | ||
19 | 19 | ||
20 | #include <qwidget.h> | 20 | #include <qwidget.h> |
@@ -46,9 +46,10 @@ private: | |||
46 | int buttonPushed; | 46 | int buttonPushed; |
47 | 47 | ||
48 | private slots: | 48 | private slots: |
49 | void slotGrab(); | 49 | void slotGrab(); |
50 | void slotScap(); | 50 | void slotScap(); |
51 | void slotDrawpad(); | ||
51 | void savePixmap(); | 52 | void savePixmap(); |
52 | void performGrab(); | 53 | void performGrab(); |
53 | }; | 54 | }; |
54 | 55 | ||
@@ -56,13 +57,13 @@ class ScreenshotApplet : public QWidget { | |||
56 | public: | 57 | public: |
57 | ScreenshotApplet( QWidget *parent = 0, const char *name=0 ); | 58 | ScreenshotApplet( QWidget *parent = 0, const char *name=0 ); |
58 | ~ScreenshotApplet(); | 59 | ~ScreenshotApplet(); |
59 | static int position(); | 60 | static int position(); |
60 | 61 | ||
61 | protected: | 62 | protected: |
62 | void mousePressEvent( QMouseEvent * ); | 63 | void mousePressEvent( QMouseEvent * ); |
63 | void paintEvent( QPaintEvent* ); | 64 | void paintEvent( QPaintEvent* ); |
64 | 65 | ||
65 | private: | 66 | private: |
66 | QPixmap m_icon; | 67 | QPixmap m_icon; |
67 | }; | 68 | }; |
68 | 69 | ||