summaryrefslogtreecommitdiffstats
path: root/ksnapshot
diff options
context:
space:
mode:
Diffstat (limited to 'ksnapshot')
-rw-r--r--ksnapshot/ksnapshot.cpp85
-rw-r--r--ksnapshot/ksnapshot.h9
-rw-r--r--ksnapshot/ksnapshotiface.h5
-rw-r--r--ksnapshot/ksnapshotwidget.ui8
-rw-r--r--ksnapshot/ksnapshotwidget.ui.h6
-rw-r--r--ksnapshot/regiongrabber.cpp8
-rw-r--r--ksnapshot/regiongrabber.h2
-rw-r--r--ksnapshot/windowgrabber.cpp4
-rw-r--r--ksnapshot/windowgrabber.h2
9 files changed, 68 insertions, 61 deletions
diff --git a/ksnapshot/ksnapshot.cpp b/ksnapshot/ksnapshot.cpp
index d1343d9f..c0ebc1be 100644
--- a/ksnapshot/ksnapshot.cpp
+++ b/ksnapshot/ksnapshot.cpp
@@ -37,7 +37,7 @@
#include <kpushbutton.h>
#include <tdestartupinfo.h>
#include <kiconloader.h>
-#include <kprocess.h>
+#include <tdeprocess.h>
#include <krun.h>
#include <tqcursor.h>
@@ -60,8 +60,6 @@
#include <tdeglobal.h>
-#define kApp TDEApplication::kApplication()
-
KSnapshot::KSnapshot(TQWidget *parent, const char *name, bool grabCurrent)
: DCOPObject("interface"),
KDialogBase(parent, name, true, TQString(), Help|User1, User1,
@@ -76,13 +74,13 @@ KSnapshot::KSnapshot(TQWidget *parent, const char *name, bool grabCurrent)
TQVBox *vbox = makeVBoxMainWidget();
mainWidget = new KSnapshotWidget( vbox, "mainWidget" );
- connect(mainWidget, TQT_SIGNAL(startImageDrag()), TQT_SLOT(slotDragSnapshot()));
- connect(mainWidget, TQT_SIGNAL(newClicked()), TQT_SLOT(slotGrab()));
- 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(openWithKPClicked()), TQT_SLOT(slotOpenWithKP()));
- connect(tqApp, TQT_SIGNAL(aboutToQuit()), TQT_SLOT(slotAboutToQuit()));
+ connect(mainWidget, TQ_SIGNAL(startImageDrag()), TQ_SLOT(slotDragSnapshot()));
+ connect(mainWidget, TQ_SIGNAL(newClicked()), TQ_SLOT(slotGrab()));
+ connect(mainWidget, TQ_SIGNAL(saveClicked()), TQ_SLOT(slotSaveAs()));
+ connect(mainWidget, TQ_SIGNAL(printClicked()), TQ_SLOT(slotPrint()));
+ connect(mainWidget, TQ_SIGNAL(copyClicked()), TQ_SLOT(slotCopy()));
+ connect(mainWidget, TQ_SIGNAL(openWithKPClicked()), TQ_SLOT(slotOpenWithKP()));
+ connect(tqApp, TQ_SIGNAL(aboutToQuit()), TQ_SLOT(slotAboutToQuit()));
grabber->show();
grabber->grabMouse( waitCursor );
@@ -111,9 +109,9 @@ KSnapshot::KSnapshot(TQWidget *parent, const char *name, bool grabCurrent)
autoincFilename();
}
- connect( &grabTimer, TQT_SIGNAL( timeout() ), TQT_TQOBJECT(this), TQT_SLOT( grabTimerDone() ) );
- connect( &updateTimer, TQT_SIGNAL( timeout() ), TQT_TQOBJECT(this), TQT_SLOT( updatePreview() ) );
- TQTimer::singleShot( 0, TQT_TQOBJECT(this), TQT_SLOT( updateCaption() ) );
+ connect( &grabTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( grabTimerDone() ) );
+ connect( &updateTimer, TQ_SIGNAL( timeout() ), this, TQ_SLOT( updatePreview() ) );
+ TQTimer::singleShot( 0, this, TQ_SLOT( updateCaption() ) );
KHelpMenu *helpMenu = new KHelpMenu(this, TDEGlobal::instance()->aboutData(), false);
@@ -130,7 +128,7 @@ KSnapshot::KSnapshot(TQWidget *parent, const char *name, bool grabCurrent)
++i; // we need menu ids to match with OfferList indexes
}
mainWidget->btnOpenWith->setPopup(popupOpenWith);
- connect(popupOpenWith, SIGNAL(activated(int)), this, SLOT(slotOpenWith(int)));
+ connect(popupOpenWith, TQ_SIGNAL(activated(int)), this, TQ_SLOT(slotOpenWith(int)));
// Check for KolourPaint availability
KService::Ptr kpaint = KService::serviceByDesktopName("kolourpaint");
@@ -139,27 +137,27 @@ KSnapshot::KSnapshot(TQWidget *parent, const char *name, bool grabCurrent)
}
TDEAccel* accel = new TDEAccel(this);
- accel->insert(TDEStdAccel::Quit, TQT_TQOBJECT(kapp), TQT_SLOT(quit()));
+ accel->insert(TDEStdAccel::Quit, tdeApp, TQ_SLOT(quit()));
accel->insert( "QuickSave", i18n("Quick Save Snapshot &As..."),
i18n("Save the snapshot to the file specified by the user without showing the file dialog."),
- CTRL+SHIFT+Key_S, TQT_TQOBJECT(this), TQT_SLOT(slotSave()));
- accel->insert(TDEStdAccel::Save, TQT_TQOBJECT(this), TQT_SLOT(slotSaveAs()));
-// accel->insert(TDEShortcut(CTRL+Key_A), TQT_TQOBJECT(this), TQT_SLOT(slotSaveAs()));
+ CTRL+SHIFT+Key_S, this, TQ_SLOT(slotSave()));
+ accel->insert(TDEStdAccel::Save, this, TQ_SLOT(slotSaveAs()));
+// accel->insert(TDEShortcut(CTRL+Key_A), this, TQ_SLOT(slotSaveAs()));
accel->insert( "SaveAs", i18n("Save Snapshot &As..."),
i18n("Save the snapshot to the file specified by the user."),
- CTRL+Key_A, TQT_TQOBJECT(this), TQT_SLOT(slotSaveAs()));
- accel->insert(TDEStdAccel::Print, TQT_TQOBJECT(this), TQT_SLOT(slotPrint()));
- accel->insert(TDEStdAccel::New, TQT_TQOBJECT(this), TQT_SLOT(slotGrab()));
- accel->insert(TDEStdAccel::Copy, TQT_TQOBJECT(this), TQT_SLOT(slotCopy()));
+ CTRL+Key_A, this, TQ_SLOT(slotSaveAs()));
+ accel->insert(TDEStdAccel::Print, this, TQ_SLOT(slotPrint()));
+ accel->insert(TDEStdAccel::New, this, TQ_SLOT(slotGrab()));
+ accel->insert(TDEStdAccel::Copy, this, TQ_SLOT(slotCopy()));
- accel->insert( "Quit2", Key_Q, TQT_TQOBJECT(this), TQT_SLOT(slotSave()));
- accel->insert( "Save2", Key_S, TQT_TQOBJECT(this), TQT_SLOT(slotSaveAs()));
- accel->insert( "Print2", Key_P, TQT_TQOBJECT(this), TQT_SLOT(slotPrint()));
- accel->insert( "New2", Key_N, TQT_TQOBJECT(this), TQT_SLOT(slotGrab()));
- accel->insert( "New3", Key_Space, TQT_TQOBJECT(this), TQT_SLOT(slotGrab()));
+ accel->insert( "Quit2", Key_Q, this, TQ_SLOT(slotSave()));
+ accel->insert( "Save2", Key_S, this, TQ_SLOT(slotSaveAs()));
+ accel->insert( "Print2", Key_P, this, TQ_SLOT(slotPrint()));
+ accel->insert( "New2", Key_N, this, TQ_SLOT(slotGrab()));
+ accel->insert( "New3", Key_Space, this, TQ_SLOT(slotGrab()));
setEscapeButton( User1 );
- connect( this, TQT_SIGNAL( user1Clicked() ), TQT_SLOT( reject() ) );
+ connect( this, TQ_SIGNAL( user1Clicked() ), TQ_SLOT( reject() ) );
mainWidget->btnNew->setFocus();
@@ -282,13 +280,13 @@ void KSnapshot::slotGrab()
oldWinPos = pos();
hide();
- if ( mainWidget->delay() && mainWidget->mode() != Region )
+ if ( mainWidget->delay() )
grabTimer.start( mainWidget->delay() * 1000, true );
else {
if ( mainWidget->mode() == Region ) {
rgnGrab = new RegionGrabber();
- connect( rgnGrab, TQT_SIGNAL( regionGrabbed( const TQPixmap & ) ),
- TQT_SLOT( slotRegionGrabbed( const TQPixmap & ) ) );
+ connect( rgnGrab, TQ_SIGNAL( regionGrabbed( const TQPixmap & ) ),
+ TQ_SLOT( slotRegionGrabbed( const TQPixmap & ) ) );
}
else {
grabber->show();
@@ -338,7 +336,7 @@ void KSnapshot::slotPrint()
neww = newh/h*w;
}
- img = img.smoothScale( int(neww), int(newh), TQ_ScaleMin );
+ img = img.smoothScale( int(neww), int(newh), TQImage::ScaleMin );
tqApp->processEvents();
int x = (metrics.width()-img.width())/2;
@@ -425,8 +423,8 @@ void KSnapshot::openWithExternalApp(const KService &service) {
TDEProcess *externalApp = new TDEProcess;
*externalApp << args;
- connect(externalApp, SIGNAL(processExited(TDEProcess*)),
- this, SLOT(slotExternalAppClosed(TDEProcess*)));
+ connect(externalApp, TQ_SIGNAL(processExited(TDEProcess*)),
+ this, TQ_SLOT(slotExternalAppClosed(TDEProcess*)));
if (!externalApp->start(TDEProcess::OwnGroup)) {
KMessageBox::error(this, i18n("Cannot start %1!").arg(service.name()));
@@ -479,11 +477,11 @@ void KSnapshot::closeEvent( TQCloseEvent * e )
bool KSnapshot::eventFilter( TQObject* o, TQEvent* e)
{
- if ( TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(grabber) && e->type() == TQEvent::MouseButtonPress ) {
+ if ( o == grabber && e->type() == TQEvent::MouseButtonPress ) {
TQMouseEvent* me = (TQMouseEvent*) e;
if ( TQWidget::mouseGrabber() != grabber )
return false;
- if ( me->button() == Qt::LeftButton )
+ if ( me->button() == TQt::LeftButton )
performGrab();
}
return false;
@@ -535,8 +533,8 @@ void KSnapshot::grabTimerDone()
{
if ( mainWidget->mode() == Region ) {
rgnGrab = new RegionGrabber();
- connect( rgnGrab, TQT_SIGNAL( regionGrabbed( const TQPixmap & ) ),
- TQT_SLOT( slotRegionGrabbed( const TQPixmap & ) ) );
+ connect( rgnGrab, TQ_SIGNAL( regionGrabbed( const TQPixmap & ) ),
+ TQ_SLOT( slotRegionGrabbed( const TQPixmap & ) ) );
}
else {
performGrab();
@@ -551,8 +549,8 @@ void KSnapshot::performGrab()
grabTimer.stop();
if ( mainWidget->mode() == ChildWindow ) {
WindowGrabber wndGrab;
- connect( &wndGrab, TQT_SIGNAL( windowGrabbed( const TQPixmap & ) ),
- TQT_SLOT( slotWindowGrabbed( const TQPixmap & ) ) );
+ connect( &wndGrab, TQ_SIGNAL( windowGrabbed( const TQPixmap & ) ),
+ TQ_SLOT( slotWindowGrabbed( const TQPixmap & ) ) );
wndGrab.exec();
}
else if ( mainWidget->mode() == WindowUnderCursor ) {
@@ -589,6 +587,11 @@ void KSnapshot::setURL( const TQString &url )
updateCaption();
}
+void KSnapshot::setPixmap(const TQPixmap &newImage) {
+ snapshot = newImage;
+ updatePreview();
+}
+
void KSnapshot::setGrabMode( int m )
{
mainWidget->setMode( m );
@@ -601,7 +604,7 @@ int KSnapshot::grabMode()
void KSnapshot::updateCaption()
{
- setCaption( kApp->makeStdCaption( filename.fileName(), true, modified ) );
+ setCaption( tdeApp->makeStdCaption( filename.fileName(), true, modified ) );
}
void KSnapshot::slotMovePointer(int x, int y)
diff --git a/ksnapshot/ksnapshot.h b/ksnapshot/ksnapshot.h
index fb8084bd..47cbe47e 100644
--- a/ksnapshot/ksnapshot.h
+++ b/ksnapshot/ksnapshot.h
@@ -24,7 +24,7 @@ class TDEProcess;
class KSnapshotPreview : public TQLabel
{
- Q_OBJECT
+ TQ_OBJECT
public:
KSnapshotPreview(TQWidget *parent, const char *name = 0)
@@ -45,14 +45,14 @@ class KSnapshotPreview : public TQLabel
{
TQPainter p(&mask);
- style().tqdrawPrimitive(TQStyle::PE_SizeGrip, &p, TQRect(0, 0, 15, 15), palette().active());
+ style().drawPrimitive(TQStyle::PE_SizeGrip, &p, TQRect(0, 0, 15, 15), palette().active());
p.end();
handle.setMask(mask);
}
{
TQPainter p(&handle);
- style().tqdrawPrimitive(TQStyle::PE_SizeGrip, &p, TQRect(0, 0, 15, 15), palette().active());
+ style().drawPrimitive(TQStyle::PE_SizeGrip, &p, TQRect(0, 0, 15, 15), palette().active());
p.end();
}
@@ -92,7 +92,7 @@ class KSnapshotPreview : public TQLabel
class KSnapshot : public KDialogBase, virtual public KSnapshotIface
{
- Q_OBJECT
+ TQ_OBJECT
public:
KSnapshot(TQWidget *parent= 0, const char *name= 0, bool grabCurrent=false);
@@ -118,6 +118,7 @@ protected slots:
void setTime(int newTime);
void setURL(const TQString &newURL);
void setGrabMode( int m );
+ void setPixmap(const TQPixmap &newImage);
void exit();
protected:
diff --git a/ksnapshot/ksnapshotiface.h b/ksnapshot/ksnapshotiface.h
index 5136b0ba..e8ac5158 100644
--- a/ksnapshot/ksnapshotiface.h
+++ b/ksnapshot/ksnapshotiface.h
@@ -12,6 +12,7 @@
#define __KS_IFACE_H
#include <dcopobject.h>
+#include <tqpixmap.h>
class KSnapshotIface : virtual public DCOPObject
{
@@ -60,6 +61,10 @@ class KSnapshotIface : virtual public DCOPObject
/** Exit KSnapshot **/
virtual void exit() = 0;
+
+ /** Set image, for applications which want to make use of KSnapshot's UI
+ and interface with their own images */
+ virtual void setPixmap(const TQPixmap &newImage) = 0;
};
#endif
diff --git a/ksnapshot/ksnapshotwidget.ui b/ksnapshot/ksnapshotwidget.ui
index d0f815c3..71385f90 100644
--- a/ksnapshot/ksnapshotwidget.ui
+++ b/ksnapshot/ksnapshotwidget.ui
@@ -357,15 +357,15 @@ If &lt;i&gt;no delay&lt;/i&gt; is set, the program will wait for a mouse click b
<include location="global" impldecl="in implementation">tdeglobalsettings.h</include>
<include location="local" impldecl="in implementation">ksnapshotwidget.ui.h</include>
</includes>
-<Q_SIGNALS>
+<signals>
<signal>newClicked()</signal>
<signal>saveClicked()</signal>
<signal>copyClicked()</signal>
<signal>printClicked()</signal>
<signal>openWithKPClicked()</signal>
<signal>startImageDrag()</signal>
-</Q_SIGNALS>
-<Q_SLOTS>
+</signals>
+<slots>
<slot access="protected" specifier="non virtual">slotModeChanged( int mode )</slot>
<slot access="protected" specifier="non virtual">slotNewClicked()</slot>
<slot access="protected" specifier="non virtual">slotSaveClicked()</slot>
@@ -375,7 +375,7 @@ If &lt;i&gt;no delay&lt;/i&gt; is set, the program will wait for a mouse click b
<slot access="protected" specifier="non virtual">slotOpenWithKPClicked()</slot>
<slot specifier="non virtual" returnType="int">previewWidth()</slot>
<slot specifier="non virtual" returnType="int">previewHeight()</slot>
-</Q_SLOTS>
+</slots>
<functions>
<function specifier="non virtual">setPreview( const TQPixmap &amp; pm )</function>
<function specifier="non virtual">setDelay( int i )</function>
diff --git a/ksnapshot/ksnapshotwidget.ui.h b/ksnapshot/ksnapshotwidget.ui.h
index 55a3c6bb..c84f65ca 100644
--- a/ksnapshot/ksnapshotwidget.ui.h
+++ b/ksnapshot/ksnapshotwidget.ui.h
@@ -27,8 +27,6 @@ void KSnapshotWidget::slotModeChanged( int mode )
default:
break;
}
-
- spinDelay->setEnabled(mode != 2);
}
@@ -39,10 +37,10 @@ void KSnapshotWidget::setPreview( const TQPixmap &pm )
if ( r1 * previewWidth() < previewHeight() )
img = img.smoothScale( previewWidth(),
int( previewWidth() * r1 ),
- TQ_ScaleMin );
+ TQImage::ScaleMin );
else
img = img.smoothScale( ( int ) ( ( ( double )previewHeight() ) / r1 ),
- previewHeight(), TQ_ScaleMin );
+ previewHeight(), TQImage::ScaleMin );
TQToolTip::remove( lblImage );
TQToolTip::add( lblImage,
diff --git a/ksnapshot/regiongrabber.cpp b/ksnapshot/regiongrabber.cpp
index 2c4d4a2b..a562fdcc 100644
--- a/ksnapshot/regiongrabber.cpp
+++ b/ksnapshot/regiongrabber.cpp
@@ -74,9 +74,9 @@ RegionGrabber::RegionGrabber()
sizeTip = new SizeTip( ( TQWidget * )0L );
tipTimer = new TQTimer( this );
- connect( tipTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( updateSizeTip() ) );
+ connect( tipTimer, TQ_SIGNAL( timeout() ), TQ_SLOT( updateSizeTip() ) );
- TQTimer::singleShot( 200, this, TQT_SLOT( initGrabber() ) );
+ TQTimer::singleShot( 200, this, TQ_SLOT( initGrabber() ) );
}
RegionGrabber::~RegionGrabber()
@@ -104,7 +104,7 @@ void RegionGrabber::initGrabber()
void RegionGrabber::mousePressEvent( TQMouseEvent *e )
{
- if ( e->button() == Qt::LeftButton )
+ if ( e->button() == TQt::LeftButton )
{
mouseDown = true;
grabRect = TQRect( e->pos(), e->pos() );
@@ -168,7 +168,7 @@ void RegionGrabber::drawRubber()
p.setPen( TQPen( color0, 1 ) );
p.setBrush( NoBrush );
- style().tqdrawPrimitive( TQStyle::PE_FocusRect, &p, grabRect, colorGroup(),
+ style().drawPrimitive( TQStyle::PE_FocusRect, &p, grabRect, colorGroup(),
TQStyle::Style_Default, TQStyleOption( colorGroup().base() ) );
p.end();
diff --git a/ksnapshot/regiongrabber.h b/ksnapshot/regiongrabber.h
index 24c65d70..0495bf5a 100644
--- a/ksnapshot/regiongrabber.h
+++ b/ksnapshot/regiongrabber.h
@@ -37,7 +37,7 @@ class SizeTip : public TQLabel
class RegionGrabber : public TQWidget
{
- Q_OBJECT
+ TQ_OBJECT
public:
diff --git a/ksnapshot/windowgrabber.cpp b/ksnapshot/windowgrabber.cpp
index eac0fa6e..70fbabdc 100644
--- a/ksnapshot/windowgrabber.cpp
+++ b/ksnapshot/windowgrabber.cpp
@@ -240,7 +240,7 @@ TQPixmap WindowGrabber::grabCurrent( bool includeDecorations )
void WindowGrabber::mousePressEvent( TQMouseEvent *e )
{
- if ( e->button() == Qt::RightButton )
+ if ( e->button() == TQt::RightButton )
yPos = e->globalY();
else {
TQPixmap pm;
@@ -258,7 +258,7 @@ void WindowGrabber::mousePressEvent( TQMouseEvent *e )
void WindowGrabber::mouseReleaseEvent( TQMouseEvent *e )
{
- if ( e->button() == Qt::RightButton )
+ if ( e->button() == TQt::RightButton )
yPos = -1;
}
diff --git a/ksnapshot/windowgrabber.h b/ksnapshot/windowgrabber.h
index cf2c186a..eb771d8d 100644
--- a/ksnapshot/windowgrabber.h
+++ b/ksnapshot/windowgrabber.h
@@ -28,7 +28,7 @@
class WindowGrabber : public TQDialog
{
- Q_OBJECT
+ TQ_OBJECT
public: