4 #include <kcomponentdata.h>
5 #include <kstandarddirs.h>
10 int main( int argc
, char* argv
[] )
14 QString theme
= argv
[ 1 ];
15 QString file
= argv
[ 2 ];
16 QString real_file
= argv
[ 3 ];
17 int width
= atoi( argv
[ 4 ] );
18 int height
= atoi( argv
[ 5 ] );
19 int res_w
= atoi( argv
[ 6 ] );
20 int res_h
= atoi( argv
[ 7 ] );
21 time_t timestamp
= atol( argv
[ 8 ] );
22 bool locolor
= strcmp( argv
[ 9 ], "locolor" ) == 0;
23 KComponentData
k( "ksplashx_scale" );
24 QString outfile
= QString( "ksplashx/%1-%2x%3%4-%5" ).arg( theme
).arg( res_w
).arg( res_h
)
25 .arg( locolor
? "-locolor" : "" ).arg( file
);
26 outfile
= KStandardDirs::locateLocal( "cache", outfile
);
27 QImage
img( real_file
);
30 QImage img2
= img
.scaled(width
, height
, Qt::IgnoreAspectRatio
, Qt::SmoothTransformation
);
31 if( img2
.save( outfile
+ ".tmp", "PNG" ))
33 rename( QFile::encodeName( outfile
+ ".tmp" ), QFile::encodeName( outfile
));
35 tm
.actime
= tm
.modtime
= timestamp
;
36 utime( QFile::encodeName( outfile
), &tm
);
40 unlink( QFile::encodeName( outfile
));
41 unlink( QFile::encodeName( outfile
+ ".tmp" ));