kstars
kstarssplash.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <qfile.h>
00019 #include <qlabel.h>
00020 #include <qlayout.h>
00021 #include <klocale.h>
00022
00023 #include <kapplication.h>
00024
00025 #include "kstarssplash.h"
00026 #include "ksutils.h"
00027
00028 KStarsSplash::KStarsSplash( QWidget *parent, const char* name )
00029 : KDialogBase( KDialogBase::Plain, i18n( "Loading KStars..." ),
00030 0 , Ok, parent, name, false ) {
00031
00032
00033 QFrame *page = plainPage();
00034 page->setBackgroundColor( QColor( "Black" ) );
00035 setBackgroundColor( QColor( "Black" ) );
00036
00037 QVBoxLayout *topLayout = new QVBoxLayout( page, 0, 0 );
00038 topLayout->setMargin( 0 );
00039
00040
00041 QFile imFile;
00042 if ( KSUtils::openDataFile( imFile, "kstars.png" ) ) {
00043 imFile.close();
00044 splashImage = new QPixmap( imFile.name() );
00045 } else {
00046 splashImage = new QPixmap();
00047 }
00048
00049 Banner = new QWidget( page );
00050 Banner->setFixedWidth( splashImage->width() );
00051 Banner->setFixedHeight( splashImage->height() );
00052 topLayout->addWidget( Banner );
00053
00054
00055 label = new QLabel( page, "label1" );
00056 QPalette pal( label->palette() );
00057 pal.setColor( QPalette::Normal, QColorGroup::Background, QColor( "Black" ) );
00058 pal.setColor( QPalette::Inactive, QColorGroup::Background, QColor( "Black" ) );
00059 pal.setColor( QPalette::Normal, QColorGroup::Foreground, QColor( "White" ) );
00060 pal.setColor( QPalette::Inactive, QColorGroup::Foreground, QColor( "White" ) );
00061 label->setPalette( pal );
00062 label->setAlignment( AlignHCenter );
00063 label->setText( i18n( "Welcome to KStars. Please stand by while loading..." ) );
00064 topLayout->addWidget( label );
00065
00066
00067 textCurrentStatus = new QLabel( page, "label2" );
00068 textCurrentStatus->setPalette( pal );
00069 textCurrentStatus->setAlignment( AlignHCenter );
00070 topLayout->addWidget( textCurrentStatus );
00071
00072 topLayout->activate();
00073 disableResize();
00074 setMessage(QString::null);
00075 }
00076
00077 KStarsSplash::~KStarsSplash() {
00078 delete splashImage;
00079 }
00080
00081 void KStarsSplash::paintEvent( QPaintEvent* ) {
00082 bitBlt( Banner, 0, 0, splashImage, 0, 0, -1, -1 );
00083 label->repaint();
00084 textCurrentStatus->repaint();
00085 }
00086
00087 void KStarsSplash::closeEvent( QCloseEvent *e ) {
00088 e->ignore();
00089 emit closeWindow();
00090 }
00091
00092 void KStarsSplash::setMessage( QString s ) {
00093 textCurrentStatus->setText( s );
00094 repaint();
00100 kapp->flush();
00101 }
00102
00103 #include "kstarssplash.moc"