summaryrefslogtreecommitdiffstats
path: root/katapult/common/imagedisplay.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-28 18:03:09 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-28 18:03:09 +0000
commit98d15d90b6a83e2df32d678013847e18b8a8c7e8 (patch)
tree02a588c0979fe1a40ae6216d1f831bb24de91a9f /katapult/common/imagedisplay.cpp
parente0974f69b7603e3d8f2d936301e05535af25346e (diff)
downloadkatapult-98d15d90b6a83e2df32d678013847e18b8a8c7e8.tar.gz
katapult-98d15d90b6a83e2df32d678013847e18b8a8c7e8.zip
TQt4 port Katapult
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/katapult@1233929 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'katapult/common/imagedisplay.cpp')
-rw-r--r--katapult/common/imagedisplay.cpp100
1 files changed, 50 insertions, 50 deletions
diff --git a/katapult/common/imagedisplay.cpp b/katapult/common/imagedisplay.cpp
index 7832198..370598f 100644
--- a/katapult/common/imagedisplay.cpp
+++ b/katapult/common/imagedisplay.cpp
@@ -30,13 +30,13 @@
#include <kfontcombo.h>
#include <klocale.h>
-#include <qpainter.h>
-#include <qapplication.h>
-#include <qimage.h>
-#include <qbitmap.h>
-#include <qslider.h>
-#include <qspinbox.h>
-#include <qcursor.h>
+#include <tqpainter.h>
+#include <tqapplication.h>
+#include <tqimage.h>
+#include <tqbitmap.h>
+#include <tqslider.h>
+#include <tqspinbox.h>
+#include <tqcursor.h>
#include <status.h>
@@ -46,12 +46,12 @@
#define FADEINTERVAL 20
#define FADECONST 2000
-ImageDisplay::ImageDisplay(QObject *, const char *name, const QStringList&)
+ImageDisplay::ImageDisplay(TQObject *, const char *name, const TQStringList&)
: KatapultDisplay(name, WType_TopLevel | WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop | WNoAutoErase | WDestructiveClose)
{
KWin::setType(winId(), NET::Dock);
setBackgroundMode(NoBackground);
- setFocusPolicy(QWidget::StrongFocus);
+ setFocusPolicy(TQ_StrongFocus);
singlebg = 0;
doublebg = 0;
@@ -73,10 +73,10 @@ ImageDisplay::ImageDisplay(QObject *, const char *name, const QStringList&)
fadeImg = 0;
alpha = 0;
- fadeTimer = new QTimer(this);
- connect(fadeTimer, SIGNAL(timeout()), this, SLOT(continueFade()));
+ fadeTimer = new TQTimer(this);
+ connect(fadeTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(continueFade()));
- desktopSize = qApp->desktop()->availableGeometry(QCursor::pos());
+ desktopSize = tqApp->desktop()->availableGeometry(TQCursor::pos());
fadeTime = 250;
updateFadeStep();
@@ -129,7 +129,7 @@ void ImageDisplay::continueFade()
update();
}
-void ImageDisplay::showEvent(QShowEvent *)
+void ImageDisplay::showEvent(TQShowEvent *)
{
// set back the display-size, because if it wouldn't be done this could be a problem-source.
displaySize = 0;
@@ -139,8 +139,8 @@ void ImageDisplay::showEvent(QShowEvent *)
if(bgDbl != 0)
delete bgDbl;
- bgSngl = new QPixmap(QPixmap::grabWindow(qt_xrootwin(), (desktopSize.width() - singlesize[0])/2 + desktopSize.left(), (desktopSize.height() - singlesize[1])/2 + desktopSize.top(), singlesize[0], singlesize[1]));
- bgDbl = new QPixmap(QPixmap::grabWindow(qt_xrootwin(), (desktopSize.width() - doublesize[0])/2 + desktopSize.left(), (desktopSize.height() - doublesize[1])/2 + desktopSize.top(), doublesize[0], doublesize[1]));
+ bgSngl = new TQPixmap(TQPixmap::grabWindow(qt_xrootwin(), (desktopSize.width() - singlesize[0])/2 + desktopSize.left(), (desktopSize.height() - singlesize[1])/2 + desktopSize.top(), singlesize[0], singlesize[1]));
+ bgDbl = new TQPixmap(TQPixmap::grabWindow(qt_xrootwin(), (desktopSize.width() - doublesize[0])/2 + desktopSize.left(), (desktopSize.height() - doublesize[1])/2 + desktopSize.top(), doublesize[0], doublesize[1]));
if(fadeImg != 0)
delete fadeImg;
@@ -151,7 +151,7 @@ void ImageDisplay::showEvent(QShowEvent *)
} else {
fadeOut = false;
alpha = 0;
- fadeImg = new QImage(getDisplay().convertToImage());
+ fadeImg = new TQImage(getDisplay().convertToImage());
fadeTimer->start(FADEINTERVAL, FALSE);
}
}
@@ -169,23 +169,23 @@ void ImageDisplay::hide()
} else {
if(fadeImg != 0)
delete fadeImg;
- fadeImg = new QImage(getDisplay().convertToImage());
+ fadeImg = new TQImage(getDisplay().convertToImage());
fadeOut = TRUE;
if(!fadeTimer->isActive())
fadeTimer->start(FADEINTERVAL, FALSE);
}
}
-void ImageDisplay::drawText(QPixmap & pixmap, int x, int width, QString text, int hilight) const
+void ImageDisplay::drawText(TQPixmap & pixmap, int x, int width, TQString text, int hilight) const
{
int fontSize = maxFontSize;
- QFont font(fontFace, fontSize);
- QFontMetrics metrics(font);
+ TQFont font(fontFace, fontSize);
+ TQFontMetrics metrics(font);
while(fontSize > minFontSize && metrics.width(text) > width) {
fontSize--;
font.setPointSize(fontSize);
- metrics = QFontMetrics(font);
+ metrics = TQFontMetrics(font);
}
while(hilight > 1 && metrics.width(text) > width) {
@@ -200,33 +200,33 @@ void ImageDisplay::drawText(QPixmap & pixmap, int x, int width, QString text, in
}
text = text.left(useChars);
- QString hilighted = text.left(hilight);
- QString remaining = text.right(text.length() - hilighted.length());
+ TQString hilighted = text.left(hilight);
+ TQString remaining = text.right(text.length() - hilighted.length());
x += (width-metrics.width(text))/2;
- QPainter painter(&pixmap);
+ TQPainter painter(&pixmap);
painter.setFont(font);
- painter.setPen(colorGroup().color(QColorGroup::Link));
+ painter.setPen(tqcolorGroup().color(TQColorGroup::Link));
painter.drawText(x, singlesize[1]-offset[3], hilighted);
- painter.setPen(QColor(255, 255, 255));
+ painter.setPen(TQColor(255, 255, 255));
painter.drawText(x+metrics.width(hilighted), singlesize[1]-offset[3], remaining);
}
-QPixmap ImageDisplay::getDisplay()
+TQPixmap ImageDisplay::getDisplay()
{
if(status() & S_HasResults)
{
// show best match
- QPixmap pixmap(*bgDbl);
- QPainter painter(&pixmap);
+ TQPixmap pixmap(*bgDbl);
+ TQPainter painter(&pixmap);
painter.drawPixmap(0, 0, *doublebg);
- QFontMetrics metrics = painter.fontMetrics();
- QRect bounds;
- QPixmap icon;
+ TQFontMetrics metrics = painter.fontMetrics();
+ TQRect bounds;
+ TQPixmap icon;
int itemSpace = (doublesize[0]-offset[0]-offset[2]-padding)/2;
@@ -257,13 +257,13 @@ QPixmap ImageDisplay::getDisplay()
return pixmap;
} else {
// show splash or error
- QPixmap pixmap(*bgSngl);
- QPainter painter(&pixmap);
+ TQPixmap pixmap(*bgSngl);
+ TQPainter painter(&pixmap);
painter.drawPixmap(0, 0, *singlebg);
- QString label;
- QPixmap icon;
+ TQString label;
+ TQPixmap icon;
if(status() & S_Active)
{
@@ -278,7 +278,7 @@ QPixmap ImageDisplay::getDisplay()
label = "Katapult";
else {
label = query();
- painter.setPen(QColor(16, 48, 254));
+ painter.setPen(TQColor(16, 48, 254));
}
}
@@ -287,7 +287,7 @@ QPixmap ImageDisplay::getDisplay()
drawText(pixmap, offset[0], singlesize[0]-offset[0]-offset[2], label, 0);
/* painter.drawText(offset[0], singlesize[1]-offset[3]-30, singlesize[0]-offset[0]-offset[2], 30,
- Qt::AlignHCenter | Qt::AlignBottom | Qt::SingleLine, label);*/
+ TQt::AlignHCenter | TQt::AlignBottom | TQt::SingleLine, label);*/
painter.end();
if(displaySize != 1)
@@ -311,7 +311,7 @@ void ImageDisplay::placeWindow(int size)
}
}
-void ImageDisplay::paintEvent(QPaintEvent *)
+void ImageDisplay::paintEvent(TQPaintEvent *)
{
if(alpha == 0)
{
@@ -320,7 +320,7 @@ void ImageDisplay::paintEvent(QPaintEvent *)
else
bitBlt(this, 0, 0, bgSngl);
} else if(fadeImg != 0) {
- QImage buffer;
+ TQImage buffer;
if(displaySize == 2)
buffer = bgDbl->convertToImage();
else
@@ -329,17 +329,17 @@ void ImageDisplay::paintEvent(QPaintEvent *)
KImageEffect::blend(*fadeImg, buffer, (float)alpha/100);
bitBlt(this, 0, 0, &buffer);
} else {
- QPixmap pixmap = getDisplay();
+ TQPixmap pixmap = getDisplay();
bitBlt(this, 0, 0, &pixmap);
}
}
-void ImageDisplay::setSingleBG(QPixmap *singlebg)
+void ImageDisplay::setSingleBG(TQPixmap *singlebg)
{
this->singlebg = singlebg;
}
-void ImageDisplay::setDoubleBG(QPixmap *doublebg)
+void ImageDisplay::setDoubleBG(TQPixmap *doublebg)
{
this->doublebg = doublebg;
}
@@ -389,7 +389,7 @@ void ImageDisplay::readSettings(KConfigBase *config)
fadeTime = config->readUnsignedNumEntry("FadeTime", 250);
updateFadeStep();
// fadeStep = fadeTime/FADEINTERVAL;
- QFont defaultFont = KGlobalSettings::generalFont();
+ TQFont defaultFont = KGlobalSettings::generalFont();
fontFace = config->readEntry("FontFace", defaultFont.family());
minFontSize = config->readUnsignedNumEntry("MinFontSize", 7);
maxFontSize = config->readUnsignedNumEntry("MaxFontSize", 14);
@@ -403,26 +403,26 @@ void ImageDisplay::writeSettings(KConfigBase *config)
config->writeEntry("MaxFontSize", maxFontSize);
}
-QWidget * ImageDisplay::configure()
+TQWidget * ImageDisplay::configure()
{
ImageDisplaySettings *settings = new ImageDisplaySettings();
settings->fadeTime->setValue(fadeTime);
- connect(settings->fadeTime, SIGNAL(valueChanged(int)), this, SLOT(setFadeOut(int)));
+ connect(settings->fadeTime, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(setFadeOut(int)));
settings->displayFont->setCurrentFont(fontFace);
- connect(settings->displayFont, SIGNAL(textChanged(const QString &)), this, SLOT(setFont(const QString &)));
+ connect(settings->displayFont, TQT_SIGNAL(textChanged(const TQString &)), this, TQT_SLOT(setFont(const TQString &)));
settings->minFontSize->setValue(minFontSize);
- connect(settings->minFontSize, SIGNAL(valueChanged(int)), this, SLOT(setMinFontSize(int)));
+ connect(settings->minFontSize, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(setMinFontSize(int)));
settings->maxFontSize->setValue(maxFontSize);
- connect(settings->maxFontSize, SIGNAL(valueChanged(int)), this, SLOT(setMaxFontSize(int)));
+ connect(settings->maxFontSize, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(setMaxFontSize(int)));
return settings;
}
-void ImageDisplay::setFont(const QString &font)
+void ImageDisplay::setFont(const TQString &font)
{
fontFace = font;
}