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 <kstandarddirs.h>
#include <kconfig.h> #include <kconfig.h>
#include <qfileinfo.h> #include <tqfileinfo.h>
#include <qdatetime.h> #include <tqdatetime.h>
#include <qimage.h> #include <tqimage.h>
#include "cache.h" #include "cache.h"
/* Disabled Cache (Michael Ummels) */ /* 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; return true;
} }
QString Cache::getFile(QString file) TQString Cache::getFile(TQString file)
{ {
return file; return file;
} }

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save