TQt4 port ksplash-engine-moodin

This enables compilation under both Qt3 and Qt4


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ksplash-engine-moodin@1238987 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 13 years ago
parent 63dc78a1d3
commit a7dcba0bcc

@ -13,22 +13,22 @@
#include <kstandarddirs.h>
#include <kconfig.h>
#include <qfileinfo.h>
#include <qdatetime.h>
#include <qimage.h>
#include <tqfileinfo.h>
#include <tqdatetime.h>
#include <tqimage.h>
#include "cache.h"
/* Disabled Cache (Michael Ummels) */
Cache::Cache(Scaler* scaler, const QString& themeEngine, const QString& theme)
Cache::Cache(Scaler* scaler, const TQString& themeEngine, const TQString& theme)
{
}
QImage* Cache::cacheFile(const QString& file)
TQImage* Cache::cacheFile(const TQString& file)
{
return new QImage(file);
return new TQImage(file);
}
@ -37,18 +37,18 @@ void Cache::createCacheDir()
}
void Cache::writeInfoFile(QString& file)
void Cache::writeInfoFile(TQString& file)
{
}
bool Cache::isInSync(QString& file)
bool Cache::isInSync(TQString& file)
{
return true;
}
QString Cache::getFile(QString file)
TQString Cache::getFile(TQString file)
{
return file;
}

@ -12,30 +12,30 @@
#ifndef CACHE_H
#define CACHE_H
#include <qstring.h>
#include <qsize.h>
#include <qdir.h>
#include <tqstring.h>
#include <tqsize.h>
#include <tqdir.h>
#include "scaler.h"
class Cache
{
private:
QString mTheme;
QString mThemeEngine;
QDir mCacheDir;
TQString mTheme;
TQString mThemeEngine;
TQDir mCacheDir;
Scaler* mScaler;
void createCacheDir();
void writeInfoFile(QString& file);
bool isInSync(QString& file);
void writeInfoFile(TQString& file);
bool isInSync(TQString& file);
QString getFile(QString file);
TQString getFile(TQString file);
public:
Cache(Scaler* scaler, const QString& mThemeEngine, const QString& theme);
QImage* cacheFile(const QString& file);
Cache(Scaler* scaler, const TQString& mThemeEngine, const TQString& theme);
TQImage* cacheFile(const TQString& file);
};
#endif

@ -10,18 +10,18 @@
* *
***************************************************************************/
#include <qwidget.h>
#include <qstyle.h>
#include <qtimer.h>
#include <qpainter.h>
#include <qimage.h>
#include <tqwidget.h>
#include <tqstyle.h>
#include <tqtimer.h>
#include <tqpainter.h>
#include <tqimage.h>
#include "effectwidget.h"
QImage* EffectWidget::bgImage = 0;
TQImage* EffectWidget::bgImage = 0;
EffectWidget::EffectWidget(QWidget* parent, const char* name)
:QWidget(parent, name)
EffectWidget::EffectWidget(TQWidget* tqparent, const char* name)
:TQWidget(tqparent, name)
{
timer = 0;
delayMS = 20;
@ -32,12 +32,12 @@ EffectWidget::EffectWidget(QWidget* parent, const char* name)
beginOpacity = 20.0;
endOpacity = 80.0;
setBackgroundMode(NoBackground);
setBackgroundOrigin(QWidget::ParentOrigin);
setBackgroundOrigin(TQWidget::ParentOrigin);
updateCache();
}
void EffectWidget::setImage(QImage *i)
void EffectWidget::setImage(TQImage *i)
{
image = i;
}
@ -71,8 +71,8 @@ void EffectWidget::start()
if (!timer)
{
timer = new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(timerTick()));
timer = new TQTimer(this);
connect(timer,TQT_SIGNAL(timeout()),this,TQT_SLOT(timerTick()));
}
playing = true;
@ -128,13 +128,13 @@ void EffectWidget::timerTick()
}
void EffectWidget::moveEvent(QMoveEvent *)
void EffectWidget::moveEvent(TQMoveEvent *)
{
updateCache();
}
void EffectWidget::resizeEvent(QResizeEvent *)
void EffectWidget::resizeEvent(TQResizeEvent *)
{
updateCache();
}
@ -145,18 +145,18 @@ void EffectWidget::updateCache()
if (!bgImage)
return;
QPoint pos(mapToParent(QPoint(0, 0)));
TQPoint pos(mapToParent(TQPoint(0, 0)));
background = bgImage->copy(pos.x(), pos.y(), width(), height());
bitBlt(this, 0, 0, &background);
}
void EffectWidget::paintEvent(QPaintEvent *)
void EffectWidget::paintEvent(TQPaintEvent *)
{
if (background.isNull())
return;
QImage upper = image->copy();
QImage lower = background.copy();
TQImage upper = image->copy();
TQImage lower = background.copy();
KImageEffect::blendOnLower(upper, lower, KImageEffect::Centered, (currentStep + 1 == totalSteps) ? 1.0 : endOpacity / float(totalSteps) * float(currentStep) + beginOpacity);
bitBlt(this, 0, 0, &lower);

@ -13,25 +13,26 @@
#ifndef FADEWIDGET_H
#define FADEWIDGET_H
#include <qwidget.h>
#include <qptrlist.h>
#include <qpixmap.h>
#include <qimage.h>
#include <tqwidget.h>
#include <tqptrlist.h>
#include <tqpixmap.h>
#include <tqimage.h>
#include <kimageeffect.h>
class QTimer;
class TQTimer;
class EffectWidget : public QWidget
class EffectWidget : public TQWidget
{
Q_OBJECT
TQ_OBJECT
public:
EffectWidget(QWidget *parent = 0,const char *name = 0);
EffectWidget(TQWidget *tqparent = 0,const char *name = 0);
static void setBackgroundImage(QImage *image) { bgImage = image; }
static void setBackgroundImage(TQImage *image) { bgImage = image; }
void setImage(QImage *i);
void setImage(TQImage *i);
void setDelay(int delayInMS);
void setLoop(bool loop);
void setSteps(int steps);
@ -41,9 +42,9 @@ class EffectWidget : public QWidget
void stop();
void rewind();
void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent *);
void moveEvent(QMoveEvent *);
void paintEvent(TQPaintEvent *);
void resizeEvent(TQResizeEvent *);
void moveEvent(TQMoveEvent *);
void updateCache();
@ -51,11 +52,11 @@ class EffectWidget : public QWidget
void timerTick();
private:
static QImage *bgImage;
static TQImage *bgImage;
QTimer *timer;
QImage *image;
QImage background;
TQTimer *timer;
TQImage *image;
TQImage background;
unsigned int delayMS;
unsigned int currentStep;
unsigned int totalSteps;

@ -9,8 +9,8 @@
* *
***************************************************************************/
#include <qstringlist.h>
#include <qregexp.h>
#include <tqstringlist.h>
#include <tqregexp.h>
#include <klocale.h>
#include <kuser.h>
@ -21,7 +21,7 @@
// This class is still very simple (as most of the classes)
// They get all improved later when "OpenGL Effect Widget" structure is completed
MagicLabel::MagicLabel(QString s, bool translate)
MagicLabel::MagicLabel(TQString s, bool translate)
{
prefix = "ML:";
preUSER = "USER:";
@ -37,7 +37,7 @@ MagicLabel::MagicLabel(QString s, bool translate)
void MagicLabel::transform()
{
if (mValue.contains(prefix + preUSER))
if (mValue.tqcontains(prefix + preUSER))
getUserInfo();
else if (mValue.startsWith(prefix + preCMD))
getCommandOutput();
@ -48,39 +48,39 @@ void MagicLabel::getUserInfo()
{
static KUser user;
if (mValue.contains(prefix + preUSER + "loginname"))
mValue = mValue.replace(prefix + preUSER + "loginname", user.loginName());
else if (mValue.contains(prefix + preUSER + "fullname"))
mValue = mValue.replace(prefix + preUSER + "fullname", user.fullName());
else if (mValue.contains(prefix + preUSER + "homedir"))
mValue = mValue.replace(prefix + preUSER + "homedir", user.homeDir());
if (mValue.tqcontains(prefix + preUSER + "loginname"))
mValue = mValue.tqreplace(prefix + preUSER + "loginname", user.loginName());
else if (mValue.tqcontains(prefix + preUSER + "fullname"))
mValue = mValue.tqreplace(prefix + preUSER + "fullname", user.fullName());
else if (mValue.tqcontains(prefix + preUSER + "homedir"))
mValue = mValue.tqreplace(prefix + preUSER + "homedir", user.homeDir());
}
void MagicLabel::getCommandOutput()
{
QString cmd = QStringList::split(prefix + preCMD, mValue)[0];
QStringList parts = QStringList::split(" ", cmd);
TQString cmd = TQStringList::split(prefix + preCMD, mValue)[0];
TQStringList parts = TQStringList::split(" ", cmd);
KShellProcess *proc = new KShellProcess;
for (int i = 0; i < parts.count(); i++)
*proc << parts[i];
connect(proc, SIGNAL(processExited(KProcess*)), this, SLOT(processExited(KProcess*)));
connect(proc, SIGNAL(receivedStdout(KProcess*, char*, int)), this, SLOT(receivedStdout(KProcess*, char*, int)));
connect(proc, TQT_SIGNAL(processExited(KProcess*)), this, TQT_SLOT(processExited(KProcess*)));
connect(proc, TQT_SIGNAL(receivedStdout(KProcess*, char*, int)), this, TQT_SLOT(receivedStdout(KProcess*, char*, int)));
mValue = "";
if (!proc->start(KProcess::Block, KProcess::Stdout))
KMessageBox::information(0, QString("Could not start process: %1").arg(cmd));
KMessageBox::information(0, TQString("Could not start process: %1").tqarg(cmd));
}
void MagicLabel::receivedStdout(KProcess *proc, char *buffer, int buflen)
{
QString buf = QString::fromLatin1(buffer, buflen);
mValue += buf.replace("\n", "");
TQString buf = TQString::tqfromLatin1(buffer, buflen);
mValue += buf.tqreplace("\n", "");
}

@ -12,20 +12,21 @@
#ifndef MAGICLABEL_H
#define MAGICLABEL_H
#include <qstring.h>
#include <tqstring.h>
#include <kprocess.h>
class MagicLabel : QObject
class MagicLabel : TQObject
{
Q_OBJECT
TQ_OBJECT
private:
QString prefix;
QString preUSER;
QString preCMD;
TQString prefix;
TQString preUSER;
TQString preCMD;
QString mValue;
TQString mValue;
void transform();
void getUserInfo();
@ -36,9 +37,9 @@ class MagicLabel : QObject
void receivedStdout(KProcess *proc, char *buffer, int buflen);
public:
MagicLabel(QString s, bool translate);
MagicLabel(TQString s, bool translate);
inline QString& value() { return mValue; };
inline TQString& value() { return mValue; };
};
#endif

@ -9,27 +9,27 @@
* *
***************************************************************************/
#include <qfontmetrics.h>
#include <tqfontmetrics.h>
#include "scaler.h"
Scaler::Scaler(QSize baseResolution, QSize targetResolution)
Scaler::Scaler(TQSize baseResolution, TQSize targetResolution)
{
mBaseResolution = baseResolution;
mTargetResolution = targetResolution;
}
void Scaler::autoCoords(QPoint* pt, const QFont& f, const QString& s)
void Scaler::autoCoords(TQPoint* pt, const TQFont& f, const TQString& s)
{
QFontMetrics fm(f);
QSize fmSize(fm.size(0L, s));
TQFontMetrics fm(f);
TQSize fmSize(fm.size(0L, s));
autoCoords(pt, fmSize);
}
void Scaler::autoCoords(QPoint* pt, const QSize s)
void Scaler::autoCoords(TQPoint* pt, const TQSize s)
{
scaleCoords(pt);
@ -37,12 +37,12 @@ void Scaler::autoCoords(QPoint* pt, const QSize s)
pt->setX(center(mTargetResolution.width(), s.width()));
else if ((pt->y() == -1) && (pt->x() != -1))
pt->setY(center(mTargetResolution.height(), s.height()));
else if (*pt == QPoint(-1, -1))
*pt = QPoint(center(mTargetResolution.width(), s.width()), center(mTargetResolution.height(), s.height()));
else if (*pt == TQPoint(-1, -1))
*pt = TQPoint(center(mTargetResolution.width(), s.width()), center(mTargetResolution.height(), s.height()));
}
void Scaler::scaleCoords(QPoint* pt)
void Scaler::scaleCoords(TQPoint* pt)
{
if (mBaseResolution == mTargetResolution)
return;
@ -61,7 +61,7 @@ void Scaler::scaleCoords(QPoint* pt)
}
bool Scaler::scaleSize(QImage* i)
bool Scaler::scaleSize(TQImage* i)
{
if ((!i) || !resolutionDiff())
return false;
@ -77,7 +77,7 @@ bool Scaler::scaleSize(QImage* i)
}
bool Scaler::scaleSize(QFont* f)
bool Scaler::scaleSize(TQFont* f)
{
if ((!f) || !resolutionDiff())
return false;

@ -12,27 +12,27 @@
#ifndef SCALER_H
#define SCALER_H
#include <qpoint.h>
#include <qimage.h>
#include <qfont.h>
#include <tqpoint.h>
#include <tqimage.h>
#include <tqfont.h>
class Scaler
{
private:
QSize mBaseResolution;
QSize mTargetResolution;
TQSize mBaseResolution;
TQSize mTargetResolution;
public:
Scaler(QSize baseResolution, QSize targetResolution);
Scaler(TQSize baseResolution, TQSize targetResolution);
const QSize& baseResolution() { return mBaseResolution; };
const QSize& targetResolution() { return mTargetResolution; };
const TQSize& baseResolution() { return mBaseResolution; };
const TQSize& targetResolution() { return mTargetResolution; };
void autoCoords(QPoint* pt, const QFont& f, const QString& s);
void autoCoords(QPoint* pt, const QSize s);
void scaleCoords(QPoint* pt);
bool scaleSize(QImage* i);
bool scaleSize(QFont* f);
void autoCoords(TQPoint* pt, const TQFont& f, const TQString& s);
void autoCoords(TQPoint* pt, const TQSize s);
void scaleCoords(TQPoint* pt);
bool scaleSize(TQImage* i);
bool scaleSize(TQFont* f);
bool resolutionDiff();

@ -20,13 +20,13 @@
#include <kstandarddirs.h>
#include <kuser.h>
#include <qlabel.h>
#include <qimage.h>
#include <qrect.h>
#include <qpainter.h>
#include <qstringlist.h>
#include <qwidget.h>
#include <qlayout.h>
#include <tqlabel.h>
#include <tqimage.h>
#include <tqrect.h>
#include <tqpainter.h>
#include <tqstringlist.h>
#include <tqwidget.h>
#include <tqlayout.h>
#include "magiclabel.h"
#include "thememoodin.h"
@ -34,8 +34,8 @@
K_EXPORT_COMPONENT_FACTORY(ksplashmoodin, KGenericFactory<ThemeMoodin>("ksplash"))
ThemeMoodin::ThemeMoodin(QWidget* parent, const char* name, const QStringList& args)
:ThemeEngine(parent, name, args)
ThemeMoodin::ThemeMoodin(TQWidget* tqparent, const char* name, const TQStringList& args)
:ThemeEngine(tqparent, name, args)
{
readSettings();
init();
@ -44,7 +44,7 @@ ThemeMoodin::ThemeMoodin(QWidget* parent, const char* name, const QStringList& a
void ThemeMoodin::readSettings()
{
const QRect screen = kapp->desktop()->screenGeometry(mTheme->xineramaScreen());
const TQRect screen = kapp->desktop()->screenGeometry(mTheme->xineramaScreen());
if (!mTheme)
return;
@ -54,18 +54,18 @@ void ThemeMoodin::readSettings()
if (!cfg)
return;
cfg->setGroup(QString("KSplash Theme: %1").arg(mTheme->theme()));
cfg->setGroup(TQString("KSplash Theme: %1").tqarg(mTheme->theme()));
QFont defaultFont("Trebuchet MS", 10);
QFont defaultStatusFont("Trebuchet MS", 12, QFont::Bold);
QColor defaultColor(0xFF, 0xFF, 0xFF);
QColor defaultShadowColor(0x6D, 0x6D, 0x6D);
QPoint defaultPoint(-1, -1), defaultOffset(0, 0);
QString defaultIcon;
TQFont defaultFont("Trebuchet MS", 10);
TQFont defaultStatusFont("Trebuchet MS", 12, TQFont::Bold);
TQColor defaultColor(0xFF, 0xFF, 0xFF);
TQColor defaultShadowColor(0x6D, 0x6D, 0x6D);
TQPoint defaultPoint(-1, -1), defaultOffset(0, 0);
TQString defaultIcon;
mCurrentStatusIndex = 0;
mSplashRect = cfg->readRectEntry("SplashRect", &screen);
mBackgroundImage = cfg->readEntry("Background", QString::null);
mBackgroundImage = cfg->readEntry("Background", TQString());
mStatusColor = cfg->readColorEntry("StatusColor", &defaultColor);
mStatusFont = cfg->readFontEntry("StatusFont", &defaultStatusFont);
mStatusCoords = cfg->readPointEntry("StatusCoords", &defaultPoint);
@ -81,8 +81,8 @@ void ThemeMoodin::readSettings()
mImageSpacer = cfg->readNumEntry("ImageSpacer", mUseIconSet ? mIconSetSize : 0);
mUsersBackground = cfg->readBoolEntry("UsersBackground", false);
mLabelCount = cfg->readNumEntry("Labels", 0);
mLabelShadowOffset = cfg->readPointEntry("LabelShadowOffset", new QPoint(2, 2));
mBaseResolution = cfg->readSizeEntry("BaseResolution", new QSize(1280, 1024));
mLabelShadowOffset = cfg->readPointEntry("LabelShadowOffset", new TQPoint(2, 2));
mBaseResolution = cfg->readSizeEntry("BaseResolution", new TQSize(1280, 1024));
mTranslate = cfg->readBoolEntry("Translate", true);
mLineUpImages = cfg->readBoolEntry("LineUpImages", false);
mKubuntuStyle = cfg->readBoolEntry("KubuntuStyle", false);
@ -90,7 +90,7 @@ void ThemeMoodin::readSettings()
// so we can centre icons, JRiddell
int iconX = mBaseResolution.width();
int iconY = mBaseResolution.height();
QRect defaultScreen = kapp->desktop()->screenGeometry(0);
TQRect defaultScreen = kapp->desktop()->screenGeometry(0);
float scaleRatioWidth = ((float)mBaseResolution.width()) / ((float)defaultScreen.width());
// unused. float scaleRatioHeight = ((float)mBaseResolution.height()) / ((float)desktopWidget.height());
@ -106,26 +106,26 @@ void ThemeMoodin::readSettings()
if (mUseIconSet)
defaultIcon = statusPixmaps()[i];
else
defaultIcon = QString("%1.png").arg(i + 1);
defaultIcon = TQString("%1.png").tqarg(i + 1);
mStatusIcons.append(cfg->readEntry(QString("Image%1").arg(i + 1), defaultIcon));
mStatusIcons.append(cfg->readEntry(TQString("Image%1").tqarg(i + 1), defaultIcon));
if (mKubuntuStyle) {
QPoint *mypoint;
mypoint = new QPoint((int)(iconX + (i * (mIconSetSize+mImageSpacer) * scaleRatioWidth)), iconY);
TQPoint *mypoint;
mypoint = new TQPoint((int)(iconX + (i * (mIconSetSize+mImageSpacer) * scaleRatioWidth)), iconY);
mStatusIconCoords.append( *mypoint );
} else {
mStatusIconCoords.append(cfg->readPointEntry(QString("ImageCoords%1").arg(i + 1), &defaultPoint));
mStatusIconCoords.append(cfg->readPointEntry(TQString("ImageCoords%1").tqarg(i + 1), &defaultPoint));
}
mStatusImageOffsets.append(cfg->readPointEntry(QString("ImageOffset%1").arg(i + 1), &defaultOffset));
mStatusMessages.append(cfg->readEntry(QString("StatusMessage%1").arg(i + 1), QString::null));
mStatusImageOffsets.append(cfg->readPointEntry(TQString("ImageOffset%1").tqarg(i + 1), &defaultOffset));
mStatusMessages.append(cfg->readEntry(TQString("StatusMessage%1").tqarg(i + 1), TQString()));
}
for (int i = 0; i < mLabelCount; i++)
{
mLabels.append(cfg->readEntry(QString("Label%1").arg(i + 1), QString::null));
mLabelCoords.append(cfg->readPointEntry(QString("LabelCoords%1").arg(i + 1), &defaultPoint));
mLabelFonts.append(cfg->readFontEntry(QString("LabelFont%1").arg(i + 1), &defaultFont));
mLabelColors.append(cfg->readColorEntry(QString("LabelColor%1").arg(i + 1), &defaultColor));
mLabels.append(cfg->readEntry(TQString("Label%1").tqarg(i + 1), TQString()));
mLabelCoords.append(cfg->readPointEntry(TQString("LabelCoords%1").tqarg(i + 1), &defaultPoint));
mLabelFonts.append(cfg->readFontEntry(TQString("LabelFont%1").tqarg(i + 1), &defaultFont));
mLabelColors.append(cfg->readColorEntry(TQString("LabelColor%1").tqarg(i + 1), &defaultColor));
}
}
@ -135,14 +135,14 @@ void ThemeMoodin::init()
setBackgroundMode(NoBackground);
setFixedSize(mSplashRect.size());
mContainer = new QWidget(this);
mContainer = new TQWidget(this);
mContainer->setFixedSize(size());
mScaler = new Scaler(mBaseResolution, size());
mCache = new Cache(mScaler, mTheme->themeEngine(), mTheme->theme());
mBG = new KPixmap();
mBG->resize(size());
QPainter p;
TQPainter p;
p.begin(mBG);
initBackground(&p);
@ -155,12 +155,12 @@ void ThemeMoodin::init()
}
void ThemeMoodin::initBackground(QPainter* p)
void ThemeMoodin::initBackground(TQPainter* p)
{
if (!p)
return;
QString bgImage;
TQString bgImage;
if (mUsersBackground)
{
@ -168,8 +168,8 @@ void ThemeMoodin::initBackground(QPainter* p)
kdesktoprc.setGroup("Background Common");
int num = kdesktoprc.readNumEntry("DeskNum", 0);
kdesktoprc.setGroup(QString("Desktop%1").arg(num));
bgImage = kdesktoprc.readPathEntry("Wallpaper", QString::null);
kdesktoprc.setGroup(TQString("Desktop%1").tqarg(num));
bgImage = kdesktoprc.readPathEntry("Wallpaper", TQString());
}
else
{
@ -178,7 +178,7 @@ void ThemeMoodin::initBackground(QPainter* p)
}
if (bgImage.isEmpty())
bgImage = mTheme->locateThemeData(QString("Background-%1x%2.jpg").arg(width()).arg(height()));
bgImage = mTheme->locateThemeData(TQString("Background-%1x%2.jpg").tqarg(width()).tqarg(height()));
if (bgImage.isEmpty())
bgImage = mTheme->locateThemeData("Background.jpg");
@ -189,29 +189,29 @@ void ThemeMoodin::initBackground(QPainter* p)
return;
}
QImage* bg = mCache->cacheFile(bgImage);
TQImage* bg = mCache->cacheFile(bgImage);
p->drawImage(0, 0, *bg);
delete bg;
if (mKubuntuStyle) {
//central Dialogue, JRiddell
QImage* central = new QImage( mTheme->locateThemeData("Dialog.png") );
TQImage* central = new TQImage( mTheme->locateThemeData("Dialog.png") );
p->drawImage((mBG->width() / 2) - (462 / 2), (mBG->height() / 2) - (324 / 2), *central);
delete central;
}
}
void ThemeMoodin::initLabels(QPainter* p)
void ThemeMoodin::initLabels(TQPainter* p)
{
if ((mLabelCount == 0) || (!p))
return;
for (int i = 0; i < mLabelCount; i++)
{
QString s = mLabels[i];
QPoint pt = mLabelCoords[i];
QColor c = mLabelColors[i];
QFont f = mLabelFonts[i];
TQString s = mLabels[i];
TQPoint pt = mLabelCoords[i];
TQColor c = mLabelColors[i];
TQFont f = mLabelFonts[i];
if (s.isNull() || s.isEmpty())
continue;
@ -238,12 +238,12 @@ void ThemeMoodin::initLabels(QPainter* p)
void ThemeMoodin::initEffectWidgets()
{
EffectWidget::setBackgroundImage(new QImage(mBG->convertToImage()));
EffectWidget::setBackgroundImage(new TQImage(mBG->convertToImage()));
EffectWidget *fadeWidget = 0;
QImage *image = 0;
TQImage *image = 0;
int index = -1;
for (QStringList::ConstIterator it = mStatusIcons.constBegin(); it != mStatusIcons.constEnd(); ++it)
for (TQStringList::ConstIterator it = mStatusIcons.constBegin(); it != mStatusIcons.constEnd(); ++it)
{
index++;
@ -253,8 +253,8 @@ void ThemeMoodin::initEffectWidgets()
continue;
// TODO: use cache in iconset mode
QPixmap* px = new QPixmap(DesktopIcon(*it, mIconSetSize));
image = new QImage(px->convertToImage());
TQPixmap* px = new TQPixmap(DesktopIcon(*it, mIconSetSize));
image = new TQImage(px->convertToImage());
// JRiddell don't scale icons
if (!mKubuntuStyle) {
mScaler->scaleSize(image);
@ -262,7 +262,7 @@ void ThemeMoodin::initEffectWidgets()
}
else
{
QString name = mTheme->locateThemeData(*it);
TQString name = mTheme->locateThemeData(*it);
if (name.isEmpty())
continue;
@ -287,9 +287,9 @@ void ThemeMoodin::initEffectWidgets()
}
void ThemeMoodin::arrangeWidget(QWidget* w, const int index)
void ThemeMoodin::arrangeWidget(TQWidget* w, const int index)
{
QPoint current(mStatusIconCoords[index]);
TQPoint current(mStatusIconCoords[index]);
if (mLineUpImages)
{
@ -316,12 +316,12 @@ void ThemeMoodin::arrangeWidget(QWidget* w, const int index)
int x = mAppendX ? mIconSetSize * 2 : 0;
int y = mAppendX ? 0 : mIconSetSize * 2;
current = mStatusIconCoords[index - 1] + QPoint(x, y);
current = mStatusIconCoords[index - 1] + TQPoint(x, y);
}
}
else
{
mScaler->autoCoords(&current, QSize(mIconSetSize, mIconSetSize));
mScaler->autoCoords(&current, TQSize(mIconSetSize, mIconSetSize));
current += mStatusImageOffsets[index];
}
@ -330,12 +330,12 @@ void ThemeMoodin::arrangeWidget(QWidget* w, const int index)
}
EffectWidget* ThemeMoodin::createEffectWidget(QWidget* parent, QImage* image)
EffectWidget* ThemeMoodin::createEffectWidget(TQWidget* tqparent, TQImage* image)
{
EffectWidget *fw = new EffectWidget(parent);
EffectWidget *fw = new EffectWidget(tqparent);
fw->hide();
fw->setBackgroundOrigin(QWidget::WindowOrigin);
fw->setBackgroundOrigin(TQWidget::WindowOrigin);
fw->setDelay(mAnimationDelay);
fw->setSteps(mAnimationLength);
fw->setFixedSize(image->size());
@ -347,7 +347,7 @@ EffectWidget* ThemeMoodin::createEffectWidget(QWidget* parent, QImage* image)
}
void ThemeMoodin::slotSetText(const QString& s)
void ThemeMoodin::slotSetText(const TQString& s)
{
if (mShowStatusText)
{
@ -359,12 +359,12 @@ void ThemeMoodin::slotSetText(const QString& s)
}
void ThemeMoodin::slotSetPixmap(const QString& s)
void ThemeMoodin::slotSetPixmap(const TQString& s)
{
if (!mEffectWidgets.count() > 0)
return;
int n = statusPixmaps().findIndex(s);
int n = statusPixmaps().tqfindIndex(s);
if (n == -1)
return;
@ -376,19 +376,19 @@ void ThemeMoodin::slotSetPixmap(const QString& s)
if (fw)
fw->start();
repaint(false);
tqrepaint(false);
}
void ThemeMoodin::updateStatus()
void ThemeMoodin::updatetqStatus()
{
QPainter p;
TQPainter p;
p.begin(mContainer);
// use a copy, otherwise status messages move around
QPoint pt = mStatusCoords;
QFontMetrics fm(mStatusFont);
QSize fmSize(fm.size(0L, mCurrentAction));
TQPoint pt = mStatusCoords;
TQFontMetrics fm(mStatusFont);
TQSize fmSize(fm.size(0L, mCurrentAction));
mScaler->autoCoords(&pt, fmSize);
@ -406,14 +406,14 @@ void ThemeMoodin::updateStatus()
}
void ThemeMoodin::paintEvent(QPaintEvent* pe)
void ThemeMoodin::paintEvent(TQPaintEvent* pe)
{
QRect r = pe->rect();
TQRect r = pe->rect();
bitBlt(mContainer, r.x(), r.y(), mBG, r.x(), r.y(), r.width(), r.height());
if (mShowStatusText)
updateStatus();
updatetqStatus();
}
#include "thememoodin.moc"

@ -12,7 +12,7 @@
#ifndef THEMEMOODIN_H
#define THEMEMOODIN_H
#include <qptrlist.h>
#include <tqptrlist.h>
#include <kdebug.h>
#include <kpixmap.h>
@ -24,34 +24,35 @@
#include "cache.h"
#include "effectwidget.h"
typedef QPtrList<EffectWidget> EffectWidgetList;
typedef QValueList<QPoint> CoordsList;
typedef QValueList<QColor> ColorList;
typedef QValueList<QFont> FontList;
typedef QPtrList<QImage> ImageList;
typedef TQPtrList<EffectWidget> EffectWidgetList;
typedef TQValueList<TQPoint> CoordsList;
typedef TQValueList<TQColor> ColorList;
typedef TQValueList<TQFont> FontList;
typedef TQPtrList<TQImage> ImageList;
class ThemeMoodin: public ThemeEngine
{
Q_OBJECT
TQ_OBJECT
public:
ThemeMoodin(QWidget *parent, const char *name, const QStringList& flags);
ThemeMoodin(TQWidget *tqparent, const char *name, const TQStringList& flags);
inline const QString name() { return QString("Moodin"); }
inline const TQString name() { return TQString("Moodin"); }
inline const int version() { return 0x042; }
static QStringList names()
static TQStringList names()
{
QStringList l;
TQStringList l;
l << "Moodin";
return l;
};
static QStringList statusPixmaps()
static TQStringList statusPixmaps()
{
QStringList l;
TQStringList l;
l << "filetypes"; // 1 filetypes
l << "exec"; // 2 exec
@ -66,8 +67,8 @@ public:
};
public slots:
void slotSetText(const QString& s);
void slotSetPixmap(const QString&);
void slotSetText(const TQString& s);
void slotSetPixmap(const TQString&);
private:
bool mUseIconSet;
@ -86,19 +87,19 @@ private:
int mLabelCount;
float mBeginOpacity;
QString mCurrentAction;
QString mBackgroundImage;
QStringList mStatusIcons;
QStringList mStatusMessages;
QStringList mLabels;
QColor mStatusColor;
QColor mLabelShadowColor;
QFont mStatusFont;
QPoint mStatusCoords;
QPoint mLabelShadowOffset;
QWidget* mContainer;
QSize mBaseResolution;
QRect mSplashRect;
TQString mCurrentAction;
TQString mBackgroundImage;
TQStringList mStatusIcons;
TQStringList mStatusMessages;
TQStringList mLabels;
TQColor mStatusColor;
TQColor mLabelShadowColor;
TQFont mStatusFont;
TQPoint mStatusCoords;
TQPoint mLabelShadowOffset;
TQWidget* mContainer;
TQSize mBaseResolution;
TQRect mSplashRect;
KPixmap* mBG;
@ -114,16 +115,16 @@ private:
ImageList mImages;
void init();
void initBackground(QPainter* p);
void initBackground(TQPainter* p);
void initEffectWidgets();
void initLabels(QPainter* p);
void initLabels(TQPainter* p);
void paintEvent(QPaintEvent* pe);
void paintEvent(TQPaintEvent* pe);
void readSettings();
void arrangeWidget(QWidget* me, const int index);
void updateStatus();
void arrangeWidget(TQWidget* me, const int index);
void updatetqStatus();
EffectWidget* createEffectWidget(QWidget *parent, QImage *image);
EffectWidget* createEffectWidget(TQWidget *tqparent, TQImage *image);
};
#endif

Loading…
Cancel
Save