Subversion Repositories Scribus

Rev

Rev 4969 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2674 fschmid 1
/***************************************************************************
2
 *                                                                         *
3
 *   This program is free software; you can redistribute it and/or modify  *
4
 *   it under the terms of the GNU General Public License as published by  *
5
 *   the Free Software Foundation; either version 2 of the License, or     *
6
 *   (at your option) any later version.                                   *
7
 *                                                                         *
8
 ***************************************************************************/
17 Franz 9
#include <qapplication.h>
10
#include <qpainter.h>
11
#include <qpixmap.h>
320 Franz 12
#include <qregexp.h>
17 Franz 13
#include "splash.h"
14
extern QPixmap loadIcon(QString nam);
15
 
145 Franz 16
/*!
17
 \fn SplashScreen::SplashScreen()
18
 \author Franz Schmid
19
 \date
20
 \brief Constructor for SplashScreen
21
 \param None
22
 \retval None
23
 */
17 Franz 24
SplashScreen::SplashScreen()
4969 cbradney 25
//      : QWidget( 0, 0, WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop | WStyle_Tool | WX11BypassWM )
4971 cbradney 26
        : QWidget( 0, 0, WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop | WStyle_Tool | WStyle_Splash )
17 Franz 27
{
28
        pix = loadIcon("Splash.png");
29
        setErasePixmap( pix );
30
        resize( pix.size() );
31
        QRect scr = QApplication::desktop()->screenGeometry();
32
        move( scr.center() - rect().center() );
33
        show();
34
        repaint();
35
}
36
 
145 Franz 37
/*!
38
 \fn void SplashScreen::mousePressEvent( QMouseEvent * )
39
 \author Franz Schmid
40
 \date
41
 \brief When mouse is clicked the splashscreen is hidden
42
 \param QMouseEvent* QMouseEvent pointer
43
 \retval None
44
 */
17 Franz 45
void SplashScreen::mousePressEvent( QMouseEvent * )
46
{
47
        hide();
48
}
49
 
145 Franz 50
/*!
51
 \fn void SplashScreen::repaint()
52
 \author Franz Schmid
53
 \date
54
 \brief Repaints the splashscreen when status is changed in SplashScreen::setStatus
55
 \param None
56
 \retval None
57
 */
17 Franz 58
void SplashScreen::repaint()
59
{
60
        QWidget::repaint();
61
        QApplication::flush();
62
}
63
 
145 Franz 64
/*!
65
 \fn void SplashScreen::setStatus( const QString &message )
66
 \author Franz Schmid
67
 \date
68
 \brief Sets new status on SplashScreen and calls for a SplashScreen::repaint afterwards.
69
 \param message const QString& message to display as actions are performed on startup when SplashScreen is displayed.
70
 \retval None
71
 */
17 Franz 72
void SplashScreen::setStatus( const QString &message )
73
{
320 Franz 74
        QString tmp = message;
75
        int f = 0;
76
        while (f != -1)
77
        {
78
                f = tmp.find(QRegExp( "&\\S*" ));
79
                if (f != -1)
80
                {
81
                        tmp.remove(f, 1);
82
                        f = 0;
83
                }
84
        }
17 Franz 85
        QPixmap textPix = pix;
86
        QPainter painter( &textPix, this );
269 Franz 87
        painter.setFont(QFont("Helvetica", 10));
268 Franz 88
        painter.setPen( white );
320 Franz 89
        painter.drawText( 10, textPix.height()-8, tmp );
17 Franz 90
        setErasePixmap( textPix );
91
        repaint();
162 Franz 92
}