Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

splash.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2002 by Yann Hodique                                    *
00003  *   Yann.Hodique@lifl.fr                                                  *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  ***************************************************************************/
00010 
00011 #include <qapplication.h>
00012 #include <qpainter.h>
00013 #include <qpixmap.h>
00014 #include <qcolor.h>
00015 
00016 #include "splash.h"
00017 
00018 #if QT_VERSION < 0x030100
00019 #define WStyle_Splash WStyle_NoBorder | WStyle_StaysOnTop | WStyle_Tool | WX11BypassWM | WWinOwnDC
00020 #endif
00021 
00022 PLUGIN_FACTORY(Splash,"splash");
00023 
00024 Splash::Splash(QWidget * /*parent*/, const char *name, Master * session) 
00025     : Page(0, name, session, WStyle_Customize | WStyle_Splash), label(this) {
00026     QColor color1("lightgrey");
00027 //    QColor color2("white");
00028     label.setPaletteBackgroundColor(color1);
00029     m_timer = new QTimer(this);
00030     time = 2000;
00031 }
00032 
00033 Splash::~Splash() {}
00034 
00035 void Splash::repaint() {
00036     QWidget::repaint();
00037     QApplication::flush();
00038 }
00039 
00040 void Splash::setTime(int ms) {
00041     time = ms;
00042 }
00043 
00044 void Splash::mousePressEvent( QMouseEvent * ) {
00045     hide();
00046 }
00047 
00048 void Splash::timeout() {
00049     hide();
00050 }
00051 
00052 void Splash::append(const QString & msg) {
00053     
00054     m_timer->stop();
00055     label.setText(msg);
00056     label.adjustSize();
00057     resize(label.size());
00058     QRect scr = QApplication::desktop()->screenGeometry();
00059     
00060     move( scr.bottomRight() - rect().center() - rect().center());
00061     show();
00062     repaint();
00063     
00064     m_timer = new QTimer();
00065     
00066     connect(m_timer, SIGNAL(timeout()),
00067       SLOT(timeout()));
00068     
00069     m_timer->start(time,true);
00070     
00071 }

Generated on Sat May 10 15:09:28 2003 for qnet by doxygen1.3