Subversion Repositories Scribus

Rev

Rev 7784 | Rev 8495 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4430 cbradney 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
17 Franz 7
#include <qapplication.h>
8
#include <qpainter.h>
9
#include <qpixmap.h>
320 Franz 10
#include <qregexp.h>
17 Franz 11
#include "splash.h"
12
extern QPixmap loadIcon(QString nam);
13
 
4645 subik 14
 
17 Franz 15
SplashScreen::SplashScreen()
4967 cbradney 16
        : QWidget( 0, 0, WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop | WStyle_Tool |
17
        WStyle_Splash)
18
         //WX11BypassWM )
17 Franz 19
{
20
        pix = loadIcon("Splash.png");
3288 craig 21
        Q_ASSERT(!pix.isNull());
5455 avox 22
        if (pix.isNull()) {
23
                pix = QPixmap(360, 200);
24
                pix.fill(Qt::darkGray);
25
        }
17 Franz 26
        setErasePixmap( pix );
27
        resize( pix.size() );
28
        QRect scr = QApplication::desktop()->screenGeometry();
29
        move( scr.center() - rect().center() );
30
        show();
31
        repaint();
32
}
33
 
34
void SplashScreen::mousePressEvent( QMouseEvent * )
35
{
36
        hide();
37
}
38
 
39
void SplashScreen::repaint()
40
{
41
        QWidget::repaint();
42
        QApplication::flush();
43
}
44
 
45
void SplashScreen::setStatus( const QString &message )
46
{
7784 cbradney 47
        static QRegExp rx("&\\S*");    
48
        QString tmp(message);
320 Franz 49
        int f = 0;
50
        while (f != -1)
51
        {
7784 cbradney 52
                f = tmp.find(rx);
320 Franz 53
                if (f != -1)
54
                {
55
                        tmp.remove(f, 1);
56
                        f = 0;
57
                }
58
        }
7784 cbradney 59
        QPixmap textPix(pix);
17 Franz 60
        QPainter painter( &textPix, this );
7782 jghali 61
#if defined _WIN32
7800 cbradney 62
        QFont font("Lucida Sans", 10);
63
#elif defined(__INNOTEK_LIBC__)
64
        QFont font("WarpSans", 9);
7782 jghali 65
#else
7800 cbradney 66
        QFont font("Bitstream Vera Sans", 10);
7782 jghali 67
#endif
7761 cbradney 68
        painter.setFont(font);
69
        painter.setPen(QColor(236,233,216));
3316 cbradney 70
        //painter.setRasterOp(NotROP);
7761 cbradney 71
        painter.drawText( 81, textPix.height()-8, tmp );
5452 avox 72
        painter.end();
17 Franz 73
        setErasePixmap( textPix );
74
        repaint();
162 Franz 75
}