summaryrefslogtreecommitdiff
path: root/core/applets/screenshotapplet/screenshot.cpp
Unidiff
Diffstat (limited to 'core/applets/screenshotapplet/screenshot.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/screenshotapplet/screenshot.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp
index 5d6bce4..20e1c9b 100644
--- a/core/applets/screenshotapplet/screenshot.cpp
+++ b/core/applets/screenshotapplet/screenshot.cpp
@@ -206,195 +206,195 @@ static char * snapshot_xpm[] = {
206 "F.c #5A525E", 206 "F.c #5A525E",
207 "G.c #425868", 207 "G.c #425868",
208 "H.c #04448E", 208 "H.c #04448E",
209 "I.c #28828A", 209 "I.c #28828A",
210 "J.c #2D8593", 210 "J.c #2D8593",
211 "K.c #12427A", 211 "K.c #12427A",
212 "L.c #054696", 212 "L.c #054696",
213 "M.c #042B5E", 213 "M.c #042B5E",
214 "N.c #134F95", 214 "N.c #134F95",
215 "O.c #1E6ABB", 215 "O.c #1E6ABB",
216 "P.c #1A5E96", 216 "P.c #1A5E96",
217 "Q.c #022E67", 217 "Q.c #022E67",
218 "R.c #0C3E7C", 218 "R.c #0C3E7C",
219 "S.c #023E8A", 219 "S.c #023E8A",
220 "T.c #021A3E", 220 "T.c #021A3E",
221" ", 221" ",
222" ", 222" ",
223" ", 223" ",
224" . + @ # + ", 224" . + @ # + ",
225" $ # % & * * = - # $ ", 225" $ # % & * * = - # $ ",
226"; > % @ = , ' ) ' ! ~ { % @ . ] ^ / ( ", 226"; > % @ = , ' ) ' ! ~ { % @ . ] ^ / ( ",
227"; + ' * ) _ ) ) ' : : ! { { % < . [ ( } ", 227"; + ' * ) _ ) ) ' : : ! { { % < . [ ( } ",
228"| @ 1 2 3 _ _ ) ' : : : : 4 5 6 6 # 7 8 } ", 228"| @ 1 2 3 _ _ ) ' : : : : 4 5 6 6 # 7 8 } ",
229"9 0 a b b b c _ ) : : ! ! ~ ~ 5 ~ d e f [ 8 g h h } ", 229"9 0 a b b b c _ ) : : ! ! ~ ~ 5 ~ d e f [ 8 g h h } ",
230"| i j k j l m n 3 ) : ! ! ! ~ o o o p 6 q f / r r r s ", 230"| i j k j l m n 3 ) : ! ! ! ~ o o o p 6 q f / r r r s ",
231"t u v w x y y z a 1 3 ' : ! ~ A A B A p = C D E F G ( s ", 231"t u v w x y y z a 1 3 ' : ! ~ A A B A p = C D E F G ( s ",
232"| 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 ", 232"| 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 ",
233"| Z ` J .....+.@.z #.3 _ 3 3 ) $.P W %.S &.*.*.&.S W Q P =.-. ", 233"| Z ` J .....+.@.z #.3 _ 3 3 ) $.P W %.S &.*.*.&.S W Q P =.-. ",
234";.>.,.'.).!.!.).~.,.{.) : ) 3 ].h ^./.(._._._.:.<.[.g }.= & |. ", 234";.>.,.'.).!.!.).~.,.{.) : ) 3 ].h ^./.(._._._.:.<.[.g }.= & |. ",
235";.>.1.2.3.4.4.5.6.,.{._ : : : 7.8.9.0.a.b.b.c.d.} e.4 = 6 q # ", 235";.>.1.2.3.4.4.5.6.,.{._ : : : 7.8.9.0.a.b.b.c.d.} e.4 = 6 q # ",
236";.>.z f.g.h.i.j.k.l.N ) : ! ! 4 m.n.c.o.p.q.r.|.5 { d e e s.. ", 236";.>.z f.g.h.i.j.k.l.N ) : ! ! 4 m.n.c.o.p.q.r.|.5 { d e e s.. ",
237"t Z l t.f.u.g.1.v.#.w.' : ! ~ ~ 7.|.n.x.y.z.A.A q - e e e B.> ", 237"t Z l t.f.u.g.1.v.#.w.' : ! ~ ~ 7.|.n.x.y.z.A.A q - e e e B.> ",
238"| 0 c k t.t.l l C.D.) * * ! 5 { B o E.F.F.G.= H.e e e e q B.. ", 238"| 0 c k t.t.l l C.D.) * * ! 5 { B o E.F.F.G.= H.e e e e q B.. ",
239"; + D.I.J.I.I.I.w.) : : * o K.7 - L.= O = }.6 6 e q q e q s.> ", 239"; + D.I.J.I.I.I.w.) : : * o K.7 - L.= O = }.6 6 e q q e q s.> ",
240"9 + ) ) ) ) ' ' , * : ! ! ! K.< . M.q 6 B N.{ d q e e e e s.9 ", 240"9 + ) ) ) ) ' ' , * : ! ! ! K.< . M.q 6 B N.{ d q e e e e s.9 ",
241"9 # O.) ) ' , , P.* ! ! ! ! = % . . M.e d p L.d B.B.e B.B.Q.9 ", 241"9 # O.) ) ' , , P.* ! ! ! ! = % . . M.e d p L.d B.B.e B.B.Q.9 ",
242"; < ' ' ' ' , , 4 4 ~ ! ! ~ ! 5 e q e e q A H.d q q e e B.Q.9 ", 242"; < ' ' ' ' , , 4 4 ~ ! ! ~ ! 5 e q e e q A H.d q q e e B.Q.9 ",
243"; $ R.K.5 4 4 ' ! ! 4 ~ ! ~ ~ ~ o { B o A A L.S.B.B.B.B.B.Q.> ", 243"; $ R.K.5 4 4 ' ! ! 4 ~ ! ~ ~ ~ o { B o A A L.S.B.B.B.B.B.Q.> ",
244" ] $ 0 R.= ' ' 4 4 5 4 5 5 o B o B p A A L.d e e B.B.B.Q.9 ", 244" ] $ 0 R.= ' ' 4 4 5 4 5 5 o B o B p A A L.d e e B.B.B.Q.9 ",
245" # + - { 4 4 ~ ! o { o L.p p p p p H.S.B.B.s.Q.Q.M.T. ", 245" # + - { 4 4 ~ ! o { o L.p p p p p H.S.B.B.s.Q.Q.M.T. ",
246" + s.6 B o o 5 B p L.p p L.p H.q B.Q.Q.Q.Q.M.; ", 246" + s.6 B o o 5 B p L.p p L.p H.q B.Q.Q.Q.Q.M.; ",
247" < # s.- B o B p p L.L.H.L.H.d B.Q.Q.Q.Q.Q.9 ", 247" < # s.- B o B p p L.L.H.L.H.d B.Q.Q.Q.Q.Q.9 ",
248" $ . s.d 6 B A p H.S.L.H.q B.Q.Q.M.M.. ; ", 248" $ . s.d 6 B A p H.S.L.H.q B.Q.Q.M.M.. ; ",
249" ; 9 . 6 L.p L.d L.H.d Q.M.M.. 9 ; ] ", 249" ; 9 . 6 L.p L.d L.H.d Q.M.M.. 9 ; ] ",
250" | > e L.d L.H.e M.. ; ] ] ", 250" | > e L.d L.H.e M.. ; ] ] ",
251" > 9 . S.Q.. ; ] ", 251" > 9 . S.Q.. ; ] ",
252" T.; ] "}; 252" T.; ] "};
253 253
254static const char *SCAP_hostname = "www.handhelds.org"; 254static const char *SCAP_hostname = "www.handhelds.org";
255static const int SCAP_port = 80; 255static const int SCAP_port = 80;
256 256
257 257
258ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name ) 258ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name )
259 : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) 259 : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup )
260{ 260{
261 setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); 261 setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
262 QVBoxLayout *vbox = new QVBoxLayout ( this, 5, 3 ); 262 QVBoxLayout *vbox = new QVBoxLayout ( this, 5, 3 );
263 QHBoxLayout *hbox; 263 QHBoxLayout *hbox;
264 264
265 hbox = new QHBoxLayout ( vbox ); 265 hbox = new QHBoxLayout ( vbox );
266 266
267 QLabel *l = new QLabel ( tr( "Delay" ), this ); 267 QLabel *l = new QLabel ( tr( "Delay" ), this );
268 hbox-> addWidget ( l ); 268 hbox-> addWidget ( l );
269 269
270 delaySpin = new QSpinBox( 0, 60, 1, this, "Spinner" ); 270 delaySpin = new QSpinBox( 0, 60, 1, this, "Spinner" );
271 delaySpin-> setButtonSymbols ( QSpinBox::PlusMinus ); 271 delaySpin-> setButtonSymbols ( QSpinBox::PlusMinus );
272 delaySpin-> setSuffix ( tr( "sec" )); 272 delaySpin-> setSuffix ( tr( "sec" ));
273 delaySpin-> setFocusPolicy( QWidget::NoFocus ); 273 delaySpin-> setFocusPolicy( QWidget::NoFocus );
274 delaySpin-> setValue ( 1 ); 274 delaySpin-> setValue ( 1 );
275 hbox-> addWidget ( delaySpin ); 275 hbox-> addWidget ( delaySpin );
276 276
277 saveNamedCheck = new QCheckBox ( tr( "Save named" ), this); 277 saveNamedCheck = new QCheckBox ( tr( "Save named" ), this);
278 saveNamedCheck-> setFocusPolicy ( QWidget::NoFocus ); 278 saveNamedCheck-> setFocusPolicy ( QWidget::NoFocus );
279 vbox->addWidget( saveNamedCheck); 279 vbox->addWidget( saveNamedCheck);
280 280
281 vbox-> addSpacing ( 3 ); 281 vbox-> addSpacing ( 3 );
282 282
283 l = new QLabel ( tr( "Save screenshot as..." ), this ); 283 l = new QLabel ( tr( "Save screenshot as..." ), this );
284 vbox-> addWidget ( l, AlignCenter ); 284 vbox-> addWidget ( l, AlignCenter );
285 285
286 hbox = new QHBoxLayout ( vbox ); 286 hbox = new QHBoxLayout ( vbox );
287 287
288 grabItButton = new QPushButton( tr( "File" ), this, "GrabButton" ); 288 grabItButton = new QPushButton( tr( "File" ), this, "GrabButton" );
289 grabItButton ->setFocusPolicy( QWidget::TabFocus ); 289 grabItButton ->setFocusPolicy( QWidget::TabFocus );
290 hbox-> addWidget ( grabItButton ); 290 hbox-> addWidget ( grabItButton );
291 291
292 scapButton = new QPushButton( tr( "Scap" ), this, "ScapButton" ); 292 scapButton = new QPushButton( tr( "Scap" ), this, "ScapButton" );
293 scapButton ->setFocusPolicy( QWidget::TabFocus ); 293 scapButton ->setFocusPolicy( QWidget::TabFocus );
294 hbox-> addWidget ( scapButton ); 294 hbox-> addWidget ( scapButton );
295 295
296 setFixedSize ( sizeHint ( )); 296 setFixedSize ( sizeHint ( ));
297 setFocusPolicy ( QWidget::NoFocus ); 297 setFocusPolicy ( QWidget::NoFocus );
298 298
299 299
300 grabTimer = new QTimer ( this, "grab timer"); 300 grabTimer = new QTimer ( this, "grab timer");
301 301
302 connect ( grabTimer, SIGNAL( timeout ( )), this, SLOT( performGrab ( ))); 302 connect ( grabTimer, SIGNAL( timeout()), this, SLOT( performGrab()));
303 connect ( grabItButton, SIGNAL( clicked ( )), SLOT( slotGrab ( ))); 303 connect ( grabItButton, SIGNAL( clicked()), SLOT( slotGrab()));
304 connect ( scapButton, SIGNAL( clicked ( )), SLOT( slotScap ( ))); 304 connect ( scapButton, SIGNAL( clicked()), SLOT( slotScap()));
305} 305}
306 306
307void ScreenshotControl::slotGrab() 307void ScreenshotControl::slotGrab()
308{ 308{
309 buttonPushed = 1; 309 buttonPushed = 1;
310 hide(); 310 hide();
311 311
312 setFileName = FALSE; 312 setFileName = FALSE;
313 if ( saveNamedCheck->isChecked()) { 313 if ( saveNamedCheck->isChecked()) {
314 setFileName = TRUE; 314 setFileName = TRUE;
315 InputDialog *fileDlg; 315 InputDialog *fileDlg;
316 316
317 fileDlg = new InputDialog( 0 , tr("Name of screenshot "), TRUE, 0); 317 fileDlg = new InputDialog( 0 , tr("Name of screenshot "), TRUE, 0);
318 fileDlg->exec(); 318 fileDlg->exec();
319 fileDlg->raise(); 319 fileDlg->raise();
320 QString fileName, list; 320 QString fileName, list;
321 if ( fileDlg->result() == 1 ) { 321 if ( fileDlg->result() == 1 ) {
322 fileName = fileDlg->LineEdit1->text(); 322 fileName = fileDlg->LineEdit1->text();
323 323
324 if (fileName.find("/", 0, TRUE) == -1) 324 if (fileName.find("/", 0, TRUE) == -1)
325 FileNamePath = QDir::homeDirPath() + "/Documents/image/png/" + fileName; 325 FileNamePath = QDir::homeDirPath() + "/Documents/image/png/" + fileName;
326 else 326 else
327 FileNamePath = fileName; 327 FileNamePath = fileName;
328 328
329 } 329 }
330 delete fileDlg; 330 delete fileDlg;
331 } 331 }
332 332
333 if ( delaySpin->value() ) 333 if ( delaySpin->value() )
334 grabTimer->start( delaySpin->value() * 1000, true ); 334 grabTimer->start( delaySpin->value() * 1000, true );
335 else 335 else
336 show(); 336 show();
337} 337}
338 338
339void ScreenshotControl::slotScap() 339void ScreenshotControl::slotScap()
340{ 340{
341 buttonPushed = 2; 341 buttonPushed = 2;
342 hide(); 342 hide();
343 343
344 if ( delaySpin->value() ) 344 if ( delaySpin->value() )
345 grabTimer->start( delaySpin->value() * 1000, true ); 345 grabTimer->start( delaySpin->value() * 1000, true );
346 else 346 else
347 show(); 347 show();
348} 348}
349 349
350 350
351void ScreenshotControl::savePixmap() 351void ScreenshotControl::savePixmap()
352{ 352{
353 DocLnk lnk; 353 DocLnk lnk;
354 QString fileName; 354 QString fileName;
355 355
356 if ( setFileName) { 356 if ( setFileName) {
357 fileName = FileNamePath; 357 fileName = FileNamePath;
358 //not sure why this is needed here, but it forgets fileName 358 //not sure why this is needed here, but it forgets fileName
359 // if this is below the braces 359 // if this is below the braces
360 360
361 if (fileName.right(3) != "png") 361 if (fileName.right(3) != "png")
362 fileName = fileName + ".png"; 362 fileName = fileName + ".png";
363 lnk.setFile(fileName); //sets File property 363 lnk.setFile(fileName); //sets File property
364 qDebug("saving file " + fileName); 364 qDebug("saving file " + fileName);
365 snapshot.save( fileName, "PNG"); 365 snapshot.save( fileName, "PNG");
366 QFileInfo fi( fileName); 366 QFileInfo fi( fileName);
367 lnk.setName( fi.fileName()); //sets file name 367 lnk.setName( fi.fileName()); //sets file name
368 368
369 if (!lnk.writeLink()) 369 if (!lnk.writeLink())
370 qDebug("Writing doclink did not work"); 370 qDebug("Writing doclink did not work");
371 } 371 }
372 else { 372 else {
373 373
374 fileName = "sc_" + QDateTime::currentDateTime().toString(); 374 fileName = "sc_" + QDateTime::currentDateTime().toString();
375 fileName.replace(QRegExp("'"), ""); 375 fileName.replace(QRegExp("'"), "");
376 fileName.replace(QRegExp(" "), "_"); 376 fileName.replace(QRegExp(" "), "_");
377 fileName.replace(QRegExp(":"), "."); 377 fileName.replace(QRegExp(":"), ".");
378 fileName.replace(QRegExp(","), ""); 378 fileName.replace(QRegExp(","), "");
379 QString dirName = QDir::homeDirPath() + "/Documents/image/png/"; 379 QString dirName = QDir::homeDirPath() + "/Documents/image/png/";
380 380
381 if ( !QDir( dirName).exists() ) { 381 if ( !QDir( dirName).exists() ) {
382 qDebug("making dir " + dirName); 382 qDebug("making dir " + dirName);
383 QString msg = "mkdir -p " + dirName; 383 QString msg = "mkdir -p " + dirName;
384 system(msg.latin1()); 384 system(msg.latin1());
385 } 385 }
386 fileName = dirName + fileName; 386 fileName = dirName + fileName;
387 if (fileName.right(3) != "png") 387 if (fileName.right(3) != "png")
388 fileName = fileName + ".png"; 388 fileName = fileName + ".png";
389 lnk.setFile(fileName); //sets File property 389 lnk.setFile(fileName); //sets File property
390 qDebug("saving file " + fileName); 390 qDebug("saving file " + fileName);
391 snapshot.save( fileName, "PNG"); 391 snapshot.save( fileName, "PNG");
392 QFileInfo fi( fileName); 392 QFileInfo fi( fileName);
393 lnk.setName( fi.fileName()); //sets file name 393 lnk.setName( fi.fileName()); //sets file name
394 394
395 if (!lnk.writeLink()) 395 if (!lnk.writeLink())
396 qDebug("Writing doclink did not work"); 396 qDebug("Writing doclink did not work");
397 397
398 } 398 }
399 399
400 QPEApplication::beep(); 400 QPEApplication::beep();