Rev 145 | Rev 268 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
17 | Franz | 1 | #include <qapplication.h> |
2 | #include <qpainter.h> |
||
3 | #include <qpixmap.h> |
||
4 | #include "splash.h" |
||
5 | extern QPixmap loadIcon(QString nam); |
||
6 | |||
145 | Franz | 7 | /*! |
8 | \fn SplashScreen::SplashScreen() |
||
9 | \author Franz Schmid |
||
10 | \date |
||
11 | \brief Constructor for SplashScreen |
||
12 | \param None |
||
13 | \retval None |
||
14 | */ |
||
17 | Franz | 15 | SplashScreen::SplashScreen() |
145 | Franz | 16 | : QWidget( 0, 0, WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop | WStyle_Tool | WX11BypassWM ) |
17 | Franz | 17 | { |
18 | pix = loadIcon("Splash.png"); |
||
19 | setErasePixmap( pix ); |
||
20 | resize( pix.size() ); |
||
21 | QRect scr = QApplication::desktop()->screenGeometry(); |
||
22 | move( scr.center() - rect().center() ); |
||
23 | show(); |
||
24 | repaint(); |
||
25 | } |
||
26 | |||
145 | Franz | 27 | /*! |
28 | \fn void SplashScreen::mousePressEvent( QMouseEvent * ) |
||
29 | \author Franz Schmid |
||
30 | \date |
||
31 | \brief When mouse is clicked the splashscreen is hidden |
||
32 | \param QMouseEvent* QMouseEvent pointer |
||
33 | \retval None |
||
34 | */ |
||
17 | Franz | 35 | void SplashScreen::mousePressEvent( QMouseEvent * ) |
36 | { |
||
37 | hide(); |
||
38 | } |
||
39 | |||
145 | Franz | 40 | /*! |
41 | \fn void SplashScreen::repaint() |
||
42 | \author Franz Schmid |
||
43 | \date |
||
44 | \brief Repaints the splashscreen when status is changed in SplashScreen::setStatus |
||
45 | \param None |
||
46 | \retval None |
||
47 | */ |
||
17 | Franz | 48 | void SplashScreen::repaint() |
49 | { |
||
50 | QWidget::repaint(); |
||
51 | QApplication::flush(); |
||
52 | } |
||
53 | |||
145 | Franz | 54 | /*! |
55 | \fn void SplashScreen::setStatus( const QString &message ) |
||
56 | \author Franz Schmid |
||
57 | \date |
||
58 | \brief Sets new status on SplashScreen and calls for a SplashScreen::repaint afterwards. |
||
59 | \param message const QString& message to display as actions are performed on startup when SplashScreen is displayed. |
||
60 | \retval None |
||
61 | */ |
||
17 | Franz | 62 | void SplashScreen::setStatus( const QString &message ) |
63 | { |
||
64 | QPixmap textPix = pix; |
||
65 | QPainter painter( &textPix, this ); |
||
66 | painter.setPen( black ); |
||
67 | painter.drawText( 10, 90, message ); |
||
68 | setErasePixmap( textPix ); |
||
69 | repaint(); |
||
162 | Franz | 70 | } |