summaryrefslogtreecommitdiffstats
path: root/ksnapshot
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-08-02 19:23:46 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-08-02 19:23:46 +0000
commiteba47f8f0637f451e21348187591e1f1fd58ac74 (patch)
tree448f10b95c656604acc331a3236c1e59bde5c1ad /ksnapshot
parentc7e8736c69373f48b0401319757c742e8607431a (diff)
downloadtdegraphics-eba47f8f0637f451e21348187591e1f1fd58ac74.tar.gz
tdegraphics-eba47f8f0637f451e21348187591e1f1fd58ac74.zip
TQt conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1158446 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ksnapshot')
-rw-r--r--ksnapshot/ksnapshot.cpp156
-rw-r--r--ksnapshot/ksnapshot.h82
-rw-r--r--ksnapshot/ksnapshotiface.h6
-rw-r--r--ksnapshot/ksnapshotwidget.ui.h16
-rw-r--r--ksnapshot/regiongrabber.cpp80
-rw-r--r--ksnapshot/regiongrabber.h28
-rw-r--r--ksnapshot/windowgrabber.cpp74
-rw-r--r--ksnapshot/windowgrabber.h24
8 files changed, 233 insertions, 233 deletions
diff --git a/ksnapshot/ksnapshot.cpp b/ksnapshot/ksnapshot.cpp
index a0e1d06f..f8ad1977 100644
--- a/ksnapshot/ksnapshot.cpp
+++ b/ksnapshot/ksnapshot.cpp
@@ -23,11 +23,11 @@
#include <ksavefile.h>
#include <ktempfile.h>
-#include <qbitmap.h>
-#include <qdragobject.h>
-#include <qimage.h>
-#include <qclipboard.h>
-#include <qvbox.h>
+#include <tqbitmap.h>
+#include <tqdragobject.h>
+#include <tqimage.h>
+#include <tqclipboard.h>
+#include <tqvbox.h>
#include <kaccel.h>
#include <knotifyclient.h>
@@ -36,11 +36,11 @@
#include <kpushbutton.h>
#include <kstartupinfo.h>
-#include <qcursor.h>
-#include <qregexp.h>
-#include <qpainter.h>
-#include <qpaintdevicemetrics.h>
-#include <qwhatsthis.h>
+#include <tqcursor.h>
+#include <tqregexp.h>
+#include <tqpainter.h>
+#include <tqpaintdevicemetrics.h>
+#include <tqwhatsthis.h>
#include <stdlib.h>
@@ -58,32 +58,32 @@
#define kApp KApplication::kApplication()
-KSnapshot::KSnapshot(QWidget *parent, const char *name, bool grabCurrent)
+KSnapshot::KSnapshot(TQWidget *parent, const char *name, bool grabCurrent)
: DCOPObject("interface"),
- KDialogBase(parent, name, true, QString::null, Help|User1, User1,
+ KDialogBase(parent, name, true, TQString::null, Help|User1, User1,
true, KStdGuiItem::quit() )
{
- grabber = new QWidget( 0, 0, WStyle_Customize | WX11BypassWM );
+ grabber = new TQWidget( 0, 0, WStyle_Customize | WX11BypassWM );
grabber->move( -1000, -1000 );
grabber->installEventFilter( this );
KStartupInfo::appStarted();
- QVBox *vbox = makeVBoxMainWidget();
+ TQVBox *vbox = makeVBoxMainWidget();
mainWidget = new KSnapshotWidget( vbox, "mainWidget" );
- connect(mainWidget, SIGNAL(startImageDrag()), SLOT(slotDragSnapshot()));
+ connect(mainWidget, TQT_SIGNAL(startImageDrag()), TQT_SLOT(slotDragSnapshot()));
- connect( mainWidget, SIGNAL( newClicked() ), SLOT( slotGrab() ) );
- connect( mainWidget, SIGNAL( saveClicked() ), SLOT( slotSaveAs() ) );
- connect( mainWidget, SIGNAL( printClicked() ), SLOT( slotPrint() ) );
- connect( mainWidget, SIGNAL( copyClicked() ), SLOT( slotCopy() ) );
+ 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() ) );
grabber->show();
grabber->grabMouse( waitCursor );
if ( !grabCurrent )
- snapshot = QPixmap::grabWindow( qt_xrootwin() );
+ snapshot = TQPixmap::grabWindow( qt_xrootwin() );
else {
mainWidget->setMode( WindowUnderCursor );
mainWidget->setIncludeDecorations( true );
@@ -99,44 +99,44 @@ KSnapshot::KSnapshot(QWidget *parent, const char *name, bool grabCurrent)
mainWidget->setDelay(conf->readNumEntry("delay",0));
mainWidget->setMode( conf->readNumEntry( "mode", 0 ) );
mainWidget->setIncludeDecorations(conf->readBoolEntry("includeDecorations",true));
- filename = KURL::fromPathOrURL( conf->readPathEntry( "filename", QDir::currentDirPath()+"/"+i18n("snapshot")+"1.png" ));
+ filename = KURL::fromPathOrURL( conf->readPathEntry( "filename", TQDir::currentDirPath()+"/"+i18n("snapshot")+"1.png" ));
// Make sure the name is not already being used
while(KIO::NetAccess::exists( filename, false, this )) {
autoincFilename();
}
- connect( &grabTimer, SIGNAL( timeout() ), this, SLOT( grabTimerDone() ) );
- connect( &updateTimer, SIGNAL( timeout() ), this, SLOT( updatePreview() ) );
- QTimer::singleShot( 0, this, SLOT( updateCaption() ) );
+ connect( &grabTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( grabTimerDone() ) );
+ connect( &updateTimer, TQT_SIGNAL( timeout() ), this, TQT_SLOT( updatePreview() ) );
+ TQTimer::singleShot( 0, this, TQT_SLOT( updateCaption() ) );
KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), false);
- QPushButton *helpButton = actionButton( Help );
+ TQPushButton *helpButton = actionButton( Help );
helpButton->setPopup(helpMenu->menu());
KAccel* accel = new KAccel(this);
- accel->insert(KStdAccel::Quit, kapp, SLOT(quit()));
+ accel->insert(KStdAccel::Quit, kapp, TQT_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, this, SLOT(slotSave()));
- accel->insert(KStdAccel::Save, this, SLOT(slotSaveAs()));
-// accel->insert(KShortcut(CTRL+Key_A), this, SLOT(slotSaveAs()));
+ CTRL+SHIFT+Key_S, this, TQT_SLOT(slotSave()));
+ accel->insert(KStdAccel::Save, this, TQT_SLOT(slotSaveAs()));
+// accel->insert(KShortcut(CTRL+Key_A), this, TQT_SLOT(slotSaveAs()));
accel->insert( "SaveAs", i18n("Save Snapshot &As..."),
i18n("Save the snapshot to the file specified by the user."),
- CTRL+Key_A, this, SLOT(slotSaveAs()));
- accel->insert(KStdAccel::Print, this, SLOT(slotPrint()));
- accel->insert(KStdAccel::New, this, SLOT(slotGrab()));
- accel->insert(KStdAccel::Copy, this, SLOT(slotCopy()));
+ CTRL+Key_A, this, TQT_SLOT(slotSaveAs()));
+ accel->insert(KStdAccel::Print, this, TQT_SLOT(slotPrint()));
+ accel->insert(KStdAccel::New, this, TQT_SLOT(slotGrab()));
+ accel->insert(KStdAccel::Copy, this, TQT_SLOT(slotCopy()));
- accel->insert( "Quit2", Key_Q, this, SLOT(slotSave()));
- accel->insert( "Save2", Key_S, this, SLOT(slotSaveAs()));
- accel->insert( "Print2", Key_P, this, SLOT(slotPrint()));
- accel->insert( "New2", Key_N, this, SLOT(slotGrab()));
- accel->insert( "New3", Key_Space, this, SLOT(slotGrab()));
+ accel->insert( "Quit2", Key_Q, this, TQT_SLOT(slotSave()));
+ accel->insert( "Save2", Key_S, this, TQT_SLOT(slotSaveAs()));
+ accel->insert( "Print2", Key_P, this, TQT_SLOT(slotPrint()));
+ accel->insert( "New2", Key_N, this, TQT_SLOT(slotGrab()));
+ accel->insert( "New3", Key_Space, this, TQT_SLOT(slotGrab()));
setEscapeButton( User1 );
- connect( this, SIGNAL( user1Clicked() ), SLOT( reject() ) );
+ connect( this, TQT_SIGNAL( user1Clicked() ), TQT_SLOT( reject() ) );
mainWidget->btnNew->setFocus();
}
@@ -145,7 +145,7 @@ KSnapshot::~KSnapshot()
{
}
-void KSnapshot::resizeEvent( QResizeEvent *event)
+void KSnapshot::resizeEvent( TQResizeEvent *event)
{
if( !updateTimer.isActive() )
updateTimer.start(200, true);
@@ -153,7 +153,7 @@ void KSnapshot::resizeEvent( QResizeEvent *event)
updateTimer.changeInterval(200);
}
-bool KSnapshot::save( const QString &filename )
+bool KSnapshot::save( const TQString &filename )
{
return save( KURL::fromPathOrURL( filename ));
}
@@ -161,15 +161,15 @@ bool KSnapshot::save( const QString &filename )
bool KSnapshot::save( const KURL& url )
{
if ( KIO::NetAccess::exists( url, false, this ) ) {
- const QString title = i18n( "File Exists" );
- const QString text = i18n( "<qt>Do you really want to overwrite <b>%1</b>?</qt>" ).arg(url.prettyURL());
+ const TQString title = i18n( "File Exists" );
+ const TQString text = i18n( "<qt>Do you really want to overwrite <b>%1</b>?</qt>" ).arg(url.prettyURL());
if (KMessageBox::Continue != KMessageBox::warningContinueCancel( this, text, title, i18n("Overwrite") ) )
{
return false;
}
}
- QString type( KImageIO::type(url.path()) );
+ TQString type( KImageIO::type(url.path()) );
if ( type.isNull() )
type = "PNG";
@@ -193,12 +193,12 @@ bool KSnapshot::save( const KURL& url )
}
}
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
if ( !ok ) {
kdWarning() << "KSnapshot was unable to save the snapshot" << endl;
- QString caption = i18n("Unable to save image");
- QString text = i18n("KSnapshot was unable to save the image to\n%1.")
+ TQString caption = i18n("Unable to save image");
+ TQString text = i18n("KSnapshot was unable to save the image to\n%1.")
.arg(url.prettyURL());
KMessageBox::error(this, text, caption);
}
@@ -216,7 +216,7 @@ void KSnapshot::slotSave()
void KSnapshot::slotSaveAs()
{
- QStringList mimetypes = KImageIO::mimeTypes( KImageIO::Writing );
+ TQStringList mimetypes = KImageIO::mimeTypes( KImageIO::Writing );
KFileDialog dlg( filename.url(), mimetypes.join(" "), this, "filedialog", true);
dlg.setOperationMode( KFileDialog::Saving );
@@ -241,13 +241,13 @@ void KSnapshot::slotSaveAs()
void KSnapshot::slotCopy()
{
- QClipboard *cb = QApplication::clipboard();
+ QClipboard *cb = TQApplication::clipboard();
cb->setPixmap( snapshot );
}
void KSnapshot::slotDragSnapshot()
{
- QDragObject *drobj = new QImageDrag(snapshot.convertToImage(), this);
+ TQDragObject *drobj = new TQImageDrag(snapshot.convertToImage(), this);
drobj->setPixmap(mainWidget->preview());
drobj->dragCopy();
}
@@ -261,8 +261,8 @@ void KSnapshot::slotGrab()
else {
if ( mainWidget->mode() == Region ) {
rgnGrab = new RegionGrabber();
- connect( rgnGrab, SIGNAL( regionGrabbed( const QPixmap & ) ),
- SLOT( slotRegionGrabbed( const QPixmap & ) ) );
+ connect( rgnGrab, TQT_SIGNAL( regionGrabbed( const TQPixmap & ) ),
+ TQT_SLOT( slotRegionGrabbed( const TQPixmap & ) ) );
}
else {
grabber->show();
@@ -285,8 +285,8 @@ void KSnapshot::slotPrint()
{
qApp->processEvents();
- QPainter painter(&printer);
- QPaintDeviceMetrics metrics(painter.device());
+ TQPainter painter(&printer);
+ TQPaintDeviceMetrics metrics(painter.device());
float w = snapshot.width();
float dw = w - metrics.width();
@@ -299,7 +299,7 @@ void KSnapshot::slotPrint()
if ( scale ) {
- QImage img = snapshot.convertToImage();
+ TQImage img = snapshot.convertToImage();
qApp->processEvents();
float newh, neww;
@@ -312,7 +312,7 @@ void KSnapshot::slotPrint()
neww = newh/h*w;
}
- img = img.smoothScale( int(neww), int(newh), QImage::ScaleMin );
+ img = img.smoothScale( int(neww), int(newh), TQImage::ScaleMin );
qApp->processEvents();
int x = (metrics.width()-img.width())/2;
@@ -330,7 +330,7 @@ void KSnapshot::slotPrint()
qApp->processEvents();
}
-void KSnapshot::slotRegionGrabbed( const QPixmap &pix )
+void KSnapshot::slotRegionGrabbed( const TQPixmap &pix )
{
if ( !pix.isNull() )
{
@@ -341,11 +341,11 @@ void KSnapshot::slotRegionGrabbed( const QPixmap &pix )
}
delete rgnGrab;
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
show();
}
-void KSnapshot::slotWindowGrabbed( const QPixmap &pix )
+void KSnapshot::slotWindowGrabbed( const TQPixmap &pix )
{
if ( !pix.isNull() )
{
@@ -355,11 +355,11 @@ void KSnapshot::slotWindowGrabbed( const QPixmap &pix )
updateCaption();
}
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
show();
}
-void KSnapshot::closeEvent( QCloseEvent * e )
+void KSnapshot::closeEvent( TQCloseEvent * e )
{
KConfig *conf=KGlobal::config();
conf->setGroup("GENERAL");
@@ -367,16 +367,16 @@ void KSnapshot::closeEvent( QCloseEvent * e )
conf->writeEntry("mode",mainWidget->mode());
conf->writeEntry("includeDecorations",mainWidget->includeDecorations());
KURL url = filename;
- url.setPass( QString::null );
+ url.setPass( TQString::null );
conf->writePathEntry("filename",url.url());
e->accept();
}
-bool KSnapshot::eventFilter( QObject* o, QEvent* e)
+bool KSnapshot::eventFilter( TQObject* o, TQEvent* e)
{
- if ( o == grabber && e->type() == QEvent::MouseButtonPress ) {
- QMouseEvent* me = (QMouseEvent*) e;
- if ( QWidget::mouseGrabber() != grabber )
+ if ( o == grabber && e->type() == TQEvent::MouseButtonPress ) {
+ TQMouseEvent* me = (TQMouseEvent*) e;
+ if ( TQWidget::mouseGrabber() != grabber )
return false;
if ( me->button() == LeftButton )
performGrab();
@@ -387,18 +387,18 @@ bool KSnapshot::eventFilter( QObject* o, QEvent* e)
void KSnapshot::autoincFilename()
{
// Extract the filename from the path
- QString name= filename.fileName();
+ TQString name= filename.fileName();
// If the name contains a number then increment it
- QRegExp numSearch("[0-9]+");
+ TQRegExp numSearch("[0-9]+");
// Does it have a number?
int start = numSearch.search(name);
if (start != -1) {
// It has a number, increment it
int len = numSearch.matchedLength();
- QString numAsStr= name.mid(start, len);
- QString number = QString::number(numAsStr.toInt() + 1);
+ TQString numAsStr= name.mid(start, len);
+ TQString number = TQString::number(numAsStr.toInt() + 1);
number = number.rightJustify( len, '0');
name.replace(start, len, number );
}
@@ -430,8 +430,8 @@ void KSnapshot::grabTimerDone()
{
if ( mainWidget->mode() == Region ) {
rgnGrab = new RegionGrabber();
- connect( rgnGrab, SIGNAL( regionGrabbed( const QPixmap & ) ),
- SLOT( slotRegionGrabbed( const QPixmap & ) ) );
+ connect( rgnGrab, TQT_SIGNAL( regionGrabbed( const TQPixmap & ) ),
+ TQT_SLOT( slotRegionGrabbed( const TQPixmap & ) ) );
}
else {
performGrab();
@@ -446,18 +446,18 @@ void KSnapshot::performGrab()
grabTimer.stop();
if ( mainWidget->mode() == ChildWindow ) {
WindowGrabber wndGrab;
- connect( &wndGrab, SIGNAL( windowGrabbed( const QPixmap & ) ),
- SLOT( slotWindowGrabbed( const QPixmap & ) ) );
+ connect( &wndGrab, TQT_SIGNAL( windowGrabbed( const TQPixmap & ) ),
+ TQT_SLOT( slotWindowGrabbed( const TQPixmap & ) ) );
wndGrab.exec();
}
else if ( mainWidget->mode() == WindowUnderCursor ) {
snapshot = WindowGrabber::grabCurrent( mainWidget->includeDecorations() );
}
else {
- snapshot = QPixmap::grabWindow( qt_xrootwin() );
+ snapshot = TQPixmap::grabWindow( qt_xrootwin() );
}
updatePreview();
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
modified = true;
updateCaption();
show();
@@ -473,7 +473,7 @@ int KSnapshot::timeout()
return mainWidget->delay();
}
-void KSnapshot::setURL( const QString &url )
+void KSnapshot::setURL( const TQString &url )
{
KURL newURL = KURL::fromPathOrURL( url );
if ( newURL == filename )
@@ -500,7 +500,7 @@ void KSnapshot::updateCaption()
void KSnapshot::slotMovePointer(int x, int y)
{
- QCursor::setPos( x, y );
+ TQCursor::setPos( x, y );
}
void KSnapshot::exit()
diff --git a/ksnapshot/ksnapshot.h b/ksnapshot/ksnapshot.h
index 486c0a1b..81dadd6d 100644
--- a/ksnapshot/ksnapshot.h
+++ b/ksnapshot/ksnapshot.h
@@ -4,13 +4,13 @@
#define KSNAPSHOT_H
#include "ksnapshotiface.h"
-#include <qbitmap.h>
-#include <qcursor.h>
-#include <qlabel.h>
-#include <qpainter.h>
-#include <qpixmap.h>
-#include <qstyle.h>
-#include <qtimer.h>
+#include <tqbitmap.h>
+#include <tqcursor.h>
+#include <tqlabel.h>
+#include <tqpainter.h>
+#include <tqpixmap.h>
+#include <tqstyle.h>
+#include <tqtimer.h>
#include <dcopclient.h>
#include <kglobalsettings.h>
@@ -25,67 +25,67 @@ class KSnapshotPreview : public QLabel
Q_OBJECT
public:
- KSnapshotPreview(QWidget *parent, const char *name = 0)
- : QLabel(parent, name)
+ KSnapshotPreview(TQWidget *parent, const char *name = 0)
+ : TQLabel(parent, name)
{
setAlignment(AlignHCenter | AlignVCenter);
- setCursor(QCursor(Qt::PointingHandCursor));
+ setCursor(TQCursor(Qt::PointingHandCursor));
}
virtual ~KSnapshotPreview() {}
- void setPixmap(const QPixmap& pm)
+ void setPixmap(const TQPixmap& pm)
{
// if this looks convoluted, that's because it is. drawing a PE_SizeGrip
// does unexpected things when painting directly onto the pixmap
- QPixmap pixmap(pm);
- QPixmap handle(15, 15);
- QBitmap mask(15, 15, true);
+ TQPixmap pixmap(pm);
+ TQPixmap handle(15, 15);
+ TQBitmap mask(15, 15, true);
{
- QPainter p(&mask);
- style().drawPrimitive(QStyle::PE_SizeGrip, &p, QRect(0, 0, 15, 15), palette().active());
+ TQPainter p(&mask);
+ style().drawPrimitive(TQStyle::PE_SizeGrip, &p, TQRect(0, 0, 15, 15), palette().active());
p.end();
handle.setMask(mask);
}
{
- QPainter p(&handle);
- style().drawPrimitive(QStyle::PE_SizeGrip, &p, QRect(0, 0, 15, 15), palette().active());
+ TQPainter p(&handle);
+ style().drawPrimitive(TQStyle::PE_SizeGrip, &p, TQRect(0, 0, 15, 15), palette().active());
p.end();
}
- QRect rect(pixmap.width() - 16, pixmap.height() - 16, 15, 15);
- QPainter p(&pixmap);
+ TQRect rect(pixmap.width() - 16, pixmap.height() - 16, 15, 15);
+ TQPainter p(&pixmap);
p.drawPixmap(rect, handle);
p.end();
- QLabel::setPixmap(pixmap);
+ TQLabel::setPixmap(pixmap);
}
signals:
void startDrag();
protected:
- void mousePressEvent(QMouseEvent * e)
+ void mousePressEvent(TQMouseEvent * e)
{
mClickPt = e->pos();
}
- void mouseMoveEvent(QMouseEvent * e)
+ void mouseMoveEvent(TQMouseEvent * e)
{
- if (mClickPt != QPoint(0, 0) &&
+ if (mClickPt != TQPoint(0, 0) &&
(e->pos() - mClickPt).manhattanLength() > KGlobalSettings::dndEventDelay())
{
- mClickPt = QPoint(0, 0);
+ mClickPt = TQPoint(0, 0);
emit startDrag();
}
}
- void mouseReleaseEvent(QMouseEvent * /*e*/)
+ void mouseReleaseEvent(TQMouseEvent * /*e*/)
{
- mClickPt = QPoint(0, 0);
+ mClickPt = TQPoint(0, 0);
}
- QPoint mClickPt;
+ TQPoint mClickPt;
};
class KSnapshot : public KDialogBase, virtual public KSnapshotIface
@@ -93,13 +93,13 @@ class KSnapshot : public KDialogBase, virtual public KSnapshotIface
Q_OBJECT
public:
- KSnapshot(QWidget *parent= 0, const char *name= 0, bool grabCurrent=false);
+ KSnapshot(TQWidget *parent= 0, const char *name= 0, bool grabCurrent=false);
~KSnapshot();
enum CaptureMode { FullScreen=0, WindowUnderCursor=1, Region=2, ChildWindow=3 };
- bool save( const QString &filename );
- QString url() const { return filename.url(); }
+ bool save( const TQString &filename );
+ TQString url() const { return filename.url(); }
protected slots:
void slotGrab();
@@ -110,24 +110,24 @@ protected slots:
void slotMovePointer( int x, int y );
void setTime(int newTime);
- void setURL(const QString &newURL);
+ void setURL(const TQString &newURL);
void setGrabMode( int m );
void exit();
protected:
void reject() { close(); }
- virtual void closeEvent( QCloseEvent * e );
- void resizeEvent(QResizeEvent*);
- bool eventFilter( QObject*, QEvent* );
+ virtual void closeEvent( TQCloseEvent * e );
+ void resizeEvent(TQResizeEvent*);
+ bool eventFilter( TQObject*, TQEvent* );
private slots:
void grabTimerDone();
void slotDragSnapshot();
void updateCaption();
void updatePreview();
- void slotRegionGrabbed( const QPixmap & );
- void slotWindowGrabbed( const QPixmap & );
+ void slotRegionGrabbed( const TQPixmap & );
+ void slotWindowGrabbed( const TQPixmap & );
private:
bool save( const KURL& url );
@@ -136,10 +136,10 @@ private:
int grabMode();
int timeout();
- QPixmap snapshot;
- QTimer grabTimer;
- QTimer updateTimer;
- QWidget* grabber;
+ TQPixmap snapshot;
+ TQTimer grabTimer;
+ TQTimer updateTimer;
+ TQWidget* grabber;
KURL filename;
KSnapshotWidget *mainWidget;
RegionGrabber *rgnGrab;
diff --git a/ksnapshot/ksnapshotiface.h b/ksnapshot/ksnapshotiface.h
index 6b1f3477..5136b0ba 100644
--- a/ksnapshot/ksnapshotiface.h
+++ b/ksnapshot/ksnapshotiface.h
@@ -19,7 +19,7 @@ class KSnapshotIface : virtual public DCOPObject
k_dcop:
/** the current filename (as a URL) that will
be used to save to */
- virtual QString url() const = 0;
+ virtual TQString url() const = 0;
/** Grab an image **/
virtual void slotGrab() = 0;
@@ -31,7 +31,7 @@ class KSnapshotIface : virtual public DCOPObject
virtual void slotSave() = 0;
/** Save the image to the specified filename */
- virtual bool save(const QString &filename) = 0;
+ virtual bool save(const TQString &filename) = 0;
/** Saves image as **/
virtual void slotSaveAs() = 0;
@@ -46,7 +46,7 @@ class KSnapshotIface : virtual public DCOPObject
virtual int timeout() = 0;
/** Set the URL to the file to save **/
- virtual void setURL(const QString &newURL) = 0;
+ virtual void setURL(const TQString &newURL) = 0;
/** Set the ability to grab the entire screen, just the window
containing the mouse, or a region */
diff --git a/ksnapshot/ksnapshotwidget.ui.h b/ksnapshot/ksnapshotwidget.ui.h
index d7e757f5..ab811bf2 100644
--- a/ksnapshot/ksnapshotwidget.ui.h
+++ b/ksnapshot/ksnapshotwidget.ui.h
@@ -32,21 +32,21 @@ void KSnapshotWidget::slotModeChanged( int mode )
}
-void KSnapshotWidget::setPreview( const QPixmap &pm )
+void KSnapshotWidget::setPreview( const TQPixmap &pm )
{
- QImage img = pm.convertToImage();
+ TQImage img = pm.convertToImage();
double r1 = ( ( double ) pm.height() ) / pm.width();
if ( r1 * previewWidth() < previewHeight() )
img = img.smoothScale( previewWidth(),
int( previewWidth() * r1 ),
- QImage::ScaleMin );
+ TQImage::ScaleMin );
else
img = img.smoothScale( ( int ) ( ( ( double )previewHeight() ) / r1 ),
- previewHeight(), QImage::ScaleMin );
+ previewHeight(), TQImage::ScaleMin );
- QToolTip::remove( lblImage );
- QToolTip::add( lblImage,
- QString( "Preview of the snapshot image (%1 x %2)" )
+ TQToolTip::remove( lblImage );
+ TQToolTip::add( lblImage,
+ TQString( "Preview of the snapshot image (%1 x %2)" )
.arg( pm.width() ).arg( pm.height() ) );
lblImage->setPixmap( img );
@@ -115,7 +115,7 @@ void KSnapshotWidget::slotStartDrag()
}
-QPixmap KSnapshotWidget::preview()
+TQPixmap KSnapshotWidget::preview()
{
return *lblImage->pixmap();
}
diff --git a/ksnapshot/regiongrabber.cpp b/ksnapshot/regiongrabber.cpp
index c1d8ed98..3522b74b 100644
--- a/ksnapshot/regiongrabber.cpp
+++ b/ksnapshot/regiongrabber.cpp
@@ -19,29 +19,29 @@
#include "regiongrabber.h"
-#include <qapplication.h>
-#include <qpainter.h>
-#include <qpalette.h>
-#include <qstyle.h>
-#include <qtimer.h>
-#include <qtooltip.h>
+#include <tqapplication.h>
+#include <tqpainter.h>
+#include <tqpalette.h>
+#include <tqstyle.h>
+#include <tqtimer.h>
+#include <tqtooltip.h>
#include <kglobalsettings.h>
-SizeTip::SizeTip( QWidget *parent, const char *name )
- : QLabel( parent, name, WStyle_Customize | WX11BypassWM |
+SizeTip::SizeTip( TQWidget *parent, const char *name )
+ : TQLabel( parent, name, WStyle_Customize | WX11BypassWM |
WStyle_StaysOnTop | WStyle_NoBorder | WStyle_Tool )
{
setMargin( 2 );
setIndent( 0 );
- setFrameStyle( QFrame::Plain | QFrame::Box );
+ setFrameStyle( TQFrame::Plain | TQFrame::Box );
- setPalette( QToolTip::palette() );
+ setPalette( TQToolTip::palette() );
}
-void SizeTip::setTip( const QRect &rect )
+void SizeTip::setTip( const TQRect &rect )
{
- QString tip = QString( "%1x%2" ).arg( rect.width() )
+ TQString tip = TQString( "%1x%2" ).arg( rect.width() )
.arg( rect.height() );
setText( tip );
@@ -50,16 +50,16 @@ void SizeTip::setTip( const QRect &rect )
positionTip( rect );
}
-void SizeTip::positionTip( const QRect &rect )
+void SizeTip::positionTip( const TQRect &rect )
{
- QRect tipRect = geometry();
- tipRect.moveTopLeft( QPoint( 0, 0 ) );
+ TQRect tipRect = geometry();
+ tipRect.moveTopLeft( TQPoint( 0, 0 ) );
if ( rect.intersects( tipRect ) )
{
- QRect deskR = KGlobalSettings::desktopGeometry( QPoint( 0, 0 ) );
+ TQRect deskR = KGlobalSettings::desktopGeometry( TQPoint( 0, 0 ) );
- tipRect.moveCenter( QPoint( deskR.width()/2, deskR.height()/2 ) );
+ tipRect.moveCenter( TQPoint( deskR.width()/2, deskR.height()/2 ) );
if ( !rect.contains( tipRect, true ) && rect.intersects( tipRect ) )
tipRect.moveBottomRight( geometry().bottomRight() );
}
@@ -68,15 +68,15 @@ void SizeTip::positionTip( const QRect &rect )
}
RegionGrabber::RegionGrabber()
- : QWidget( 0, 0, WStyle_Customize | WX11BypassWM ),
+ : TQWidget( 0, 0, WStyle_Customize | WX11BypassWM ),
mouseDown( false ), sizeTip( 0L )
{
- sizeTip = new SizeTip( ( QWidget * )0L );
+ sizeTip = new SizeTip( ( TQWidget * )0L );
- tipTimer = new QTimer( this );
- connect( tipTimer, SIGNAL( timeout() ), SLOT( updateSizeTip() ) );
+ tipTimer = new TQTimer( this );
+ connect( tipTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( updateSizeTip() ) );
- QTimer::singleShot( 200, this, SLOT( initGrabber() ) );
+ TQTimer::singleShot( 200, this, TQT_SLOT( initGrabber() ) );
}
RegionGrabber::~RegionGrabber()
@@ -86,11 +86,11 @@ RegionGrabber::~RegionGrabber()
void RegionGrabber::initGrabber()
{
- pixmap = QPixmap::grabWindow( qt_xrootwin() );
+ pixmap = TQPixmap::grabWindow( qt_xrootwin() );
setPaletteBackgroundPixmap( pixmap );
- QDesktopWidget desktopWidget;
- QRect desktopSize;
+ TQDesktopWidget desktopWidget;
+ TQRect desktopSize;
if ( desktopWidget.isVirtualDesktop() )
desktopSize = desktopWidget.geometry();
else
@@ -99,19 +99,19 @@ void RegionGrabber::initGrabber()
setGeometry( desktopSize );
showFullScreen();
- QApplication::setOverrideCursor( crossCursor );
+ TQApplication::setOverrideCursor( crossCursor );
}
-void RegionGrabber::mousePressEvent( QMouseEvent *e )
+void RegionGrabber::mousePressEvent( TQMouseEvent *e )
{
if ( e->button() == LeftButton )
{
mouseDown = true;
- grabRect = QRect( e->pos(), e->pos() );
+ grabRect = TQRect( e->pos(), e->pos() );
}
}
-void RegionGrabber::mouseMoveEvent( QMouseEvent *e )
+void RegionGrabber::mouseMoveEvent( TQMouseEvent *e )
{
if ( mouseDown )
{
@@ -124,7 +124,7 @@ void RegionGrabber::mouseMoveEvent( QMouseEvent *e )
}
}
-void RegionGrabber::mouseReleaseEvent( QMouseEvent *e )
+void RegionGrabber::mouseReleaseEvent( TQMouseEvent *e )
{
mouseDown = false;
drawRubber();
@@ -133,20 +133,20 @@ void RegionGrabber::mouseReleaseEvent( QMouseEvent *e )
grabRect.setBottomRight( e->pos() );
grabRect = grabRect.normalize();
- QPixmap region = QPixmap::grabWindow( winId(), grabRect.x(), grabRect.y(),
+ TQPixmap region = TQPixmap::grabWindow( winId(), grabRect.x(), grabRect.y(),
grabRect.width(), grabRect.height() );
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
emit regionGrabbed( region );
}
-void RegionGrabber::keyPressEvent( QKeyEvent *e )
+void RegionGrabber::keyPressEvent( TQKeyEvent *e )
{
if ( e->key() == Key_Escape )
{
- QApplication::restoreOverrideCursor();
- emit regionGrabbed( QPixmap() );
+ TQApplication::restoreOverrideCursor();
+ emit regionGrabbed( TQPixmap() );
}
else
e->ignore();
@@ -154,7 +154,7 @@ void RegionGrabber::keyPressEvent( QKeyEvent *e )
void RegionGrabber::updateSizeTip()
{
- QRect rect = grabRect.normalize();
+ TQRect rect = grabRect.normalize();
sizeTip->setTip( rect );
sizeTip->show();
@@ -162,14 +162,14 @@ void RegionGrabber::updateSizeTip()
void RegionGrabber::drawRubber()
{
- QPainter p;
+ TQPainter p;
p.begin( this );
p.setRasterOp( NotROP );
- p.setPen( QPen( color0, 1 ) );
+ p.setPen( TQPen( color0, 1 ) );
p.setBrush( NoBrush );
- style().drawPrimitive( QStyle::PE_FocusRect, &p, grabRect, colorGroup(),
- QStyle::Style_Default, QStyleOption( colorGroup().base() ) );
+ 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 ee9a8238..5a9d28b9 100644
--- a/ksnapshot/regiongrabber.h
+++ b/ksnapshot/regiongrabber.h
@@ -20,19 +20,19 @@
#ifndef REGIONGRABBER_H
#define REGIONGRABBER_H
-#include <qlabel.h>
-#include <qpixmap.h>
+#include <tqlabel.h>
+#include <tqpixmap.h>
-class QTimer;
+class TQTimer;
class SizeTip : public QLabel
{
public:
- SizeTip( QWidget *parent, const char *name=0 );
+ SizeTip( TQWidget *parent, const char *name=0 );
~SizeTip() {}
- void setTip( const QRect &rect );
- void positionTip( const QRect &rect );
+ void setTip( const TQRect &rect );
+ void positionTip( const TQRect &rect );
};
class RegionGrabber : public QWidget
@@ -48,22 +48,22 @@ class RegionGrabber : public QWidget
void updateSizeTip();
signals:
- void regionGrabbed( const QPixmap & );
+ void regionGrabbed( const TQPixmap & );
protected:
- void mousePressEvent( QMouseEvent *e );
- void mouseReleaseEvent( QMouseEvent *e );
- void mouseMoveEvent( QMouseEvent *e );
- void keyPressEvent( QKeyEvent *e );
+ void mousePressEvent( TQMouseEvent *e );
+ void mouseReleaseEvent( TQMouseEvent *e );
+ void mouseMoveEvent( TQMouseEvent *e );
+ void keyPressEvent( TQKeyEvent *e );
void drawRubber();
bool mouseDown;
- QRect grabRect;
- QPixmap pixmap;
+ TQRect grabRect;
+ TQPixmap pixmap;
SizeTip *sizeTip;
- QTimer *tipTimer;
+ TQTimer *tipTimer;
};
#endif // REGIONGRABBER_H
diff --git a/ksnapshot/windowgrabber.cpp b/ksnapshot/windowgrabber.cpp
index 036764b1..7e556efc 100644
--- a/ksnapshot/windowgrabber.cpp
+++ b/ksnapshot/windowgrabber.cpp
@@ -18,9 +18,9 @@
*/
#include "windowgrabber.h"
-#include <qbitmap.h>
-#include <qpainter.h>
-#include <qptrlist.h>
+#include <tqbitmap.h>
+#include <tqpainter.h>
+#include <tqptrlist.h>
#include <algorithm>
#include <config.h>
@@ -34,7 +34,7 @@ static
const int minSize = 8;
static
-bool operator< ( const QRect& r1, const QRect& r2 )
+bool operator< ( const TQRect& r1, const TQRect& r2 )
{
return r1.width() * r1.height() < r2.width() * r2.height();
}
@@ -43,7 +43,7 @@ bool operator< ( const QRect& r1, const QRect& r2 )
// a tree of window descriptors. Windows in non-viewable state or with height
// or width smaller than minSize will be ignored.
static
-void getWindowsRecursive( std::vector<QRect>& windows, Window w,
+void getWindowsRecursive( std::vector<TQRect>& windows, Window w,
int rx = 0, int ry = 0, int depth = 0 )
{
XWindowAttributes atts;
@@ -56,7 +56,7 @@ void getWindowsRecursive( std::vector<QRect>& windows, Window w,
y = atts.y + ry;
}
- QRect r( x, y, atts.width, atts.height );
+ TQRect r( x, y, atts.width, atts.height );
if ( std::find( windows.begin(), windows.end(), r ) == windows.end() ) {
windows.push_back( r );
}
@@ -130,15 +130,15 @@ Window windowUnderCursor( bool includeDecorations = true )
}
static
-QPixmap grabWindow( Window child, int x, int y, uint w, uint h, uint border )
+TQPixmap grabWindow( Window child, int x, int y, uint w, uint h, uint border )
{
- QPixmap pm( QPixmap::grabWindow( qt_xrootwin(), x, y, w, h ) );
+ TQPixmap pm( TQPixmap::grabWindow( qt_xrootwin(), x, y, w, h ) );
#ifdef HAVE_X11_EXTENSIONS_SHAPE_H
int tmp1, tmp2;
//Check whether the extension is available
if ( XShapeQueryExtension( qt_xdisplay(), &tmp1, &tmp2 ) ) {
- QBitmap mask( w, h );
+ TQBitmap mask( w, h );
//As the first step, get the mask from XShape.
int count, order;
XRectangle* rects = XShapeGetRectangles( qt_xdisplay(), child,
@@ -148,30 +148,30 @@ QPixmap grabWindow( Window child, int x, int y, uint w, uint h, uint border )
//Since the border area is part of the window, we use bounding
// to limit our work region
if (rects) {
- //Create a QRegion from the rectangles describing the bounding mask.
- QRegion contents;
+ //Create a TQRegion from the rectangles describing the bounding mask.
+ TQRegion contents;
for ( int pos = 0; pos < count; pos++ )
- contents += QRegion( rects[pos].x, rects[pos].y,
+ contents += TQRegion( rects[pos].x, rects[pos].y,
rects[pos].width, rects[pos].height );
XFree( rects );
//Create the bounding box.
- QRegion bbox( 0, 0, w, h );
+ TQRegion bbox( 0, 0, w, h );
if( border > 0 ) {
contents.translate( border, border );
- contents += QRegion( 0, 0, border, h );
- contents += QRegion( 0, 0, w, border );
- contents += QRegion( 0, h - border, w, border );
- contents += QRegion( w - border, 0, border, h );
+ contents += TQRegion( 0, 0, border, h );
+ contents += TQRegion( 0, 0, w, border );
+ contents += TQRegion( 0, h - border, w, border );
+ contents += TQRegion( w - border, 0, border, h );
}
//Get the masked away area.
- QRegion maskedAway = bbox - contents;
- QMemArray<QRect> maskedAwayRects = maskedAway.rects();
+ TQRegion maskedAway = bbox - contents;
+ TQMemArray<TQRect> maskedAwayRects = maskedAway.rects();
//Construct a bitmap mask from the rectangles
- QPainter p(&mask);
+ TQPainter p(&mask);
p.fillRect(0, 0, w, h, Qt::color1);
for (uint pos = 0; pos < maskedAwayRects.count(); pos++)
p.fillRect(maskedAwayRects[pos], Qt::color0);
@@ -186,7 +186,7 @@ QPixmap grabWindow( Window child, int x, int y, uint w, uint h, uint border )
}
WindowGrabber::WindowGrabber()
-: QDialog( 0, 0, true, Qt::WStyle_Customize | Qt::WStyle_NoBorder |
+: TQDialog( 0, 0, true, Qt::WStyle_Customize | Qt::WStyle_NoBorder |
Qt::WStyle_StaysOnTop | Qt::WX11BypassWM ),
current( -1 ), yPos( -1 )
{
@@ -196,7 +196,7 @@ WindowGrabber::WindowGrabber()
XGrabServer( qt_xdisplay() );
Window child = windowUnderCursor();
XGetGeometry( qt_xdisplay(), child, &root, &x, &y, &w, &h, &border, &depth );
- QPixmap pm( grabWindow( child, x, y, w, h, border ) );
+ TQPixmap pm( grabWindow( child, x, y, w, h, border ) );
getWindowsRecursive( windows, child );
XUngrabServer( qt_xdisplay() );
@@ -210,7 +210,7 @@ WindowGrabber::~WindowGrabber()
{
}
-QPixmap WindowGrabber::grabCurrent( bool includeDecorations )
+TQPixmap WindowGrabber::grabCurrent( bool includeDecorations )
{
Window root;
int y, x;
@@ -233,19 +233,19 @@ QPixmap WindowGrabber::grabCurrent( bool includeDecorations )
y = newy;
}
}
- QPixmap pm( grabWindow( child, x, y, w, h, border ) );
+ TQPixmap pm( grabWindow( child, x, y, w, h, border ) );
XUngrabServer( qt_xdisplay() );
return pm;
}
-void WindowGrabber::mousePressEvent( QMouseEvent *e )
+void WindowGrabber::mousePressEvent( TQMouseEvent *e )
{
- if ( e->button() == QMouseEvent::RightButton )
+ if ( e->button() == TQMouseEvent::RightButton )
yPos = e->globalY();
else {
- QPixmap pm;
+ TQPixmap pm;
if ( current ) {
- QRect r( windows[ current ] );
+ TQRect r( windows[ current ] );
int w = r.width();
int h = r.height();
pm.resize( w, h );
@@ -256,16 +256,16 @@ void WindowGrabber::mousePressEvent( QMouseEvent *e )
}
}
-void WindowGrabber::mouseReleaseEvent( QMouseEvent *e )
+void WindowGrabber::mouseReleaseEvent( TQMouseEvent *e )
{
- if ( e->button() == QMouseEvent::RightButton )
+ if ( e->button() == TQMouseEvent::RightButton )
yPos = -1;
}
static
const int minDistance = 10;
-void WindowGrabber::mouseMoveEvent( QMouseEvent *e )
+void WindowGrabber::mouseMoveEvent( TQMouseEvent *e )
{
if ( yPos == -1 ) {
int w = windowIndex( e->pos() );
@@ -287,7 +287,7 @@ void WindowGrabber::mouseMoveEvent( QMouseEvent *e )
}
}
-void WindowGrabber::wheelEvent( QWheelEvent *e )
+void WindowGrabber::wheelEvent( TQWheelEvent *e )
{
if ( e->delta() > 0 )
increaseScope( e->pos() );
@@ -300,7 +300,7 @@ void WindowGrabber::wheelEvent( QWheelEvent *e )
// Increases the scope to the next-bigger window containing the mouse pointer.
// This method is activated by either rotating the mouse wheel forwards or by
// dragging the mouse forwards while keeping the right mouse button pressed.
-void WindowGrabber::increaseScope( const QPoint &pos )
+void WindowGrabber::increaseScope( const TQPoint &pos )
{
for ( uint i = current + 1; i < windows.size(); i++ ) {
if ( windows[ i ].contains( pos ) ) {
@@ -314,7 +314,7 @@ void WindowGrabber::increaseScope( const QPoint &pos )
// Decreases the scope to the next-smaller window containing the mosue pointer.
// This method is activated by either rotating the mouse wheel backwards or by
// dragging the mouse backwards while keeping the right mouse button pressed.
-void WindowGrabber::decreaseScope( const QPoint &pos )
+void WindowGrabber::decreaseScope( const TQPoint &pos )
{
for ( int i = current - 1; i >= 0; i-- ) {
if ( windows[ i ].contains( pos ) ) {
@@ -327,7 +327,7 @@ void WindowGrabber::decreaseScope( const QPoint &pos )
// Searches and returns the index of the first (=smallest) window
// containing the mouse pointer.
-int WindowGrabber::windowIndex( const QPoint &pos ) const
+int WindowGrabber::windowIndex( const TQPoint &pos ) const
{
for ( uint i = 0; i < windows.size(); i++ ) {
if ( windows[ i ].contains( pos ) )
@@ -342,9 +342,9 @@ void WindowGrabber::drawBorder()
repaint();
if ( current >= 0 ) {
- QPainter p;
+ TQPainter p;
p.begin( this );
- p.setPen( QPen( Qt::red, 3 ) );
+ p.setPen( TQPen( Qt::red, 3 ) );
p.drawRect( windows[ current ] );
p.end();
}
diff --git a/ksnapshot/windowgrabber.h b/ksnapshot/windowgrabber.h
index 43598576..d6a56d6c 100644
--- a/ksnapshot/windowgrabber.h
+++ b/ksnapshot/windowgrabber.h
@@ -20,8 +20,8 @@
#ifndef WINDOWGRABBER_H
#define WINDOWGRABBER_H
-#include <qdialog.h>
-#include <qpixmap.h>
+#include <tqdialog.h>
+#include <tqpixmap.h>
#include <vector>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
@@ -34,23 +34,23 @@ public:
WindowGrabber();
~WindowGrabber();
- static QPixmap grabCurrent( bool includeDecorations = true );
+ static TQPixmap grabCurrent( bool includeDecorations = true );
signals:
- void windowGrabbed( const QPixmap & );
+ void windowGrabbed( const TQPixmap & );
protected:
- void mousePressEvent( QMouseEvent * );
- void mouseReleaseEvent( QMouseEvent * );
- void mouseMoveEvent( QMouseEvent * );
- void wheelEvent( QWheelEvent * );
+ void mousePressEvent( TQMouseEvent * );
+ void mouseReleaseEvent( TQMouseEvent * );
+ void mouseMoveEvent( TQMouseEvent * );
+ void wheelEvent( TQWheelEvent * );
private:
void drawBorder();
- void increaseScope( const QPoint & );
- void decreaseScope( const QPoint & );
- int windowIndex( const QPoint & ) const;
- std::vector<QRect> windows;
+ void increaseScope( const TQPoint & );
+ void decreaseScope( const TQPoint & );
+ int windowIndex( const TQPoint & ) const;
+ std::vector<TQRect> windows;
int current;
int yPos;
};