diff options
Diffstat (limited to 'ksnapshot')
-rw-r--r-- | ksnapshot/ksnapshot.cpp | 64 | ||||
-rw-r--r-- | ksnapshot/ksnapshot.h | 24 | ||||
-rw-r--r-- | ksnapshot/ksnapshotwidget.ui | 38 | ||||
-rw-r--r-- | ksnapshot/ksnapshotwidget.ui.h | 8 | ||||
-rw-r--r-- | ksnapshot/regiongrabber.cpp | 22 | ||||
-rw-r--r-- | ksnapshot/regiongrabber.h | 7 | ||||
-rw-r--r-- | ksnapshot/windowgrabber.cpp | 98 | ||||
-rw-r--r-- | ksnapshot/windowgrabber.h | 3 |
8 files changed, 134 insertions, 130 deletions
diff --git a/ksnapshot/ksnapshot.cpp b/ksnapshot/ksnapshot.cpp index f8ad1977..c32e983b 100644 --- a/ksnapshot/ksnapshot.cpp +++ b/ksnapshot/ksnapshot.cpp @@ -58,9 +58,9 @@ #define kApp KApplication::kApplication() -KSnapshot::KSnapshot(TQWidget *parent, const char *name, bool grabCurrent) +KSnapshot::KSnapshot(TQWidget *tqparent, const char *name, bool grabCurrent) : DCOPObject("interface"), - KDialogBase(parent, name, true, TQString::null, Help|User1, User1, + KDialogBase(tqparent, name, true, TQString(), Help|User1, User1, true, KStdGuiItem::quit() ) { grabber = new TQWidget( 0, 0, WStyle_Customize | WX11BypassWM ); @@ -106,9 +106,9 @@ KSnapshot::KSnapshot(TQWidget *parent, const char *name, bool grabCurrent) autoincFilename(); } - 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() ) ); + 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() ) ); KHelpMenu *helpMenu = new KHelpMenu(this, KGlobal::instance()->aboutData(), false); @@ -116,24 +116,24 @@ KSnapshot::KSnapshot(TQWidget *parent, const char *name, bool grabCurrent) helpButton->setPopup(helpMenu->menu()); KAccel* accel = new KAccel(this); - accel->insert(KStdAccel::Quit, kapp, TQT_SLOT(quit())); + accel->insert(KStdAccel::Quit, TQT_TQOBJECT(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, TQT_SLOT(slotSave())); - accel->insert(KStdAccel::Save, this, TQT_SLOT(slotSaveAs())); -// accel->insert(KShortcut(CTRL+Key_A), this, TQT_SLOT(slotSaveAs())); + CTRL+SHIFT+Key_S, TQT_TQOBJECT(this), TQT_SLOT(slotSave())); + accel->insert(KStdAccel::Save, TQT_TQOBJECT(this), TQT_SLOT(slotSaveAs())); +// accel->insert(KShortcut(CTRL+Key_A), TQT_TQOBJECT(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, 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())); + CTRL+Key_A, TQT_TQOBJECT(this), TQT_SLOT(slotSaveAs())); + accel->insert(KStdAccel::Print, TQT_TQOBJECT(this), TQT_SLOT(slotPrint())); + accel->insert(KStdAccel::New, TQT_TQOBJECT(this), TQT_SLOT(slotGrab())); + accel->insert(KStdAccel::Copy, TQT_TQOBJECT(this), TQT_SLOT(slotCopy())); - 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())); + 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())); setEscapeButton( User1 ); connect( this, TQT_SIGNAL( user1Clicked() ), TQT_SLOT( reject() ) ); @@ -162,7 +162,7 @@ bool KSnapshot::save( const KURL& url ) { if ( KIO::NetAccess::exists( url, false, this ) ) { const TQString title = i18n( "File Exists" ); - const TQString text = i18n( "<qt>Do you really want to overwrite <b>%1</b>?</qt>" ).arg(url.prettyURL()); + const TQString text = i18n( "<qt>Do you really want to overwrite <b>%1</b>?</qt>" ).tqarg(url.prettyURL()); if (KMessageBox::Continue != KMessageBox::warningContinueCancel( this, text, title, i18n("Overwrite") ) ) { return false; @@ -199,7 +199,7 @@ bool KSnapshot::save( const KURL& url ) TQString caption = i18n("Unable to save image"); TQString text = i18n("KSnapshot was unable to save the image to\n%1.") - .arg(url.prettyURL()); + .tqarg(url.prettyURL()); KMessageBox::error(this, text, caption); } @@ -241,7 +241,7 @@ void KSnapshot::slotSaveAs() void KSnapshot::slotCopy() { - QClipboard *cb = TQApplication::clipboard(); + TQClipboard *cb = TQApplication::tqclipboard(); cb->setPixmap( snapshot ); } @@ -279,11 +279,11 @@ void KSnapshot::slotPrint() else printer.setOrientation(KPrinter::Portrait); - qApp->processEvents(); + tqApp->processEvents(); if (printer.setup(this, i18n("Print Screenshot"))) { - qApp->processEvents(); + tqApp->processEvents(); TQPainter painter(&printer); TQPaintDeviceMetrics metrics(painter.device()); @@ -300,7 +300,7 @@ void KSnapshot::slotPrint() if ( scale ) { TQImage img = snapshot.convertToImage(); - qApp->processEvents(); + tqApp->processEvents(); float newh, neww; if ( dw > dh ) { @@ -312,8 +312,8 @@ void KSnapshot::slotPrint() neww = newh/h*w; } - img = img.smoothScale( int(neww), int(newh), TQImage::ScaleMin ); - qApp->processEvents(); + img = img.smoothScale( int(neww), int(newh), TQ_ScaleMin ); + tqApp->processEvents(); int x = (metrics.width()-img.width())/2; int y = (metrics.height()-img.height())/2; @@ -327,7 +327,7 @@ void KSnapshot::slotPrint() } } - qApp->processEvents(); + tqApp->processEvents(); } void KSnapshot::slotRegionGrabbed( const TQPixmap &pix ) @@ -367,18 +367,18 @@ void KSnapshot::closeEvent( TQCloseEvent * e ) conf->writeEntry("mode",mainWidget->mode()); conf->writeEntry("includeDecorations",mainWidget->includeDecorations()); KURL url = filename; - url.setPass( TQString::null ); + url.setPass( TQString() ); conf->writePathEntry("filename",url.url()); e->accept(); } bool KSnapshot::eventFilter( TQObject* o, TQEvent* e) { - if ( o == grabber && e->type() == TQEvent::MouseButtonPress ) { + if ( TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(grabber) && e->type() == TQEvent::MouseButtonPress ) { TQMouseEvent* me = (TQMouseEvent*) e; if ( TQWidget::mouseGrabber() != grabber ) return false; - if ( me->button() == LeftButton ) + if ( me->button() == Qt::LeftButton ) performGrab(); } return false; @@ -400,11 +400,11 @@ void KSnapshot::autoincFilename() TQString numAsStr= name.mid(start, len); TQString number = TQString::number(numAsStr.toInt() + 1); number = number.rightJustify( len, '0'); - name.replace(start, len, number ); + name.tqreplace(start, len, number ); } else { // no number - start = name.findRev('.'); + start = name.tqfindRev('.'); if (start != -1) { // has a . somewhere, e.g. it has an extension name.insert(start, '1'); diff --git a/ksnapshot/ksnapshot.h b/ksnapshot/ksnapshot.h index 81dadd6d..99f0d8c1 100644 --- a/ksnapshot/ksnapshot.h +++ b/ksnapshot/ksnapshot.h @@ -20,16 +20,17 @@ class RegionGrabber; class KSnapshotWidget; -class KSnapshotPreview : public QLabel +class KSnapshotPreview : public TQLabel { Q_OBJECT + TQ_OBJECT public: - KSnapshotPreview(TQWidget *parent, const char *name = 0) - : TQLabel(parent, name) + KSnapshotPreview(TQWidget *tqparent, const char *name = 0) + : TQLabel(tqparent, name) { - setAlignment(AlignHCenter | AlignVCenter); - setCursor(TQCursor(Qt::PointingHandCursor)); + tqsetAlignment(AlignHCenter | AlignVCenter); + setCursor(TQCursor(TQt::PointingHandCursor)); } virtual ~KSnapshotPreview() {} @@ -39,18 +40,18 @@ class KSnapshotPreview : public QLabel // does unexpected things when painting directly onto the pixmap TQPixmap pixmap(pm); TQPixmap handle(15, 15); - TQBitmap mask(15, 15, true); + TQBitmap tqmask(15, 15, true); { - TQPainter p(&mask); - style().drawPrimitive(TQStyle::PE_SizeGrip, &p, TQRect(0, 0, 15, 15), palette().active()); + TQPainter p(&tqmask); + tqstyle().tqdrawPrimitive(TQStyle::PE_SizeGrip, &p, TQRect(0, 0, 15, 15), tqpalette().active()); p.end(); - handle.setMask(mask); + handle.setMask(tqmask); } { TQPainter p(&handle); - style().drawPrimitive(TQStyle::PE_SizeGrip, &p, TQRect(0, 0, 15, 15), palette().active()); + tqstyle().tqdrawPrimitive(TQStyle::PE_SizeGrip, &p, TQRect(0, 0, 15, 15), tqpalette().active()); p.end(); } @@ -91,9 +92,10 @@ class KSnapshotPreview : public QLabel class KSnapshot : public KDialogBase, virtual public KSnapshotIface { Q_OBJECT + TQ_OBJECT public: - KSnapshot(TQWidget *parent= 0, const char *name= 0, bool grabCurrent=false); + KSnapshot(TQWidget *tqparent= 0, const char *name= 0, bool grabCurrent=false); ~KSnapshot(); enum CaptureMode { FullScreen=0, WindowUnderCursor=1, Region=2, ChildWindow=3 }; diff --git a/ksnapshot/ksnapshotwidget.ui b/ksnapshot/ksnapshotwidget.ui index 88efce1a..41fc9146 100644 --- a/ksnapshot/ksnapshotwidget.ui +++ b/ksnapshot/ksnapshotwidget.ui @@ -1,6 +1,6 @@ <!DOCTYPE UI><UI version="3.3" stdsetdef="1"> <class>KSnapshotWidget</class> -<widget class="QWidget"> +<widget class="TQWidget"> <property name="name"> <cstring>KSnapshotWidget</cstring> </property> @@ -23,7 +23,7 @@ <property name="name"> <cstring>lblImage</cstring> </property> - <property name="minimumSize"> + <property name="tqminimumSize"> <size> <width>200</width> <height>130</height> @@ -51,7 +51,7 @@ You can also copy the image to the clipboard by pressing Ctrl+C.</string> <enum>Horizontal</enum> </property> </widget> - <widget class="QSpinBox" row="3" column="1"> + <widget class="TQSpinBox" row="3" column="1"> <property name="name"> <cstring>spinDelay</cstring> </property> @@ -75,7 +75,7 @@ If <i>no delay</i> is set, the program will wait for a mouse click b </qt></string> </property> </widget> - <widget class="QLabel" row="3" column="0"> + <widget class="TQLabel" row="3" column="0"> <property name="name"> <cstring>lblDelay</cstring> </property> @@ -86,7 +86,7 @@ If <i>no delay</i> is set, the program will wait for a mouse click b <cstring>spinDelay</cstring> </property> </widget> - <widget class="QLabel" row="2" column="0"> + <widget class="TQLabel" row="2" column="0"> <property name="name"> <cstring>textLabel1</cstring> </property> @@ -107,14 +107,14 @@ If <i>no delay</i> is set, the program will wait for a mouse click b <property name="sizeType"> <enum>Expanding</enum> </property> - <property name="sizeHint"> + <property name="tqsizeHint"> <size> <width>156</width> <height>16</height> </size> </property> </spacer> - <widget class="QCheckBox" row="4" column="0" rowspan="1" colspan="4"> + <widget class="TQCheckBox" row="4" column="0" rowspan="1" colspan="4"> <property name="name"> <cstring>cbIncludeDecorations</cstring> </property> @@ -128,7 +128,7 @@ If <i>no delay</i> is set, the program will wait for a mouse click b <string>When enabled, snapshot of a window will also include the window decorations</string> </property> </widget> - <widget class="QComboBox" row="2" column="1" rowspan="1" colspan="3"> + <widget class="TQComboBox" row="2" column="1" rowspan="1" colspan="3"> <item> <property name="text"> <string>Full Screen</string> @@ -161,9 +161,9 @@ If <i>no delay</i> is set, the program will wait for a mouse click b <b>Section of Window</b> - captures only a section of the window. When taking a new snapshot in this mode you will be able to select any child window by moving the mouse over it.</p></qt></string> </property> </widget> - <widget class="QLayoutWidget" row="0" column="3"> + <widget class="TQLayoutWidget" row="0" column="3"> <property name="name"> - <cstring>layout1</cstring> + <cstring>tqlayout1</cstring> </property> <vbox> <property name="name"> @@ -193,7 +193,7 @@ If <i>no delay</i> is set, the program will wait for a mouse click b <property name="sizeType"> <enum>Expanding</enum> </property> - <property name="sizeHint"> + <property name="tqsizeHint"> <size> <width>16</width> <height>16</height> @@ -323,14 +323,14 @@ If <i>no delay</i> is set, the program will wait for a mouse click b <include location="global" impldecl="in implementation">kglobalsettings.h</include> <include location="local" impldecl="in implementation">ksnapshotwidget.ui.h</include> </includes> -<signals> +<Q_SIGNALS> <signal>newClicked()</signal> <signal>saveClicked()</signal> <signal>copyClicked()</signal> <signal>printClicked()</signal> <signal>startImageDrag()</signal> -</signals> -<slots> +</Q_SIGNALS> +<Q_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> @@ -339,20 +339,20 @@ If <i>no delay</i> is set, the program will wait for a mouse click b <slot access="protected" specifier="non virtual">slotStartDrag()</slot> <slot specifier="non virtual" returnType="int">previewWidth()</slot> <slot specifier="non virtual" returnType="int">previewHeight()</slot> -</slots> +</Q_SLOTS> <functions> - <function specifier="non virtual">setPreview( const QPixmap & pm )</function> + <function specifier="non virtual">setPreview( const TQPixmap & pm )</function> <function specifier="non virtual">setDelay( int i )</function> <function specifier="non virtual">setIncludeDecorations( bool b )</function> <function specifier="non virtual">setMode( int mode )</function> <function specifier="non virtual" returnType="int">delay()</function> <function specifier="non virtual" returnType="bool">includeDecorations()</function> <function specifier="non virtual" returnType="int">mode()</function> - <function specifier="non virtual" returnType="QPixmap">preview()</function> + <function specifier="non virtual" returnType="TQPixmap">preview()</function> </functions> <pixmapfunction>SmallIconSet</pixmapfunction> -<layoutdefaults spacing="6" margin="11"/> -<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +<tqlayoutdefaults spacing="6" margin="11"/> +<tqlayoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> <includehints> <includehint>kpushbutton.h</includehint> <includehint>kpushbutton.h</includehint> diff --git a/ksnapshot/ksnapshotwidget.ui.h b/ksnapshot/ksnapshotwidget.ui.h index ab811bf2..601b624f 100644 --- a/ksnapshot/ksnapshotwidget.ui.h +++ b/ksnapshot/ksnapshotwidget.ui.h @@ -2,7 +2,7 @@ ** ui.h extension file, included from the uic-generated form implementation. ** ** If you wish to add, delete or rename functions or slots use -** Qt Designer which will update this file, preserving your code. Create an +** TQt Designer which will update this file, preserving your code. Create an ** init() function in place of a constructor, and a destroy() function in ** place of a destructor. *****************************************************************************/ @@ -39,15 +39,15 @@ void KSnapshotWidget::setPreview( const TQPixmap &pm ) if ( r1 * previewWidth() < previewHeight() ) img = img.smoothScale( previewWidth(), int( previewWidth() * r1 ), - TQImage::ScaleMin ); + TQ_ScaleMin ); else img = img.smoothScale( ( int ) ( ( ( double )previewHeight() ) / r1 ), - previewHeight(), TQImage::ScaleMin ); + previewHeight(), TQ_ScaleMin ); TQToolTip::remove( lblImage ); TQToolTip::add( lblImage, TQString( "Preview of the snapshot image (%1 x %2)" ) - .arg( pm.width() ).arg( pm.height() ) ); + .tqarg( pm.width() ).tqarg( pm.height() ) ); lblImage->setPixmap( img ); lblImage->adjustSize(); diff --git a/ksnapshot/regiongrabber.cpp b/ksnapshot/regiongrabber.cpp index 3522b74b..ede99aee 100644 --- a/ksnapshot/regiongrabber.cpp +++ b/ksnapshot/regiongrabber.cpp @@ -28,8 +28,8 @@ #include <kglobalsettings.h> -SizeTip::SizeTip( TQWidget *parent, const char *name ) - : TQLabel( parent, name, WStyle_Customize | WX11BypassWM | +SizeTip::SizeTip( TQWidget *tqparent, const char *name ) + : TQLabel( tqparent, name, WStyle_Customize | WX11BypassWM | WStyle_StaysOnTop | WStyle_NoBorder | WStyle_Tool ) { setMargin( 2 ); @@ -41,8 +41,8 @@ SizeTip::SizeTip( TQWidget *parent, const char *name ) void SizeTip::setTip( const TQRect &rect ) { - TQString tip = TQString( "%1x%2" ).arg( rect.width() ) - .arg( rect.height() ); + TQString tip = TQString( "%1x%2" ).tqarg( rect.width() ) + .tqarg( rect.height() ); setText( tip ); adjustSize(); @@ -52,7 +52,7 @@ void SizeTip::setTip( const TQRect &rect ) void SizeTip::positionTip( const TQRect &rect ) { - TQRect tipRect = geometry(); + TQRect tipRect = tqgeometry(); tipRect.moveTopLeft( TQPoint( 0, 0 ) ); if ( rect.intersects( tipRect ) ) @@ -60,8 +60,8 @@ void SizeTip::positionTip( const TQRect &rect ) TQRect deskR = KGlobalSettings::desktopGeometry( TQPoint( 0, 0 ) ); tipRect.moveCenter( TQPoint( deskR.width()/2, deskR.height()/2 ) ); - if ( !rect.contains( tipRect, true ) && rect.intersects( tipRect ) ) - tipRect.moveBottomRight( geometry().bottomRight() ); + if ( !rect.tqcontains( tipRect, true ) && rect.intersects( tipRect ) ) + tipRect.moveBottomRight( tqgeometry().bottomRight() ); } move( tipRect.topLeft() ); @@ -92,7 +92,7 @@ void RegionGrabber::initGrabber() TQDesktopWidget desktopWidget; TQRect desktopSize; if ( desktopWidget.isVirtualDesktop() ) - desktopSize = desktopWidget.geometry(); + desktopSize = desktopWidget.tqgeometry(); else desktopSize = desktopWidget.screenGeometry( qt_xrootwin() ); @@ -104,7 +104,7 @@ void RegionGrabber::initGrabber() void RegionGrabber::mousePressEvent( TQMouseEvent *e ) { - if ( e->button() == LeftButton ) + if ( e->button() == Qt::LeftButton ) { mouseDown = true; grabRect = TQRect( e->pos(), e->pos() ); @@ -168,8 +168,8 @@ void RegionGrabber::drawRubber() p.setPen( TQPen( color0, 1 ) ); p.setBrush( NoBrush ); - style().drawPrimitive( TQStyle::PE_FocusRect, &p, grabRect, colorGroup(), - TQStyle::Style_Default, TQStyleOption( colorGroup().base() ) ); + tqstyle().tqdrawPrimitive( TQStyle::PE_FocusRect, &p, grabRect, tqcolorGroup(), + TQStyle::Style_Default, TQStyleOption( tqcolorGroup().base() ) ); p.end(); } diff --git a/ksnapshot/regiongrabber.h b/ksnapshot/regiongrabber.h index 5a9d28b9..1c9f4a3a 100644 --- a/ksnapshot/regiongrabber.h +++ b/ksnapshot/regiongrabber.h @@ -25,19 +25,20 @@ class TQTimer; -class SizeTip : public QLabel +class SizeTip : public TQLabel { public: - SizeTip( TQWidget *parent, const char *name=0 ); + SizeTip( TQWidget *tqparent, const char *name=0 ); ~SizeTip() {} void setTip( const TQRect &rect ); void positionTip( const TQRect &rect ); }; -class RegionGrabber : public QWidget +class RegionGrabber : public TQWidget { Q_OBJECT + TQ_OBJECT public: RegionGrabber(); diff --git a/ksnapshot/windowgrabber.cpp b/ksnapshot/windowgrabber.cpp index 7e556efc..8bf8deee 100644 --- a/ksnapshot/windowgrabber.cpp +++ b/ksnapshot/windowgrabber.cpp @@ -39,7 +39,7 @@ bool operator< ( const TQRect& r1, const TQRect& r2 ) return r1.width() * r1.height() < r2.width() * r2.height(); } -// Recursively iterates over the window w and its children, thereby building +// Recursively iterates over the window w and its tqchildren, thereby building // a tree of window descriptors. Windows in non-viewable state or with height // or width smaller than minSize will be ignored. static @@ -61,16 +61,16 @@ void getWindowsRecursive( std::vector<TQRect>& windows, Window w, windows.push_back( r ); } - Window root, parent; - Window* children; - unsigned int nchildren; + Window root, tqparent; + Window* tqchildren; + unsigned int ntqchildren; - if( XQueryTree( qt_xdisplay(), w, &root, &parent, &children, &nchildren ) != 0 ) { - for( unsigned int i = 0; i < nchildren; ++i ) { - getWindowsRecursive( windows, children[ i ], x, y, depth + 1 ); + if( XQueryTree( qt_xdisplay(), w, &root, &tqparent, &tqchildren, &ntqchildren ) != 0 ) { + for( unsigned int i = 0; i < ntqchildren; ++i ) { + getWindowsRecursive( windows, tqchildren[ i ], x, y, depth + 1 ); } - if( children != NULL ) - XFree( children ); + if( tqchildren != NULL ) + XFree( tqchildren ); } } if ( depth == 0 ) @@ -94,17 +94,17 @@ Window findRealWindow( Window w, int depth = 0 ) if( type != None ) return w; } - Window root, parent; - Window* children; - unsigned int nchildren; + Window root, tqparent; + Window* tqchildren; + unsigned int ntqchildren; Window ret = None; - if( XQueryTree( qt_xdisplay(), w, &root, &parent, &children, &nchildren ) != 0 ) { + if( XQueryTree( qt_xdisplay(), w, &root, &tqparent, &tqchildren, &ntqchildren ) != 0 ) { for( unsigned int i = 0; - i < nchildren && ret == None; + i < ntqchildren && ret == None; ++i ) - ret = findRealWindow( children[ i ], depth + 1 ); - if( children != NULL ) - XFree( children ); + ret = findRealWindow( tqchildren[ i ], depth + 1 ); + if( tqchildren != NULL ) + XFree( tqchildren ); } return ret; } @@ -114,11 +114,11 @@ Window windowUnderCursor( bool includeDecorations = true ) { Window root; Window child; - uint mask; + uint tqmask; int rootX, rootY, winX, winY; XGrabServer( qt_xdisplay() ); XQueryPointer( qt_xdisplay(), qt_xrootwin(), &root, &child, - &rootX, &rootY, &winX, &winY, &mask ); + &rootX, &rootY, &winX, &winY, &tqmask ); if( child == None ) child = qt_xrootwin(); if( !includeDecorations ) { @@ -138,17 +138,17 @@ TQPixmap grabWindow( Window child, int x, int y, uint w, uint h, uint border ) int tmp1, tmp2; //Check whether the extension is available if ( XShapeQueryExtension( qt_xdisplay(), &tmp1, &tmp2 ) ) { - TQBitmap mask( w, h ); - //As the first step, get the mask from XShape. + TQBitmap tqmask( w, h ); + //As the first step, get the tqmask from XShape. int count, order; XRectangle* rects = XShapeGetRectangles( qt_xdisplay(), child, ShapeBounding, &count, &order ); - //The ShapeBounding region is the outermost shape of the window; + //The ShapeBounding region is the outermost tqshape of the window; //ShapeBounding - ShapeClipping is defined to be the border. //Since the border area is part of the window, we use bounding // to limit our work region if (rects) { - //Create a TQRegion from the rectangles describing the bounding mask. + //Create a TQRegion from the rectangles describing the bounding tqmask. TQRegion contents; for ( int pos = 0; pos < count; pos++ ) contents += TQRegion( rects[pos].x, rects[pos].y, @@ -166,18 +166,18 @@ TQPixmap grabWindow( Window child, int x, int y, uint w, uint h, uint border ) contents += TQRegion( w - border, 0, border, h ); } - //Get the masked away area. - TQRegion maskedAway = bbox - contents; - TQMemArray<TQRect> maskedAwayRects = maskedAway.rects(); + //Get the tqmasked away area. + TQRegion tqmaskedAway = bbox - contents; + TQMemArray<TQRect> tqmaskedAwayRects = tqmaskedAway.tqrects(); - //Construct a bitmap mask from the rectangles - 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); + //Construct a bitmap tqmask from the rectangles + TQPainter p(&tqmask); + p.fillRect(0, 0, w, h, TQt::color1); + for (uint pos = 0; pos < tqmaskedAwayRects.count(); pos++) + p.fillRect(tqmaskedAwayRects[pos], TQt::color0); p.end(); - pm.setMask(mask); + pm.setMask(tqmask); } } #endif @@ -186,8 +186,8 @@ TQPixmap grabWindow( Window child, int x, int y, uint w, uint h, uint border ) } WindowGrabber::WindowGrabber() -: TQDialog( 0, 0, true, Qt::WStyle_Customize | Qt::WStyle_NoBorder | - Qt::WStyle_StaysOnTop | Qt::WX11BypassWM ), +: TQDialog( 0, 0, true, TQt::WStyle_Customize | TQt::WStyle_NoBorder | + TQt::WStyle_StaysOnTop | TQt::WX11BypassWM ), current( -1 ), yPos( -1 ) { Window root; @@ -218,16 +218,16 @@ TQPixmap WindowGrabber::grabCurrent( bool includeDecorations ) XGrabServer( qt_xdisplay() ); Window child = windowUnderCursor( includeDecorations ); XGetGeometry( qt_xdisplay(), child, &root, &x, &y, &w, &h, &border, &depth ); - Window parent; - Window* children; - unsigned int nchildren; - if( XQueryTree( qt_xdisplay(), child, &root, &parent, - &children, &nchildren ) != 0 ) { - if( children != NULL ) - XFree( children ); + Window tqparent; + Window* tqchildren; + unsigned int ntqchildren; + if( XQueryTree( qt_xdisplay(), child, &root, &tqparent, + &tqchildren, &ntqchildren ) != 0 ) { + if( tqchildren != NULL ) + XFree( tqchildren ); int newx, newy; Window dummy; - if( XTranslateCoordinates( qt_xdisplay(), parent, qt_xrootwin(), + if( XTranslateCoordinates( qt_xdisplay(), tqparent, qt_xrootwin(), x, y, &newx, &newy, &dummy )) { x = newx; y = newy; @@ -240,7 +240,7 @@ TQPixmap WindowGrabber::grabCurrent( bool includeDecorations ) void WindowGrabber::mousePressEvent( TQMouseEvent *e ) { - if ( e->button() == TQMouseEvent::RightButton ) + if ( e->button() == Qt::RightButton ) yPos = e->globalY(); else { TQPixmap pm; @@ -258,7 +258,7 @@ void WindowGrabber::mousePressEvent( TQMouseEvent *e ) void WindowGrabber::mouseReleaseEvent( TQMouseEvent *e ) { - if ( e->button() == TQMouseEvent::RightButton ) + if ( e->button() == Qt::RightButton ) yPos = -1; } @@ -303,7 +303,7 @@ void WindowGrabber::wheelEvent( TQWheelEvent *e ) void WindowGrabber::increaseScope( const TQPoint &pos ) { for ( uint i = current + 1; i < windows.size(); i++ ) { - if ( windows[ i ].contains( pos ) ) { + if ( windows[ i ].tqcontains( pos ) ) { current = i; break; } @@ -317,7 +317,7 @@ void WindowGrabber::increaseScope( const TQPoint &pos ) void WindowGrabber::decreaseScope( const TQPoint &pos ) { for ( int i = current - 1; i >= 0; i-- ) { - if ( windows[ i ].contains( pos ) ) { + if ( windows[ i ].tqcontains( pos ) ) { current = i; break; } @@ -330,7 +330,7 @@ void WindowGrabber::decreaseScope( const TQPoint &pos ) int WindowGrabber::windowIndex( const TQPoint &pos ) const { for ( uint i = 0; i < windows.size(); i++ ) { - if ( windows[ i ].contains( pos ) ) + if ( windows[ i ].tqcontains( pos ) ) return i; } return -1; @@ -339,12 +339,12 @@ int WindowGrabber::windowIndex( const TQPoint &pos ) const // Draws a border around the (child) window currently containing the pointer void WindowGrabber::drawBorder() { - repaint(); + tqrepaint(); if ( current >= 0 ) { TQPainter p; p.begin( this ); - p.setPen( TQPen( Qt::red, 3 ) ); + p.setPen( TQPen( TQt::red, 3 ) ); p.drawRect( windows[ current ] ); p.end(); } diff --git a/ksnapshot/windowgrabber.h b/ksnapshot/windowgrabber.h index d6a56d6c..dd071f70 100644 --- a/ksnapshot/windowgrabber.h +++ b/ksnapshot/windowgrabber.h @@ -26,9 +26,10 @@ #include <X11/Xlib.h> #include <X11/Xatom.h> -class WindowGrabber : public QDialog +class WindowGrabber : public TQDialog { Q_OBJECT + TQ_OBJECT public: WindowGrabber(); |