Back to index

scribus-ng  1.3.4.dfsg+svn20071115
splash.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #include <qapplication.h>
00008 #include <qpainter.h>
00009 #include <qpixmap.h>
00010 #include <qregexp.h>
00011 #include "splash.h"
00012 extern QPixmap loadIcon(QString nam);
00013 
00014 
00015 SplashScreen::SplashScreen() 
00016        : QWidget( 0, 0, WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop | WStyle_Tool |
00017        WStyle_Splash)
00018         //WX11BypassWM )
00019 {
00020        pix = loadIcon("Splash.png");
00021        Q_ASSERT(!pix.isNull());
00022        if (pix.isNull()) {
00023               pix = QPixmap(360, 200);
00024               pix.fill(Qt::darkGray);
00025        }
00026        setErasePixmap( pix );
00027        resize( pix.size() );
00028        QRect scr = QApplication::desktop()->screenGeometry();
00029        move( scr.center() - rect().center() );
00030        show();
00031        repaint();
00032 }
00033 
00034 void SplashScreen::mousePressEvent( QMouseEvent * )
00035 {
00036        hide();
00037 }
00038 
00039 void SplashScreen::repaint()
00040 {
00041        QWidget::repaint();
00042        QApplication::flush();
00043 }
00044 
00045 void SplashScreen::setStatus( const QString &message )
00046 {
00047        static QRegExp rx("&\\S*"); 
00048        QString tmp(message);
00049        int f = 0;
00050        while (f != -1)
00051        {
00052               f = tmp.find(rx);
00053               if (f != -1)
00054               {
00055                      tmp.remove(f, 1);
00056                      f = 0;
00057               }
00058        }
00059        QPixmap textPix(pix);
00060        QPainter painter( &textPix, this );
00061 #if defined _WIN32
00062        QFont font("Lucida Sans Unicode", 9);
00063 #elif defined(__INNOTEK_LIBC__)
00064        QFont font("WarpSans", 8);
00065 #else
00066        QFont font("Bitstream Vera Sans", 8);
00067 #endif
00068        painter.setFont(font);
00069 //     painter.setPen(QColor(236,233,216));
00070        //painter.setRasterOp(NotROP);
00071        painter.setPen(Qt::white);
00072        painter.drawText( 315, textPix.height()-8, tmp );
00073        painter.end();
00074        setErasePixmap( textPix );
00075        repaint();
00076 }