Rev 10585 | Rev 10977 | 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> |
||
8501 | cbradney | 9 | #include <QMouseEvent> |
10200 | cbradney | 10 | #include <QPainter> |
11 | #include <QPixmap> |
||
12 | #include <QRegExp> |
||
13 | |||
17 | Franz | 14 | #include "splash.h" |
15 | |||
10200 | cbradney | 16 | #include "util.h" |
17 | #include "util_icon.h" |
||
4645 | subik | 18 | |
10200 | cbradney | 19 | |
10585 | fschmid | 20 | SplashScreen::SplashScreen() : QWidget( 0, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::Tool | Qt::SplashScreen) |
4967 | cbradney | 21 | //WX11BypassWM ) |
17 | Franz | 22 | { |
10200 | cbradney | 23 | pix = loadIcon("Splash.png", true); |
3288 | craig | 24 | Q_ASSERT(!pix.isNull()); |
5455 | avox | 25 | if (pix.isNull()) { |
26 | pix = QPixmap(360, 200); |
||
27 | pix.fill(Qt::darkGray); |
||
28 | } |
||
10585 | fschmid | 29 | QPalette palette; |
30 | palette.setBrush(backgroundRole(), QBrush(pix)); |
||
31 | setPalette(palette); |
||
17 | Franz | 32 | resize( pix.size() ); |
33 | QRect scr = QApplication::desktop()->screenGeometry(); |
||
34 | move( scr.center() - rect().center() ); |
||
35 | show(); |
||
36 | repaint(); |
||
37 | } |
||
38 | |||
39 | void SplashScreen::mousePressEvent( QMouseEvent * ) |
||
40 | { |
||
41 | hide(); |
||
42 | } |
||
43 | |||
44 | void SplashScreen::repaint() |
||
45 | { |
||
46 | QWidget::repaint(); |
||
47 | QApplication::flush(); |
||
48 | } |
||
49 | |||
50 | void SplashScreen::setStatus( const QString &message ) |
||
51 | { |
||
7784 | cbradney | 52 | static QRegExp rx("&\\S*"); |
53 | QString tmp(message); |
||
320 | Franz | 54 | int f = 0; |
55 | while (f != -1) |
||
56 | { |
||
10517 | cbradney | 57 | f = tmp.indexOf(rx); |
320 | Franz | 58 | if (f != -1) |
59 | { |
||
60 | tmp.remove(f, 1); |
||
61 | f = 0; |
||
62 | } |
||
63 | } |
||
7784 | cbradney | 64 | QPixmap textPix(pix); |
8660 | subik | 65 | QPainter painter( &textPix);// Qt4, this ); |
7782 | jghali | 66 | #if defined _WIN32 |
9352 | cbradney | 67 | QFont font("Lucida Sans Unicode", 9); |
7800 | cbradney | 68 | #elif defined(__INNOTEK_LIBC__) |
9352 | cbradney | 69 | QFont font("WarpSans", 8); |
10856 | cbradney | 70 | #elif defined(Q_OS_MAC) |
71 | QFont font("Helvetica Regular", 11); |
||
7782 | jghali | 72 | #else |
9352 | cbradney | 73 | QFont font("Bitstream Vera Sans", 8); |
7782 | jghali | 74 | #endif |
7761 | cbradney | 75 | painter.setFont(font); |
9334 | fschmid | 76 | // painter.setPen(QColor(236,233,216)); |
9352 | cbradney | 77 | painter.setPen(Qt::white); |
3316 | cbradney | 78 | //painter.setRasterOp(NotROP); |
9352 | cbradney | 79 | painter.drawText( 315, textPix.height()-8, tmp ); |
5452 | avox | 80 | painter.end(); |
10585 | fschmid | 81 | QPalette palette; |
82 | palette.setBrush(backgroundRole(), QBrush(textPix)); |
||
83 | setPalette(palette); |
||
17 | Franz | 84 | repaint(); |
162 | Franz | 85 | } |