@ -20,13 +20,13 @@
# include <kstandarddirs.h>
# include <kstandarddirs.h>
# include <kuser.h>
# include <kuser.h>
# include < qlabel.h>
# include < t qlabel.h>
# include < qimage.h>
# include < t qimage.h>
# include < qrect.h>
# include < t qrect.h>
# include < qpainter.h>
# include < t qpainter.h>
# include < qstringlist.h>
# include < t qstringlist.h>
# include < qwidget.h>
# include < t qwidget.h>
# include < qlayout.h>
# include < t qlayout.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 ( T QWidget* tq parent, const char * name , const T QStringList& args )
: ThemeEngine ( parent, name , args )
: ThemeEngine ( tq parent, 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 T QRect 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 ( T QString( " KSplash Theme: %1 " ) . tq arg( mTheme - > theme ( ) ) ) ;
QFont defaultFont ( " Trebuchet MS " , 10 ) ;
T QFont defaultFont ( " Trebuchet MS " , 10 ) ;
QFont defaultStatusFont ( " Trebuchet MS " , 12 , QFont: : Bold ) ;
T QFont defaultStatusFont ( " Trebuchet MS " , 12 , T QFont: : Bold ) ;
QColor defaultColor ( 0xFF , 0xFF , 0xFF ) ;
T QColor defaultColor ( 0xFF , 0xFF , 0xFF ) ;
QColor defaultShadowColor ( 0x6D , 0x6D , 0x6D ) ;
T QColor defaultShadowColor ( 0x6D , 0x6D , 0x6D ) ;
QPoint defaultPoint ( - 1 , - 1 ) , defaultOffset ( 0 , 0 ) ;
T QPoint defaultPoint ( - 1 , - 1 ) , defaultOffset ( 0 , 0 ) ;
QString defaultIcon ;
T QString 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 T QPoint( 2 , 2 ) ) ;
mBaseResolution = cfg - > readSizeEntry ( " BaseResolution " , new QSize( 1280 , 1024 ) ) ;
mBaseResolution = cfg - > readSizeEntry ( " BaseResolution " , new T QSize( 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 ) ;
T QRect 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 = T QString( " %1.png " ) . tq arg( i + 1 ) ;
mStatusIcons . append ( cfg - > readEntry ( QString( " Image%1 " ) . arg( i + 1 ) , defaultIcon ) ) ;
mStatusIcons . append ( cfg - > readEntry ( T QString( " Image%1 " ) . tq arg( i + 1 ) , defaultIcon ) ) ;
if ( mKubuntuStyle ) {
if ( mKubuntuStyle ) {
QPoint * mypoint ;
T QPoint * mypoint ;
mypoint = new QPoint( ( int ) ( iconX + ( i * ( mIconSetSize + mImageSpacer ) * scaleRatioWidth ) ) , iconY ) ;
mypoint = new T QPoint( ( 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 ( T QString( " ImageCoords%1 " ) . tq arg( i + 1 ) , & defaultPoint ) ) ;
}
}
mStatusImageOffsets . append ( cfg - > readPointEntry ( QString( " ImageOffset%1 " ) . arg( i + 1 ) , & defaultOffset ) ) ;
mStatusImageOffsets . append ( cfg - > readPointEntry ( T QString( " ImageOffset%1 " ) . tq arg( i + 1 ) , & defaultOffset ) ) ;
mStatusMessages . append ( cfg - > readEntry ( QString( " StatusMessage%1 " ) . arg( i + 1 ) , QString: : null ) ) ;
mStatusMessages . append ( cfg - > readEntry ( T QString( " StatusMessage%1 " ) . tq arg( 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 ( T QString( " Label%1 " ) . tq arg( i + 1 ) , TQString( ) ) ) ;
mLabelCoords . append ( cfg - > readPointEntry ( QString( " LabelCoords%1 " ) . arg( i + 1 ) , & defaultPoint ) ) ;
mLabelCoords . append ( cfg - > readPointEntry ( T QString( " LabelCoords%1 " ) . tq arg( i + 1 ) , & defaultPoint ) ) ;
mLabelFonts . append ( cfg - > readFontEntry ( QString( " LabelFont%1 " ) . arg( i + 1 ) , & defaultFont ) ) ;
mLabelFonts . append ( cfg - > readFontEntry ( T QString( " LabelFont%1 " ) . tq arg( i + 1 ) , & defaultFont ) ) ;
mLabelColors . append ( cfg - > readColorEntry ( QString( " LabelColor%1 " ) . arg( i + 1 ) , & defaultColor ) ) ;
mLabelColors . append ( cfg - > readColorEntry ( T QString( " LabelColor%1 " ) . tq arg( 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 T QWidget( 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 ;
T QPainter 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 ( T QPainter* p )
{
{
if ( ! p )
if ( ! p )
return ;
return ;
QString bgImage ;
T QString 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 ( T QString( " Desktop%1 " ) . tq arg( 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 ( T QString( " Background-%1x%2.jpg " ) . tq arg( width ( ) ) . tq arg( 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 ) ;
T QImage* 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 " ) ) ;
T QImage* central = new T QImage( 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 ( T QPainter* 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 ] ;
T QString s = mLabels [ i ] ;
QPoint pt = mLabelCoords [ i ] ;
T QPoint pt = mLabelCoords [ i ] ;
QColor c = mLabelColors [ i ] ;
T QColor c = mLabelColors [ i ] ;
QFont f = mLabelFonts [ i ] ;
T QFont 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 T QImage( mBG - > convertToImage ( ) ) ) ;
EffectWidget * fadeWidget = 0 ;
EffectWidget * fadeWidget = 0 ;
QImage * image = 0 ;
T QImage * image = 0 ;
int index = - 1 ;
int index = - 1 ;
for ( QStringList: : ConstIterator it = mStatusIcons . constBegin ( ) ; it ! = mStatusIcons . constEnd ( ) ; + + it )
for ( T QStringList: : 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 ) ) ;
T QPixmap* px = new T QPixmap( DesktopIcon ( * it , mIconSetSize ) ) ;
image = new QImage( px - > convertToImage ( ) ) ;
image = new T QImage( 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 ) ;
T QString 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 ( T QWidget* w , const int index )
{
{
QPoint current ( mStatusIconCoords [ index ] ) ;
T QPoint 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 ] + T QPoint( x , y ) ;
}
}
}
}
else
else
{
{
mScaler - > autoCoords ( & current , QSize( mIconSetSize , mIconSetSize ) ) ;
mScaler - > autoCoords ( & current , T QSize( 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 ( T QWidget* tq parent, T QImage* image )
{
{
EffectWidget * fw = new EffectWidget ( parent) ;
EffectWidget * fw = new EffectWidget ( tq parent) ;
fw - > hide ( ) ;
fw - > hide ( ) ;
fw - > setBackgroundOrigin ( QWidget: : WindowOrigin ) ;
fw - > setBackgroundOrigin ( T QWidget: : 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 T QString& 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 T QString& s )
{
{
if ( ! mEffectWidgets . count ( ) > 0 )
if ( ! mEffectWidgets . count ( ) > 0 )
return ;
return ;
int n = statusPixmaps ( ) . findIndex( s ) ;
int n = statusPixmaps ( ) . tq findIndex( 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 ) ;
tq repaint( false ) ;
}
}
void ThemeMoodin : : update Status( )
void ThemeMoodin : : update tq Status( )
{
{
QPainter p ;
T QPainter 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 ;
T QPoint pt = mStatusCoords ;
QFontMetrics fm ( mStatusFont ) ;
T QFontMetrics fm ( mStatusFont ) ;
QSize fmSize ( fm . size ( 0L , mCurrentAction ) ) ;
T QSize 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 ( T QPaintEvent* pe )
{
{
QRect r = pe - > rect ( ) ;
T QRect 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 )
update Status( ) ;
update tq Status( ) ;
}
}
# include "thememoodin.moc"
# include "thememoodin.moc"