Subversion Repositories Scribus

Rev

Rev 8495 | Rev 8508 | 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>
8501 cbradney 11
//Added by qt3to4:
12
#include <QMouseEvent>
17 Franz 13
#include "splash.h"
14
extern QPixmap loadIcon(QString nam);
15
 
4645 subik 16
 
17 Franz 17
SplashScreen::SplashScreen()
8501 cbradney 18
        : QWidget( 0, 0, Qt::WStyle_Customize | Qt::WStyle_NoBorder | Qt::WStyle_StaysOnTop | Qt::WStyle_Tool |
19
        Qt::WStyle_Splash)
4967 cbradney 20
         //WX11BypassWM )
17 Franz 21
{
22
        pix = loadIcon("Splash.png");
3288 craig 23
        Q_ASSERT(!pix.isNull());
5455 avox 24
        if (pix.isNull()) {
25
                pix = QPixmap(360, 200);
26
                pix.fill(Qt::darkGray);
27
        }
17 Franz 28
        setErasePixmap( pix );
29
        resize( pix.size() );
30
        QRect scr = QApplication::desktop()->screenGeometry();
31
        move( scr.center() - rect().center() );
32
        show();
33
        repaint();
34
}
35
 
36
void SplashScreen::mousePressEvent( QMouseEvent * )
37
{
38
        hide();
39
}
40
 
41
void SplashScreen::repaint()
42
{
43
        QWidget::repaint();
44
        QApplication::flush();
45
}
46
 
47
void SplashScreen::setStatus( const QString &message )
48
{
7784 cbradney 49
        static QRegExp rx("&\\S*");    
50
        QString tmp(message);
320 Franz 51
        int f = 0;
52
        while (f != -1)
53
        {
7784 cbradney 54
                f = tmp.find(rx);
320 Franz 55
                if (f != -1)
56
                {
57
                        tmp.remove(f, 1);
58
                        f = 0;
59
                }
60
        }
7784 cbradney 61
        QPixmap textPix(pix);
17 Franz 62
        QPainter painter( &textPix, this );
7782 jghali 63
#if defined _WIN32
7800 cbradney 64
        QFont font("Lucida Sans", 10);
65
#elif defined(__INNOTEK_LIBC__)
66
        QFont font("WarpSans", 9);
7782 jghali 67
#else
7800 cbradney 68
        QFont font("Bitstream Vera Sans", 10);
7782 jghali 69
#endif
7761 cbradney 70
        painter.setFont(font);
71
        painter.setPen(QColor(236,233,216));
3316 cbradney 72
        //painter.setRasterOp(NotROP);
7761 cbradney 73
        painter.drawText( 81, textPix.height()-8, tmp );
5452 avox 74
        painter.end();
17 Franz 75
        setErasePixmap( textPix );
76
        repaint();
162 Franz 77
}