KDevelop API Documentation

src/splashscreen.cpp

Go to the documentation of this file.
00001 #include <qlayout.h> 00002 #include <qpixmap.h> 00003 #include <qapplication.h> 00004 00005 00006 #include <kdebug.h> 00007 #include <klocale.h> 00008 #include <kstandarddirs.h> 00009 #include <kapplication.h> 00010 #include <kglobalsettings.h> 00011 #include <kdeversion.h> 00012 00013 #include <kmainwindow.h> 00014 #include "toplevel.h" 00015 00016 #include "splashscreen.h" 00017 #include "splashscreen.moc" 00018 00019 SplashScreen::SplashScreen() 00020 : QObject() 00021 { 00022 m_splash = new QWidget( 0, 00023 "splash", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop /*| WX11BypassWM */); 00024 00025 m_splash->installEventFilter( this ); 00026 00027 QVBoxLayout *vbox = new QVBoxLayout(m_splash); 00028 00029 QLabel *pixmap = new QLabel(m_splash); 00030 QPixmap pm; 00031 pm.load(locate("appdata", "pics/kdevelop-splash.png")); 00032 pixmap->setPixmap(pm); 00033 vbox->addWidget(pixmap); 00034 00035 m_message = new QLabel(m_splash); 00036 m_message->setPaletteForegroundColor(Qt::white); 00037 m_message->setBackgroundColor(Qt::black); 00038 vbox->addWidget(m_message); 00039 00040 showMessage(i18n("Starting core application")); 00041 00042 #if defined(KDE_IS_VERSION) 00043 #if (KDE_IS_VERSION(3,1,90)) 00044 QRect rect = KGlobalSettings::splashScreenDesktopGeometry(); 00045 #else 00046 QRect rect = QApplication::desktop()->screenGeometry( 00047 QApplication::desktop()->screenNumber(QPoint(0,0))); 00048 #endif 00049 #else 00050 QRect rect = QApplication::desktop()->screenGeometry( 00051 QApplication::desktop()->screenNumber(QPoint(0,0))); 00052 #endif 00053 m_splash->move(rect.x() + (rect.width() - m_splash->sizeHint().width()) / 2, 00054 rect.y() + (rect.height() - m_splash->sizeHint().height()) / 2); 00055 m_splash->setFixedSize(m_splash->sizeHint()); 00056 00057 m_splash->show(); 00058 } 00059 00060 00061 SplashScreen::~SplashScreen() 00062 { 00063 delete m_splash; 00064 } 00065 00066 00067 void SplashScreen::showMessage(const QString &message) 00068 { 00069 kdDebug(9000) << "SPLASH: message=" << message << endl; 00070 00071 m_message->setText(" " + message); 00072 kapp->processEvents(); 00073 } 00074 00075 bool SplashScreen::eventFilter(QObject* obj, QEvent* e) 00076 { 00077 if (obj == m_splash && e->type() == QEvent::MouseButtonRelease) { 00078 m_splash->hide(); 00079 return true; 00080 } 00081 return false; 00082 }
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Oct 6 17:39:14 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003