summaryrefslogtreecommitdiffstats
path: root/src/kiconcanvas.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-17 08:20:48 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-17 08:20:48 +0000
commitaa0726b20f398264f0a2abc60215be044b106f9c (patch)
tree070fdbc19a1106cfdd7f651a8ce76bb1b89a513d /src/kiconcanvas.cpp
parentd3cf5b3e75aadc3b02d0b56f030d4c3f8c2c749d (diff)
downloadbasket-aa0726b20f398264f0a2abc60215be044b106f9c.tar.gz
basket-aa0726b20f398264f0a2abc60215be044b106f9c.zip
TQt4 port basket
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/basket@1232416 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/kiconcanvas.cpp')
-rw-r--r--src/kiconcanvas.cpp84
1 files changed, 42 insertions, 42 deletions
diff --git a/src/kiconcanvas.cpp b/src/kiconcanvas.cpp
index 13ec6ce..77ac537 100644
--- a/src/kiconcanvas.cpp
+++ b/src/kiconcanvas.cpp
@@ -30,12 +30,12 @@
#include <kurldrag.h>
#include <kmultipledrag.h>
-#include <qsortedlist.h>
-#include <qimage.h>
-#include <qpixmap.h>
-#include <qtimer.h>
-#include <qfileinfo.h>
-#include <qdragobject.h>
+#include <tqsortedlist.h>
+#include <tqimage.h>
+#include <tqpixmap.h>
+#include <tqtimer.h>
+#include <tqfileinfo.h>
+#include <tqdragobject.h>
#include <cmath>
#include <math.h>
#include <algorithm>
@@ -45,13 +45,13 @@
#include <svgicons/ksvgiconpainter.h>
#endif
-class KIconCanvasItem : public QIconViewItem
+class KIconCanvasItem : public TQIconViewItem
{
public:
- KIconCanvasItem ( QIconView * parent, const QString & key, const QPixmap & pixmap )
- : QIconViewItem(parent)
+ KIconCanvasItem ( TQIconView * tqparent, const TQString & key, const TQPixmap & pixmap )
+ : TQIconViewItem(tqparent)
{
- setText(QFileInfo(key).baseName());
+ setText(TQFileInfo(key).baseName());
setKey(key);
setPixmap(pixmap);
setDragEnabled(true);
@@ -59,9 +59,9 @@ class KIconCanvasItem : public QIconViewItem
}
- int compare(QIconViewItem *rhs) const
+ int compare(TQIconViewItem *rhs) const
{
- return QString::localeAwareCompare(text().lower(), rhs->text().lower());
+ return TQString::localeAwareCompare(text().lower(), rhs->text().lower());
}
};
@@ -77,7 +77,7 @@ class KIconCanvas::KIconCanvasPrivate
{
}
bool m_bLoading;
- QString mSetCurrent;
+ TQString mSetCurrent;
int mSize;
#ifdef HAVE_LIBART
KSvgIconEngine mSvgEngine;
@@ -89,15 +89,15 @@ class KIconCanvas::KIconCanvasPrivate
* KIconCanvas: Iconview for the iconloader dialog.
*/
-KIconCanvas::KIconCanvas(QWidget *parent, const char *name)
- : KIconView(parent, name)
+KIconCanvas::KIconCanvas(TQWidget *tqparent, const char *name)
+ : KIconView(tqparent, name)
{
d = new KIconCanvasPrivate;
mpLoader = KGlobal::iconLoader();
- mpTimer = new QTimer(this);
- connect(mpTimer, SIGNAL(timeout()), SLOT(slotLoadFiles()));
- connect(this, SIGNAL(currentChanged(QIconViewItem *)),
- SLOT(slotCurrentChanged(QIconViewItem *)));
+ mpTimer = new TQTimer(this);
+ connect(mpTimer, TQT_SIGNAL(timeout()), TQT_SLOT(slotLoadFiles()));
+ connect(this, TQT_SIGNAL(currentChanged(TQIconViewItem *)),
+ TQT_SLOT(slotCurrentChanged(TQIconViewItem *)));
setAcceptDrops(false);
setShowToolTips(true);
setStrictIconSize(false);
@@ -114,12 +114,12 @@ void KIconCanvas::setIconLoader(KIconLoader *loader)
mpLoader = loader;
}
-void KIconCanvas::loadIcon(const QString &name)
+void KIconCanvas::loadIcon(const TQString &name)
{
- QImage img;
- QString path = mpLoader->iconPath(name,-d->mSize);
+ TQImage img;
+ TQString path = mpLoader->iconPath(name,-d->mSize);
// Use the extension as the format. Works for XPM and PNG, but not for SVG
- QString ext = path.right(3).upper();
+ TQString ext = path.right(3).upper();
int maxSize = std::min(d->mSize, 60);
if (ext != "SVG" && ext != "VGZ")
@@ -147,13 +147,13 @@ void KIconCanvas::loadIcon(const QString &name)
img = img.smoothScale(width, maxSize);
}
}
- QPixmap pm;
+ TQPixmap pm;
pm.convertFromImage(img);
(void) new KIconCanvasItem(this, name, pm);
}
-void KIconCanvas::loadFiles(const QStringList& files)
+void KIconCanvas::loadFiles(const TQStringList& files)
{
clear();
mFiles = files;
@@ -165,25 +165,25 @@ void KIconCanvas::loadFiles(const QStringList& files)
void KIconCanvas::slotLoadFiles()
{
setResizeMode(Fixed);
- QApplication::setOverrideCursor(waitCursor);
+ TQApplication::setOverrideCursor(waitCursor);
// disable updates to not trigger paint events when adding child items
setUpdatesEnabled( false );
d->m_bLoading = true;
int count;
- QStringList::ConstIterator it;
- QStringList::ConstIterator end(mFiles.end());
+ TQStringList::ConstIterator it;
+ TQStringList::ConstIterator end(mFiles.end());
for (it=mFiles.begin(), count=0; it!=end; ++it, count++)
{
loadIcon(*it);
// Calling kapp->processEvents() makes the iconview flicker like hell
- // (it's being repainted once for every new item), so we don't do this.
- // Instead, we directly repaint the progress bar without going through
+ // (it's being tqrepainted once for every new item), so we don't do this.
+ // Instead, we directly tqrepaint the progress bar without going through
// the event-loop. We do that just once for every 10th item so that
// the progress bar doesn't flicker in turn. (pfeiffer)
- // FIXME: Qt4 will have double buffering
+ // FIXME: TQt4 will have double buffering
if ( count % 10 == 0) {
emit progress(count);
}
@@ -195,14 +195,14 @@ void KIconCanvas::slotLoadFiles()
sort();
d->m_bLoading = false;
setUpdatesEnabled( true );
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
emit finished();
setResizeMode(Adjust);
}
-QString KIconCanvas::getCurrent() const
+TQString KIconCanvas::getCurrent() const
{
- return currentItem() ? currentItem()->key() : QString::null;
+ return currentItem() ? currentItem()->key() : TQString();
}
void KIconCanvas::stopLoading()
@@ -210,9 +210,9 @@ void KIconCanvas::stopLoading()
d->m_bLoading = false;
}
-void KIconCanvas::slotCurrentChanged(QIconViewItem *item)
+void KIconCanvas::slotCurrentChanged(TQIconViewItem *item)
{
- emit nameChanged((item != 0L) ? item->text() : QString::null);
+ emit nameChanged((item != 0L) ? item->text() : TQString());
}
void KIconCanvas::setGroupOrSize( int groupOrSize )
@@ -227,16 +227,16 @@ void KIconCanvas::setStrictIconSize( bool strictIconSize )
d->mStrictIconSize = strictIconSize;
}
-QDragObject *KIconCanvas::dragObject()
+TQDragObject *KIconCanvas::dragObject()
{
- // We use QImageDrag rather than KURLDrag so that the user can't drag an icon out of the theme!
+ // We use TQImageDrag rather than KURLDrag so that the user can't drag an icon out of the theme!
// TODO: support SVG?
- QPixmap *pixmap = currentItem()->pixmap();
- QPoint pos = viewportToContents( viewport()->mapFromGlobal( QCursor::pos() ) );
- QPoint hot;
+ TQPixmap *pixmap = currentItem()->pixmap();
+ TQPoint pos = viewportToContents( viewport()->mapFromGlobal( TQCursor::pos() ) );
+ TQPoint hot;
hot.setX(pos.x() - currentItem()->pos().x() - (currentItem()->width() - pixmap->width()) / 2);
hot.setY(pos.y() - currentItem()->pos().y() - (currentItem()->height() - pixmap->height()) / 2);
- QImageDrag *drag = new QImageDrag( pixmap->convertToImage(), this );
+ TQImageDrag *drag = new TQImageDrag( pixmap->convertToImage(), this );
drag->setPixmap(*pixmap, hot);
return drag;
}