• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kstars

kstarssplash.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                           kstarssplash.cpp  -  description
00003                              -------------------
00004     begin                : Thu Jul 26 2001
00005     copyright            : (C) 2001 by Heiko Evermann
00006     email                : heiko@evermann.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
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 /*no buttons*/, Ok, parent, name, false /*not modal*/ ) {
00031 
00032     //Set up widgets for splashscreen.
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     //Load the KStars banner.  Use an empty image if it can't be opened.
00041     QFile imFile;
00042     if ( KSUtils::openDataFile( imFile, "kstars.png" ) ) {
00043         imFile.close(); //Just need the filename...
00044         splashImage = new QPixmap( imFile.name() );
00045     } else {
00046         splashImage = new QPixmap(); //null image
00047     }
00048 
00049     Banner = new QWidget( page );
00050     Banner->setFixedWidth( splashImage->width() );
00051     Banner->setFixedHeight( splashImage->height() );
00052     topLayout->addWidget( Banner );
00053     
00054 //initialize the "Welcome to KStars message label
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 //initialize the progress message label
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);  // force repaint of widget with no text
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();  // standard text label
00084     textCurrentStatus->repaint();  // status text label
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();  // repaint splash screen
00100     kapp->flush();
00101 }
00102 
00103 #include "kstarssplash.moc"

kstars

Skip menu "kstars"
  • Main Page
  • Modules
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • keduca
  • kstars
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal