00001
00002
00003
00004
00005
00006
00007
00008
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 * , const char *name, Master * session)
00025 : Page(0, name, session, WStyle_Customize | WStyle_Splash), label(this) {
00026 QColor color1("lightgrey");
00027
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 }