Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CelSplashScreen Class Reference

#include <celsplashscreen.h>

Inheritance diagram for CelSplashScreen:

Inheritance graph
Collaboration diagram for CelSplashScreen:

Collaboration graph
List of all members.

Public Member Functions

 CelSplashScreen (const QString &filename, QWidget *parent)
void finish (QWidget *w)
void repaint ()
void setPixmap (const QString &filename)
virtual void update (const string &message)
virtual ~CelSplashScreen ()

Protected Member Functions

virtual void drawContents (QPainter *painter)
void mousePressEvent (QMouseEvent *)

Private Member Functions

void drawContents ()

Private Attributes

std::vector< TextItemextraText
QWidget * parent
QPixmap pixmap
TextItem status
TextItem version

Constructor & Destructor Documentation

CelSplashScreen::CelSplashScreen const QString &  filename,
QWidget *  parent
 

Definition at line 26 of file celsplashscreen.cpp.

References setPixmap().

00026                                                                          :
00027     QWidget(0, 0, WStyle_Customize | WX11BypassWM), 
00028     parent(_parent)
00029 {
00030     setPixmap(filename);
00031     show();
00032 }

virtual CelSplashScreen::~CelSplashScreen  )  [inline, virtual]
 

Definition at line 59 of file celsplashscreen.h.

00059 {};


Member Function Documentation

void CelSplashScreen::drawContents  )  [private]
 

Definition at line 46 of file celsplashscreen.cpp.

References pixmap.

Referenced by repaint().

00047 {
00048     QPixmap textPix = pixmap;
00049     QPainter painter( &textPix, this );
00050     drawContents( &painter );
00051     setErasePixmap( textPix );
00052 }

void CelSplashScreen::drawContents QPainter *  painter  )  [protected, virtual]
 

Definition at line 54 of file celsplashscreen.cpp.

References TextItem::draw(), and status.

00054                                                     {
00055     status.draw(painter);
00056 }

void CelSplashScreen::finish QWidget *  w  ) 
 

Definition at line 63 of file celsplashscreen.cpp.

Referenced by KdeApp::KdeApp().

00064 {
00065     if ( mainWin ) {
00066         extern void qt_wait_for_window_manager( QWidget *mainWin );
00067         qt_wait_for_window_manager( mainWin );
00068     }
00069     close();
00070 }

void CelSplashScreen::mousePressEvent QMouseEvent *   )  [protected]
 

Definition at line 34 of file celsplashscreen.cpp.

00035 {
00036     hide();
00037 }

void CelSplashScreen::repaint  ) 
 

Definition at line 39 of file celsplashscreen.cpp.

References drawContents().

Referenced by setPixmap(), and update().

00040 {
00041     drawContents();
00042     QWidget::repaint();
00043     QApplication::flush();
00044 }

void CelSplashScreen::setPixmap const QString &  filename  ) 
 

Definition at line 72 of file celsplashscreen.cpp.

References TextItem::draw(), extraText, TextItem::getRect(), pixmap, repaint(), TextItem::set(), TextItem::setContent(), TextItem::setFlags(), status, and version.

Referenced by CelSplashScreen().

00073 {
00074     QPixmap _pixmap(filename);
00075     resize( _pixmap.size() );
00076 
00077     //  Set default values for status and version fields
00078     status.getRect().setX(20);
00079     status.getRect().setY(height() - 40);
00080     status.getRect().setWidth(width() - 200);
00081     status.getRect().setHeight(20);
00082     status.setFlags(Qt::AlignLeft | Qt::AlignTop);
00083 
00084     version.getRect().setX(width() - 180);
00085     version.getRect().setY(height() - 40);
00086     version.getRect().setWidth(150);
00087     version.getRect().setHeight(20);
00088     version.setFlags(Qt::AlignRight | Qt::AlignTop);
00089     version.setContent(VERSION);
00090 
00091     KFileMetaInfo info(filename);
00092     KFileMetaInfoGroup comments = info.group("Comment");
00093 
00094     if (comments.isValid()) {
00095         status.set("status", comments);
00096         version.set("version", comments);
00097         int i = 0;
00098         char extraName[10];
00099         sprintf(extraName, "extra%02d", i);
00100         while (i< 100 && comments.item(QString(extraName) + "_insert_before").isValid()) {
00101             TextItem extra;
00102             extra.set(extraName, comments);
00103             extraText.push_back(extra);
00104             i++;
00105             sprintf(extraName, "extra%02d", i);
00106         }
00107     }
00108 
00109     QRect desk = KGlobalSettings::splashScreenDesktopGeometry();
00110     setGeometry( ( desk.width() / 2 ) - ( width() / 2 ) + desk.left(),
00111        ( desk.height() / 2 ) - ( height() / 2 ) + desk.top(),
00112          width(), height() );
00113     if (_pixmap.hasAlphaChannel()) {
00114         QPixmap bg = QPixmap::grabWindow( qt_xrootwin(), x(), y(), width(), height() );
00115         QPainter painter(&bg);
00116         painter.drawPixmap(0, 0, _pixmap);
00117         pixmap = bg;
00118     } else {
00119         pixmap = _pixmap;
00120     }
00121     
00122     QPainter painter( &pixmap, this );
00123     version.draw(&painter);
00124     for(std::vector<TextItem>::const_iterator i = extraText.begin(); i != extraText.end();  ++i)
00125         (*i).draw(&painter);
00126 
00127     repaint();
00128 }

void CelSplashScreen::update const string message  )  [virtual]
 

Definition at line 58 of file celsplashscreen.cpp.

References repaint(), TextItem::setContent(), and status.

00058                                                    {
00059     status.setContent(_message);
00060     repaint();
00061 }


Member Data Documentation

std::vector<TextItem> CelSplashScreen::extraText [private]
 

Definition at line 75 of file celsplashscreen.h.

Referenced by setPixmap().

QWidget* CelSplashScreen::parent [private]
 

Definition at line 72 of file celsplashscreen.h.

QPixmap CelSplashScreen::pixmap [private]
 

Definition at line 71 of file celsplashscreen.h.

Referenced by drawContents(), and setPixmap().

TextItem CelSplashScreen::status [private]
 

Definition at line 74 of file celsplashscreen.h.

Referenced by drawContents(), setPixmap(), and update().

TextItem CelSplashScreen::version [private]
 

Definition at line 73 of file celsplashscreen.h.

Referenced by setPixmap().


The documentation for this class was generated from the following files:
Generated on Sat Jan 14 22:33:10 2006 for Celestia by  doxygen 1.4.1