diff options
Diffstat (limited to 'ksnapshot/ksnapshot.cpp')
-rw-r--r-- | ksnapshot/ksnapshot.cpp | 85 |
1 files changed, 44 insertions, 41 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) |