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 | |||
@@ -1,48 +1,48 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com | 2 | ** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com |
3 | ** All rights reserved. | 3 | ** All rights reserved. |
4 | ** | 4 | ** |
5 | ** This file may be distributed and/or modified under the terms of the | 5 | ** This file may be distributed and/or modified under the terms of the |
6 | ** GNU General Public License version 2 as published by the Free Software | 6 | ** GNU General Public License version 2 as published by the Free Software |
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | 7 | ** Foundation and appearing in the file LICENSE.GPL included in the |
8 | ** packaging of this file. | 8 | ** packaging of this file. |
9 | ** | 9 | ** |
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
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 | #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/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> |
31 | #include <qpainter.h> | 31 | #include <qpainter.h> |
32 | #include <qspinbox.h> | 32 | #include <qspinbox.h> |
33 | #include <qlayout.h> | 33 | #include <qlayout.h> |
34 | #include <qcheckbox.h> | 34 | #include <qcheckbox.h> |
35 | #include <qmessagebox.h> | 35 | #include <qmessagebox.h> |
36 | 36 | ||
37 | /* STD */ | 37 | /* STD */ |
38 | #include <stdlib.h> | 38 | #include <stdlib.h> |
39 | #include <sys/socket.h> | 39 | #include <sys/socket.h> |
40 | #include <netinet/in.h> | 40 | #include <netinet/in.h> |
41 | #include <netdb.h> | 41 | #include <netdb.h> |
42 | #include <unistd.h> | 42 | #include <unistd.h> |
43 | 43 | ||
44 | /* XPM */ | 44 | /* XPM */ |
45 | static char * snapshot_xpm[] = { | 45 | static char * snapshot_xpm[] = { |
46 | "32 32 177 2", | 46 | "32 32 177 2", |
47 | " c None", | 47 | " c None", |
48 | ". c #042045", | 48 | ". c #042045", |
@@ -233,144 +233,162 @@ static char * snapshot_xpm[] = { | |||
233 | "| i j k j l m n 3 ) : ! ! ! ~ o o o p 6 q f / r r r s ", | 233 | "| i j k j l m n 3 ) : ! ! ! ~ o o o p 6 q f / r r r s ", |
234 | "t u v w x y y z a 1 3 ' : ! ~ A A B A p = C D E F G ( s ", | 234 | "t u v w x y y z a 1 3 ' : ! ~ A A B A p = C D E F G ( s ", |
235 | "| u H I J K L M H k N 3 3 : ~ o o 5 O P Q R S T T U V W X Y ", | 235 | "| u H I J K L M H k N 3 3 : ~ o o 5 O P Q R S T T U V W X Y ", |
236 | "| Z ` J .....+.@.z #.3 _ 3 3 ) $.P W %.S &.*.*.&.S W Q P =.-. ", | 236 | "| Z ` J .....+.@.z #.3 _ 3 3 ) $.P W %.S &.*.*.&.S W Q P =.-. ", |
237 | ";.>.,.'.).!.!.).~.,.{.) : ) 3 ].h ^./.(._._._.:.<.[.g }.= & |. ", | 237 | ";.>.,.'.).!.!.).~.,.{.) : ) 3 ].h ^./.(._._._.:.<.[.g }.= & |. ", |
238 | ";.>.1.2.3.4.4.5.6.,.{._ : : : 7.8.9.0.a.b.b.c.d.} e.4 = 6 q # ", | 238 | ";.>.1.2.3.4.4.5.6.,.{._ : : : 7.8.9.0.a.b.b.c.d.} e.4 = 6 q # ", |
239 | ";.>.z f.g.h.i.j.k.l.N ) : ! ! 4 m.n.c.o.p.q.r.|.5 { d e e s.. ", | 239 | ";.>.z f.g.h.i.j.k.l.N ) : ! ! 4 m.n.c.o.p.q.r.|.5 { d e e s.. ", |
240 | "t Z l t.f.u.g.1.v.#.w.' : ! ~ ~ 7.|.n.x.y.z.A.A q - e e e B.> ", | 240 | "t Z l t.f.u.g.1.v.#.w.' : ! ~ ~ 7.|.n.x.y.z.A.A q - e e e B.> ", |
241 | "| 0 c k t.t.l l C.D.) * * ! 5 { B o E.F.F.G.= H.e e e e q B.. ", | 241 | "| 0 c k t.t.l l C.D.) * * ! 5 { B o E.F.F.G.= H.e e e e q B.. ", |
242 | "; + D.I.J.I.I.I.w.) : : * o K.7 - L.= O = }.6 6 e q q e q s.> ", | 242 | "; + D.I.J.I.I.I.w.) : : * o K.7 - L.= O = }.6 6 e q q e q s.> ", |
243 | "9 + ) ) ) ) ' ' , * : ! ! ! K.< . M.q 6 B N.{ d q e e e e s.9 ", | 243 | "9 + ) ) ) ) ' ' , * : ! ! ! K.< . M.q 6 B N.{ d q e e e e s.9 ", |
244 | "9 # O.) ) ' , , P.* ! ! ! ! = % . . M.e d p L.d B.B.e B.B.Q.9 ", | 244 | "9 # O.) ) ' , , P.* ! ! ! ! = % . . M.e d p L.d B.B.e B.B.Q.9 ", |
245 | "; < ' ' ' ' , , 4 4 ~ ! ! ~ ! 5 e q e e q A H.d q q e e B.Q.9 ", | 245 | "; < ' ' ' ' , , 4 4 ~ ! ! ~ ! 5 e q e e q A H.d q q e e B.Q.9 ", |
246 | "; $ R.K.5 4 4 ' ! ! 4 ~ ! ~ ~ ~ o { B o A A L.S.B.B.B.B.B.Q.> ", | 246 | "; $ R.K.5 4 4 ' ! ! 4 ~ ! ~ ~ ~ o { B o A A L.S.B.B.B.B.B.Q.> ", |
247 | " ] $ 0 R.= ' ' 4 4 5 4 5 5 o B o B p A A L.d e e B.B.B.Q.9 ", | 247 | " ] $ 0 R.= ' ' 4 4 5 4 5 5 o B o B p A A L.d e e B.B.B.Q.9 ", |
248 | " # + - { 4 4 ~ ! o { o L.p p p p p H.S.B.B.s.Q.Q.M.T. ", | 248 | " # + - { 4 4 ~ ! o { o L.p p p p p H.S.B.B.s.Q.Q.M.T. ", |
249 | " + s.6 B o o 5 B p L.p p L.p H.q B.Q.Q.Q.Q.M.; ", | 249 | " + s.6 B o o 5 B p L.p p L.p H.q B.Q.Q.Q.Q.M.; ", |
250 | " < # s.- B o B p p L.L.H.L.H.d B.Q.Q.Q.Q.Q.9 ", | 250 | " < # s.- B o B p p L.L.H.L.H.d B.Q.Q.Q.Q.Q.9 ", |
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 ) |
263 | { | 267 | { |
264 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | 268 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); |
265 | QVBoxLayout *vbox = new QVBoxLayout ( this, 5, 3 ); | 269 | QVBoxLayout *vbox = new QVBoxLayout ( this, 5, 3 ); |
266 | QHBoxLayout *hbox; | 270 | QHBoxLayout *hbox; |
267 | 271 | ||
268 | hbox = new QHBoxLayout ( vbox ); | 272 | hbox = new QHBoxLayout ( vbox ); |
269 | 273 | ||
270 | QLabel *l = new QLabel ( tr( "Delay" ), this ); | 274 | QLabel *l = new QLabel ( tr( "Delay" ), this ); |
271 | hbox-> addWidget ( l ); | 275 | hbox-> addWidget ( l ); |
272 | 276 | ||
273 | delaySpin = new QSpinBox( 0, 60, 1, this, "Spinner" ); | 277 | delaySpin = new QSpinBox( 0, 60, 1, this, "Spinner" ); |
274 | delaySpin-> setButtonSymbols ( QSpinBox::PlusMinus ); | 278 | delaySpin-> setButtonSymbols ( QSpinBox::PlusMinus ); |
275 | delaySpin-> setSuffix ( tr( "sec" )); | 279 | delaySpin-> setSuffix ( tr( "sec" )); |
276 | delaySpin-> setFocusPolicy( QWidget::NoFocus ); | 280 | delaySpin-> setFocusPolicy( QWidget::NoFocus ); |
277 | delaySpin-> setValue ( 1 ); | 281 | delaySpin-> setValue ( 1 ); |
278 | hbox-> addWidget ( delaySpin ); | 282 | hbox-> addWidget ( delaySpin ); |
279 | 283 | ||
280 | saveNamedCheck = new QCheckBox ( tr( "Save named" ), this); | 284 | saveNamedCheck = new QCheckBox ( tr( "Save named" ), this); |
281 | saveNamedCheck-> setFocusPolicy ( QWidget::NoFocus ); | 285 | saveNamedCheck-> setFocusPolicy ( QWidget::NoFocus ); |
282 | vbox->addWidget( saveNamedCheck); | 286 | vbox->addWidget( saveNamedCheck); |
283 | 287 | ||
284 | vbox-> addSpacing ( 3 ); | 288 | vbox-> addSpacing ( 3 ); |
285 | 289 | ||
286 | l = new QLabel ( tr( "Save screenshot as..." ), this ); | 290 | l = new QLabel ( tr( "Save screenshot as..." ), this ); |
287 | vbox-> addWidget ( l, AlignCenter ); | 291 | vbox-> addWidget ( l, AlignCenter ); |
288 | 292 | ||
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 ); |
301 | 309 | ||
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(); |
314 | 323 | ||
315 | setFileName = FALSE; | 324 | setFileName = FALSE; |
316 | if ( saveNamedCheck->isChecked()) { | 325 | if ( saveNamedCheck->isChecked()) { |
317 | setFileName = TRUE; | 326 | setFileName = TRUE; |
318 | InputDialog *fileDlg; | 327 | InputDialog *fileDlg; |
319 | 328 | ||
320 | fileDlg = new InputDialog( 0 , tr("Name of screenshot "), TRUE, 0); | 329 | fileDlg = new InputDialog( 0 , tr("Name of screenshot "), TRUE, 0); |
321 | fileDlg->exec(); | 330 | fileDlg->exec(); |
322 | fileDlg->raise(); | 331 | fileDlg->raise(); |
323 | QString fileName, list; | 332 | QString fileName, list; |
324 | if ( fileDlg->result() == 1 ) { | 333 | if ( fileDlg->result() == 1 ) { |
325 | fileName = fileDlg->LineEdit1->text(); | 334 | fileName = fileDlg->LineEdit1->text(); |
326 | 335 | ||
327 | if (fileName.find("/", 0, TRUE) == -1) | 336 | if (fileName.find("/", 0, TRUE) == -1) |
328 | FileNamePath = QDir::homeDirPath() + "/Documents/image/png/" + fileName; | 337 | FileNamePath = QDir::homeDirPath() + "/Documents/image/png/" + fileName; |
329 | else | 338 | else |
330 | FileNamePath = fileName; | 339 | FileNamePath = fileName; |
331 | 340 | ||
332 | } | 341 | } |
333 | delete fileDlg; | 342 | delete fileDlg; |
334 | } | 343 | } |
335 | 344 | ||
336 | if ( delaySpin->value() ) | 345 | if ( delaySpin->value() ) |
337 | grabTimer->start( delaySpin->value() * 1000, true ); | 346 | grabTimer->start( delaySpin->value() * 1000, true ); |
338 | else | 347 | else |
339 | show(); | 348 | show(); |
340 | } | 349 | } |
341 | 350 | ||
342 | void ScreenshotControl::slotScap() | 351 | void ScreenshotControl::slotScap() |
343 | { | 352 | { |
344 | buttonPushed = 2; | 353 | buttonPushed = 2; |
345 | hide(); | 354 | hide(); |
346 | 355 | ||
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 | ||
359 | if ( setFileName) { | 377 | if ( setFileName) { |
360 | fileName = FileNamePath; | 378 | fileName = FileNamePath; |
361 | //not sure why this is needed here, but it forgets fileName | 379 | //not sure why this is needed here, but it forgets fileName |
362 | // if this is below the braces | 380 | // if this is below the braces |
363 | 381 | ||
364 | if (fileName.right(3) != "png") | 382 | if (fileName.right(3) != "png") |
365 | fileName = fileName + ".png"; | 383 | fileName = fileName + ".png"; |
366 | lnk.setFile(fileName); //sets File property | 384 | lnk.setFile(fileName); //sets File property |
367 | odebug << "saving file " + fileName << oendl; | 385 | odebug << "saving file " + fileName << oendl; |
368 | snapshot.save( fileName, "PNG"); | 386 | snapshot.save( fileName, "PNG"); |
369 | QFileInfo fi( fileName); | 387 | QFileInfo fi( fileName); |
370 | lnk.setName( fi.fileName()); //sets file name | 388 | lnk.setName( fi.fileName()); //sets file name |
371 | 389 | ||
372 | if (!lnk.writeLink()) | 390 | if (!lnk.writeLink()) |
373 | odebug << "Writing doclink did not work" << oendl; | 391 | odebug << "Writing doclink did not work" << oendl; |
374 | } | 392 | } |
375 | else { | 393 | else { |
376 | 394 | ||
@@ -392,48 +410,53 @@ void ScreenshotControl::savePixmap() | |||
392 | lnk.setFile(fileName); //sets File property | 410 | lnk.setFile(fileName); //sets File property |
393 | odebug << "saving file " + fileName << oendl; | 411 | odebug << "saving file " + fileName << oendl; |
394 | snapshot.save( fileName, "PNG"); | 412 | snapshot.save( fileName, "PNG"); |
395 | QFileInfo fi( fileName); | 413 | QFileInfo fi( fileName); |
396 | lnk.setName( fi.fileName()); //sets file name | 414 | lnk.setName( fi.fileName()); //sets file name |
397 | 415 | ||
398 | if (!lnk.writeLink()) | 416 | if (!lnk.writeLink()) |
399 | odebug << "Writing doclink did not work" << oendl; | 417 | odebug << "Writing doclink did not work" << oendl; |
400 | 418 | ||
401 | } | 419 | } |
402 | 420 | ||
403 | QPEApplication::beep(); | 421 | QPEApplication::beep(); |
404 | } | 422 | } |
405 | 423 | ||
406 | void ScreenshotControl::performGrab() | 424 | void ScreenshotControl::performGrab() |
407 | { | 425 | { |
408 | snapshot = QPixmap::grabWindow( QPEApplication::desktop()->winId(), 0, 0, QApplication::desktop()->width(), QApplication::desktop()->height() ); | 426 | snapshot = QPixmap::grabWindow( QPEApplication::desktop()->winId(), 0, 0, QApplication::desktop()->width(), QApplication::desktop()->height() ); |
409 | 427 | ||
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; |
422 | bool ok = false; | 445 | bool ok = false; |
423 | 446 | ||
424 | QString displayEnv = getenv("QWS_DISPLAY"); | 447 | QString displayEnv = getenv("QWS_DISPLAY"); |
425 | odebug << displayEnv << oendl; | 448 | odebug << displayEnv << oendl; |
426 | 449 | ||
427 | if(( displayEnv.left(2) != ":0" ) && (!displayEnv.isEmpty())) { | 450 | if(( displayEnv.left(2) != ":0" ) && (!displayEnv.isEmpty())) { |
428 | 451 | ||
429 | if (( rhost_info = (struct hostent *) ::gethostbyname ((char *) SCAP_hostname )) != 0 ) { | 452 | if (( rhost_info = (struct hostent *) ::gethostbyname ((char *) SCAP_hostname )) != 0 ) { |
430 | ::memset ( &raddr, 0, sizeof (struct sockaddr_in)); | 453 | ::memset ( &raddr, 0, sizeof (struct sockaddr_in)); |
431 | ::memcpy ( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length ); | 454 | ::memcpy ( &raddr. sin_addr, rhost_info-> h_addr, rhost_info-> h_length ); |
432 | raddr. sin_family = rhost_info-> h_addrtype; | 455 | raddr. sin_family = rhost_info-> h_addrtype; |
433 | raddr. sin_port = htons ( SCAP_port ); | 456 | raddr. sin_port = htons ( SCAP_port ); |
434 | 457 | ||
435 | if (( sock = ::socket ( AF_INET, SOCK_STREAM, 0 )) >= 0 ) { | 458 | if (( sock = ::socket ( AF_INET, SOCK_STREAM, 0 )) >= 0 ) { |
436 | if ( ::connect ( sock, (struct sockaddr *) & raddr, sizeof (struct sockaddr)) >= 0 ) { | 459 | if ( ::connect ( sock, (struct sockaddr *) & raddr, sizeof (struct sockaddr)) >= 0 ) { |
437 | 460 | ||
438 | QString header; | 461 | QString header; |
439 | 462 | ||
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 | |||
@@ -1,71 +1,72 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com | 2 | ** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com |
3 | ** All rights reserved. | 3 | ** All rights reserved. |
4 | ** | 4 | ** |
5 | ** This file may be distributed and/or modified under the terms of the | 5 | ** This file may be distributed and/or modified under the terms of the |
6 | ** GNU General Public License version 2 as published by the Free Software | 6 | ** GNU General Public License version 2 as published by the Free Software |
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | 7 | ** Foundation and appearing in the file LICENSE.GPL included in the |
8 | ** packaging of this file. | 8 | ** packaging of this file. |
9 | ** | 9 | ** |
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
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> |
21 | #include <qframe.h> | 21 | #include <qframe.h> |
22 | #include <qpixmap.h> | 22 | #include <qpixmap.h> |
23 | #include <qguardedptr.h> | 23 | #include <qguardedptr.h> |
24 | #include <qtimer.h> | 24 | #include <qtimer.h> |
25 | 25 | ||
26 | class QComboBox; | 26 | class QComboBox; |
27 | class QCheckBox; | 27 | class QCheckBox; |
28 | class QSpinBox; | 28 | class QSpinBox; |
29 | class QPushButton; | 29 | class QPushButton; |
30 | //class QImage; | 30 | //class QImage; |
31 | 31 | ||
32 | class ScreenshotControl : public QFrame | 32 | class ScreenshotControl : public QFrame |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
36 | ScreenshotControl( QWidget *parent=0, const char *name=0 ); | 36 | ScreenshotControl( QWidget *parent=0, const char *name=0 ); |
37 | 37 | ||
38 | private: | 38 | private: |
39 | QPushButton *grabItButton, *scapButton; | 39 | QPushButton *grabItButton, *scapButton; |
40 | QPixmap snapshot; | 40 | QPixmap snapshot; |
41 | QTimer* grabTimer; | 41 | QTimer* grabTimer; |
42 | QCheckBox *saveNamedCheck; | 42 | QCheckBox *saveNamedCheck; |
43 | QString FileNamePath; | 43 | QString FileNamePath; |
44 | bool setFileName; | 44 | bool setFileName; |
45 | QSpinBox *delaySpin; | 45 | QSpinBox *delaySpin; |
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 | ||
55 | class ScreenshotApplet : public QWidget { | 56 | 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 | ||
69 | 70 | ||
70 | #endif // __SCREENSHOT_APPLET_H__ | 71 | #endif // __SCREENSHOT_APPLET_H__ |
71 | 72 | ||