|
|
|
@ -6,6 +6,7 @@
|
|
|
|
|
* (c) Aaron J. Seigo 2002
|
|
|
|
|
* (c) Nadeem Hasan 2003
|
|
|
|
|
* (c) Bernd Brandstetter 2004
|
|
|
|
|
* (c) Emanoil Kotsev 2023
|
|
|
|
|
*
|
|
|
|
|
* Released under the LGPL see file LICENSE for details.
|
|
|
|
|
*/
|
|
|
|
@ -41,6 +42,8 @@
|
|
|
|
|
#include <tqpainter.h>
|
|
|
|
|
#include <tqpaintdevicemetrics.h>
|
|
|
|
|
#include <tqwhatsthis.h>
|
|
|
|
|
#include <tqbuffer.h>
|
|
|
|
|
#include <tqprocess.h>
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
@ -58,6 +61,8 @@
|
|
|
|
|
|
|
|
|
|
#define kApp TDEApplication::kApplication()
|
|
|
|
|
|
|
|
|
|
#define KOLOURPAINT_EXE "/opt/trinity/bin/kolourpaint"
|
|
|
|
|
|
|
|
|
|
KSnapshot::KSnapshot(TQWidget *parent, const char *name, bool grabCurrent)
|
|
|
|
|
: DCOPObject("interface"),
|
|
|
|
|
KDialogBase(parent, name, true, TQString(), Help|User1, User1,
|
|
|
|
@ -78,6 +83,7 @@ KSnapshot::KSnapshot(TQWidget *parent, const char *name, bool grabCurrent)
|
|
|
|
|
connect( mainWidget, TQT_SIGNAL( saveClicked() ), TQT_SLOT( slotSaveAs() ) );
|
|
|
|
|
connect( mainWidget, TQT_SIGNAL( printClicked() ), TQT_SLOT( slotPrint() ) );
|
|
|
|
|
connect( mainWidget, TQT_SIGNAL( copyClicked() ), TQT_SLOT( slotCopy() ) );
|
|
|
|
|
connect( mainWidget, TQT_SIGNAL( openKolourPaint() ), TQT_SLOT( slotOpenKolourPaint() ) );
|
|
|
|
|
|
|
|
|
|
grabber->show();
|
|
|
|
|
grabber->grabMouse( waitCursor );
|
|
|
|
@ -359,6 +365,33 @@ void KSnapshot::slotWindowGrabbed( const TQPixmap &pix )
|
|
|
|
|
show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KSnapshot::slotOpenKolourPaint()
|
|
|
|
|
{
|
|
|
|
|
slotCopy();
|
|
|
|
|
|
|
|
|
|
TQFileInfo kolourPaintExeFile( KOLOURPAINT_EXE );
|
|
|
|
|
if (!kolourPaintExeFile.exists())
|
|
|
|
|
{
|
|
|
|
|
tqWarning( "koulourpaint executable was not found\nMake sure the executable is in the default location");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TQProcess *kolourPaintExe = new TQProcess(kolourPaintExeFile.filePath(), this);
|
|
|
|
|
|
|
|
|
|
TQImage img = snapshot.convertToImage();
|
|
|
|
|
tqApp->processEvents();
|
|
|
|
|
|
|
|
|
|
if (!kolourPaintExe->isRunning())
|
|
|
|
|
{
|
|
|
|
|
TQByteArray ba;
|
|
|
|
|
TQBuffer buffer( ba );
|
|
|
|
|
buffer.open( IO_WriteOnly );
|
|
|
|
|
img.save( &buffer, "PNG" ); // writes image into ba in PNG format
|
|
|
|
|
|
|
|
|
|
if (!kolourPaintExe->launch(ba))
|
|
|
|
|
tqWarning( "koulourpaint executable was not able to start");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void KSnapshot::closeEvent( TQCloseEvent * e )
|
|
|
|
|
{
|
|
|
|
|
TDEConfig *conf=TDEGlobal::config();
|
|
|
|
|