Subversion Repositories Scribus

Rev

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