309
>Similarly, to take a snapshot of a region, select the <guilabel
311
> combo box entry and set the <guilabel
312
>Snapshot delay</guilabel
315
>, and then click on the <guibutton
316
>New Snapshot</guibutton
317
> button. The mouse cursor will then change into a cross, and you can then use the mouse to select the region you want to capture. </para>
305
>Da mesma forma, para capturar uma região, selecione a opção <guilabel
307
> e defina o <guilabel
308
>Atraso na captura</guilabel
310
>Sem atraso</guilabel
311
>, e então, clique no botão <guibutton
312
>Nova captura de tela</guibutton
313
>. O ponteiro do mouse será alterado para uma cruz e pode ser usado para selecionar a região que deseja capturar. Para realizar uma captura pressione a tecla &Enter; ou pressione &Esc; para sair.</para>
320
316
>Para obter uma nova captura de seção da janela, selecione a opção <guilabel
336
336
>Atraso na captura de tela</title>
340
>Snapshot Delay</guilabel
341
> box allows you to enter an arbitrary time delay, in seconds, between the time that you press the <guibutton
342
>New Snapshot</guibutton
343
> button and the time that the snapshot is taken.</para>
340
>Atraso na captura</guilabel
341
> permite-lhe informar um tempo de espera, em segundos, entre o momento em que pressiona o botão <guibutton
342
>Nova captura de tela</guibutton
343
> e o momento em que a imagem é capturada.</para>
346
346
>Quando um tempo de espera é definido, você não precisa clicar o mouse para capturar a imagem. Isto permite-lhe abrir um menu e capturar uma imagem dele.</para>
433
433
>Interface &DBus;</title>
436
>O &ksnapshot; poderá ser programado a partir da sua interface &DBus;.</para>
439
>Existem duas formas de usar a interface de &DBus;: a &GUI; do &Qt; <application
440
>qdbusviewer</application
441
> e o utilitário da linha de comando <application
446
>Exemplos: <itemizedlist mark='opencircle'>
454
> irá mostrar todos os serviços disponíveis. </para
464
>org.kde.ksnapshot-`pidof -s ksnapshot`</option
465
> irá mostrar a interface &DBus; do &ksnapshot;. </para
475
>org.kde.ksnapshot-`pidof -s ksnapshot` /KSnapshot</option
476
> irá mostrar os métodos que controlam o &ksnapshot;. </para
483
>Para mais informações, vá por favor ao <ulink url="http://techbase.kde.org/Development/Tutorials/D-Bus/Introduction"
484
>tutorial sobre &DBus;</ulink
435
488
kdedev@rebutia:~/svn$ qdbus org.kde.ksnapshot-10484
477
530
method void org.freedesktop.DBus.Properties.Set(QString interface_name, QString property_name, QDBusVariant value)
478
531
method QString org.freedesktop.DBus.Introspectable.Introspect()
481
>&ksnapshot; can be scripted using its &DBus; interface. This chapter explains the various &DBus; calls that you can use, and provides some examples of how you can use them.</para>
484
>As with all &DBus; calls, you need to specify the application you want to interface with, and the particular interface. With &ksnapshot; you need to identify which particular application, which is <literal
486
> followed by the process number.</para>
487
533
<!-- dbus-launch ksnapshot-->
488
534
<!-- ksnapshot qdbus org.kde.ksnapshot-20985-->
490
>To start &ksnapshot; and obtain the right argument, use <command
537
>To start &ksnapshot; and obtain the right argument, use
491
539
>dcopstart ksnapshot</command
492
>, which returns the argument (such as <computeroutput
541
argument (such as <computeroutput
493
542
>ksnapshot-20594</computeroutput
494
>) on standard output.</para>
544
standard output.</para>
497
>You can get a list of the available &DCOP; interfaces, use the right arguments, as shown in this example: <screen width="60"
501
>dcop `dcopstart ksnapshot` interface</command
547
>You can get a list of the available &DCOP; interfaces, use
548
the right arguments, as shown in this example:
551
<prompt>$</prompt> <command>dcop `dcopstart ksnapshot` interface</command><computeroutput>
503
552
QCStringList interfaces()
504
553
QCStringList functions()
532
582
>&DCOP; Access to Settings</title>
535
>For each of the settings that you can control with the &GUI;, you can both obtain the current status of that setting, and modify the setting, using &DCOP;. </para>
585
>For each of the settings that you can control with the
586
&GUI;, you can both obtain the current status of that setting,
587
and modify the setting, using &DCOP;.
538
>You can obtain the current capture mode using <literal
591
>You can obtain the current capture mode using
539
593
>grabMode</literal
540
>, as shown below: <screen width="60">
544
>dcop ksnapshot-23151 interface grabMode</command>
546
> This will return <computeroutput
597
<prompt>$</prompt> <command>dcop ksnapshot-23151 interface grabMode</command>
599
This will return <computeroutput
547
600
>0</computeroutput
548
> for full-screen capture, <computeroutput
601
> for full-screen capture,
549
603
>1</computeroutput
550
604
> for window capture, and <computeroutput
552
> for region capture. </para>
555
610
>You can set the capture mode using <literal
556
611
>setGrabMode</literal
557
>, which requires an argument to identify the mode required (as for <literal
613
which requires an argument to identify the mode required (as for <literal
558
614
>grabMode</literal
559
>). So you can set window capture mode (<command
616
So you can set window capture mode (<command
561
>), using: <screen width="60"
565
>dcop ksnapshot-23151 interface setGrabMode 1</command
621
<prompt>$</prompt> <command>dcop ksnapshot-23151 interface setGrabMode 1</command>
571
626
>You can obtain the current timeout setting (the <guilabel
572
>Snapshot delay:</guilabel
573
> &GUI; item) using <literal
627
>Snapshot delay:</guilabel>
628
&GUI; item) using <literal
574
629
>timeout</literal
575
>, as shown below: <screen width="60">
579
>dcop ksnapshot-23151 interface timeout</command>
581
> This will return the timeout setting in seconds, or zero if there is no delay (capture on click). </para>
633
<prompt>$</prompt> <command>dcop ksnapshot-23151 interface timeout</command>
635
This will return the timeout setting in seconds, or zero if there is no delay
584
640
>You can set the timeout using <literal
585
641
>setTime</literal
586
>, which requires an argument to identify the timeout duration. So you can set a delay of 4 seconds using: <screen width="60"
590
>dcop ksnapshot-23151 interface setTime 4</command
643
which requires an argument to identify the timeout duration. So you can
644
set a delay of 4 seconds using:
647
<prompt>$</prompt> <command>dcop ksnapshot-23151 interface setTime 4</command>
596
>You can obtain the path that the snapshot will be saved to using <literal
652
>You can obtain the path that the snapshot will be saved to using
598
>, as shown below: <screen width="60">
602
>dcop ksnapshot-23151 interface url</command>
604
> This will return the filename, as a &URL; (eg as <computeroutput
658
<prompt>$</prompt><command>dcop ksnapshot-23151 interface url</command>
660
This will return the filename, as a &URL; (eg as
605
662
>file:///home/bradh/test2.png</computeroutput
609
667
>You can set the path using <literal
611
>, which requires a string argument to identify the new path. So you can set the path to <literal
612
>file:///home/bradh/snapshot.jpg</literal
613
> using: <screen width="60"
617
>dcop ksnapshot-23151 interface setURL file:///home/bradh/snapshot.jpg</command
670
which requires a string argument to identify the new path. So you can
671
set the path to <literal
672
>file:///home/bradh/snapshot.jpg</literal>
676
<prompt>$</prompt> <command>dcop ksnapshot-23151 interface setURL file:///home/bradh/snapshot.jpg</command>
626
684
>Taking Screenshots with &DCOP;</title>
629
>The key to taking screenshots with &DCOP; is use of <literal
687
The key to taking screenshots with &DCOP; is use of <literal
630
688
>slotGrab</literal
631
>, as shown below: <screen width="60"
635
>dcop ksnapshot-23151 interface slotGrab</command
693
<prompt>$</prompt> <command>dcop ksnapshot-23151 interface slotGrab</command>
641
>This will take a snapshot using the current snapshot mode and timeout settings (as described above). If you want to save the snapshot image, there are a number of calls you can use. If you just want to save the image to the current path (as returned by <literal
698
This will take a snapshot using the current snapshot mode and timeout settings
699
(as described above). If you want to save the snapshot image, there are a
700
number of calls you can use. If you just want to save the image to the current
701
path (as returned by <literal
643
> or changed by <literal
645
706
>), you can use <literal
646
707
>slotSave</literal
647
>, as shown below: <screen width="60"
651
>dcop ksnapshot-23151 interface slotSave</command
712
<prompt>$</prompt> <command>dcop ksnapshot-23151 interface slotSave</command>
657
>If you want the user to be able to specify a filename (and path), you can use <literal
717
If you want the user to be able to specify a filename (and path), you can use
658
719
>slotSaveAs</literal
659
>, which will bring up a standard &kde; file save dialog.</para>
720
>, which will bring up a standard &kde; file
662
>If you want to save the image to a different name (or path) without changing the path with <literal
724
If you want to save the image to a different name (or path) without
725
changing the path with <literal
664
>, you can use <literal
666
>, providing the &URL; to save to as an argument. So if you want to save the snapshot to <filename
730
>, providing the &URL; to save to as an argument. So if you
731
want to save the snapshot to <filename
667
732
>file:///tmp/tempshot.png</filename
668
>, you can do the following: <screen width="60">
672
>dcop ksnapshot-23151 interface save file:///tmp/tempshot.png</command>
674
> Note that this will return true if the snapshot was successfully saved, and false otherwise. Also, you should be aware that if the file already exists, the user will get a standard &kde; dialog that requires the user to decide whether to overwrite or not. </para>
734
can do the following:
737
<prompt>$</prompt> <command>dcop ksnapshot-23151 interface save file:///tmp/tempshot.png</command>
739
Note that this will return true if the snapshot was successfully saved, and false
740
otherwise. Also, you should be aware that if the file already exists, the user
741
will get a standard &kde; dialog that requires the user to decide whether to overwrite
677
>In addition to saving the snapshot, you can also copy it to the clipboard, using <literal
746
In addition to saving the snapshot, you can also copy it to the clipboard, using
678
748
>slotCopy</literal
679
>, as shown below: <screen width="60"
683
>dcop ksnapshot-23151 interface slotCopy</command
752
<prompt>$</prompt> <command>dcop ksnapshot-23151 interface slotCopy</command>
689
>If you need to select a window that may not be under the mouse cursor, you can use <literal
757
If you need to select a window that may not be under the mouse cursor, you
690
759
>slotMovePointer</literal
691
>, passing the x position (in screen pixels) and the y position (also in screen pixels) as arguments. So to move the mouse to the top left hand corner of the screen (0,0), you can do the following: <screen width="60"
695
>dcop ksnapshot-23151 interface slotMoveMouse 0 0</command
760
>, passing the x position
761
(in screen pixels) and the y position (also in screen pixels) as arguments.
762
So to move the mouse to the top left hand corner of the screen (0,0), you
763
can do the following:
766
<prompt>$</prompt> <command>dcop ksnapshot-23151 interface slotMoveMouse 0 0</command>