void SplashScreen::showSplash(QThread *thread) { double opacity = OPACITY_DELTA; const int opacitySteps = qRound(1.0 / OPACITY_DELTA); SplashScreen *splashScreen = new SplashScreen(); bool bTaskBar = false; //Show splash splashScreen->m_canClose = false; splashScreen->setWindowOpacity(opacity); splashScreen->setFixedSize(splashScreen->size()); splashScreen->show(); //Wait for window to show QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); splashScreen->repaint(); QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); //Setup the event loop QEventLoop *loop = new QEventLoop(splashScreen); connect(thread, SIGNAL(terminated()), loop, SLOT(quit()), Qt::QueuedConnection); connect(thread, SIGNAL(finished()), loop, SLOT(quit()), Qt::QueuedConnection); //Create timer QTimer *timer = new QTimer(); connect(timer, SIGNAL(timeout()), loop, SLOT(quit())); //Start thread QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); thread->start(); QApplication::processEvents(QEventLoop::ExcludeUserInputEvents); //Init taskbar SET_TASKBAR_STATE(true); //Fade in for(int i = 1; i <= opacitySteps; i++) { opacity = (i < opacitySteps) ? (OPACITY_DELTA * static_cast<double>(i)) : 1.0; splashScreen->setWindowOpacity(opacity); splashScreen->update(); QApplication::processEvents(QEventLoop::ExcludeUserInputEvents, FADE_DELAY); SET_TASKBAR_STATE(true); Sleep(FADE_DELAY); } //Start the timer timer->start(30720); //Loop while thread is still running if(bool bIsRunning = THREAD_RUNNING(thread)) { int deadlockCounter = 0; while(bIsRunning) { loop->exec(); if(bIsRunning = THREAD_RUNNING(thread)) { qWarning("Potential deadlock in initialization thread!"); if(++deadlockCounter >= 10) qFatal("Deadlock in initialization thread!"); } } } //Stop the timer timer->stop(); //Fade out for(int i = opacitySteps; i >= 0; i--) { opacity = OPACITY_DELTA * static_cast<double>(i); splashScreen->setWindowOpacity(opacity); splashScreen->update(); QApplication::processEvents(QEventLoop::ExcludeUserInputEvents, FADE_DELAY); Sleep(FADE_DELAY); } //Restore taskbar SET_TASKBAR_STATE(false); //Hide splash splashScreen->m_canClose = true; splashScreen->close(); //Free LAMEXP_DELETE(loop); LAMEXP_DELETE(timer); LAMEXP_DELETE(splashScreen); }
int main( int argc, char *argv[] ) { static const char description[] = I18N_NOOP( "The KDevelop Integrated Development Environment" ); KAboutData aboutData( "kdevelop", 0, ki18n( "KDevelop" ), VERSION, ki18n(description), KAboutData::License_GPL, ki18n( "(c) 1999-2007, The KDevelop developers" ), KLocalizedString(), "http://www.kdevelop.org" ); aboutData.addAuthor( ki18n("Matt Rogers"), ki18n( "Maintainer" ), "*****@*****.**"); aboutData.addAuthor( ki18n("Alexander Dymo"), ki18n( "Co-maintainer, architecture, Sublime UI, Ruby support" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Amilcar do Carmo Lucas"), ki18n( "Release coordinator, API documentation, Doxygen and autoproject patches" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Bernd Gehrmann"), ki18n( "Initial idea, basic architecture, much initial source code" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Caleb Tennis"), ki18n( "KTabBar, bugfixes" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Richard Dale"), ki18n( "Java & Objective C support" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("John Birch"), ki18n( "Debugger frontend" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Sandy Meier"), ki18n( "PHP support, context menu stuff" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Kurt Granroth"), ki18n( "KDE application templates" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Ian Reinhart Geiser"), ki18n( "Dist part, bash support, application templates" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Matthias Hoelzer-Kluepfel"), ki18n( "Several components, htdig indexing" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Victor Roeder"), ki18n( "Help with Automake manager and persistant class store" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Harald Fernengel"), ki18n( "Ported to Qt 3, patches, valgrind, diff and perforce support" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Roberto Raggi"), ki18n( "QEditor component, code completion, Abbrev component, C++ support, Java support" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Hamish Rodda"), ki18n( "Text editor integration, definition-use chain" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Simon Hausmann"), ki18n( "Help with KParts infrastructure" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Oliver Kellogg"), ki18n( "Ada support" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Jakob Simon-Gaarde"), ki18n( "QMake projectmanager" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Andreas Pakulat"), ki18n( "Project Management Support, QMake Projectmanager" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("F@lk Brettschneider"), ki18n( "MDI modes, QEditor, bugfixes" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Mario Scalas"), ki18n( "PartExplorer, redesign of CvsPart, patches, bugs(fixes)" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Jens Dagerbo"), ki18n( "Replace, Bookmarks, FileList and CTags2 plugins. Overall improvements and patches" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Julian Rockey"), ki18n( "Filecreate part and other bits and patches" ), "*****@*****.**" ); aboutData.addAuthor( ki18n("Dukju Ahn"), ki18n( "Subversion plugin, Custom Make Manager, Overall improvements" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Ajay Guleria"), ki18n( "ClearCase support" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Marek Janukowicz"), ki18n( "Ruby support" ), "*****@*****.**" ); aboutData.addCredit( ki18n("The KWrite authors"), ki18n( "Kate editor component" ), "*****@*****.**" ); aboutData.addCredit( ki18n("The KHTML authors"), ki18n( "HTML documentation component" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Robert Moniot"), ki18n( "Fortran documentation" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Ka-Ping Yee"), ki18n( "Python documentation utility" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Dimitri van Heesch"), ki18n( "Doxygen wizard" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Hugo Varotto"), ki18n( "Fileselector component" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Matt Newell"), ki18n( "Fileselector component" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Trolltech AS"), ki18n( "Designer code" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Daniel Engelschalt"), ki18n( "C++ code completion, persistant class store" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Stephane ANCELOT"), ki18n( "Patches" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Jens Zurheide"), ki18n( "Patches" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Luc Willems"), ki18n( "Help with Perl support" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Marcel Turino"), ki18n( "Documentation index view" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Yann Hodique"), ki18n( "Patches" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Tobias Gl\303\244\303\237er") , ki18n( "Documentation Finder, qmake projectmanager patches, usability improvements, bugfixes ... " ), "*****@*****.**" ); aboutData.addCredit( ki18n("Andreas Koepfle") , ki18n( "QMake project manager patches" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Sascha Cunz") , ki18n( "Cleanup and bugfixes for qEditor, AutoMake and much other stuff" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Robert Gruber") , ki18n( "SnippetPart, debugger and usability patches" ), "*****@*****.**" ); aboutData.addCredit( ki18n("Zoran Karavla"), ki18n( "Artwork for the ruby language" ), "*****@*****.**", "http://the-error.net" ); KCmdLineArgs::init( argc, argv, &aboutData ); KCmdLineOptions options; options.add("profile <profile>", ki18n( "Profile to load" )); options.add("project <project>", ki18n( "Project to load" )); options.add("+file(s)", ki18n( "Files to load" )); KCmdLineArgs::addCmdLineOptions( options ); KCmdLineArgs* args = KCmdLineArgs::parsedArgs(); Q_UNUSED(args) KApplication app; KDevIDEExtension::init(); SplashScreen *splash = 0; QString splashFile = KStandardDirs::locate( "appdata", "pics/kdevelop-splash.png" ); if ( !splashFile.isEmpty() ) { QPixmap pm; pm.load( splashFile ); splash = new SplashScreen( pm ); splash->show(); splash->repaint(); } using namespace KDevelop; //initialize the api object //WARNING! the order is important Core::initialize(); /* Core::setPartController( new PartController ); Core::setDocumentController( new DocumentController );*/ // Core::self()->pluginController()->loadPlugins( PluginController::Global ); // Core::setLanguageController( new LanguageController ); // Core::setProjectController( new ProjectController ); // Core::setBackgroundParser( new BackgroundParser ); // Core::setEnvironment( new Environment ); if ( splash ) { QObject::connect(Core::self()->pluginController(), SIGNAL(loadingPlugin(const QString&)), splash, SLOT(showMessage(const QString&))); QTimer::singleShot(0, splash, SLOT(deleteLater())); splash->showMessage( i18n( "Starting GUI" ) ); } bool openProject = false; QString projectName = args->getOption("project"); if ( !projectName.isEmpty() ) { Core::self()->projectController()->openProject( KUrl(projectName) ); openProject = true; } else if( args->count() > 0 ) { KUrl url = args->url( 0 ); QString ext = QFileInfo( url.fileName() ).suffix(); if( ext == "kdev4" ) { Core::self()->projectController()->openProject( url ); openProject = true; } } if( !openProject ) { for( int a=0; a<args->count(); ++a ) { QString file = args->arg(a); //Allow opening specific lines in documents, like mydoc.cpp:10 int line = -1; int lineNumberOffset = file.lastIndexOf(':'); if( lineNumberOffset != -1 ) { bool ok; line = file.mid(lineNumberOffset+1).toInt(&ok); if( !ok ) line = -1; else file = file.left(lineNumberOffset); } if( KUrl::isRelativeUrl(file) ) { KUrl u = QDir::currentPath(); u.addPath(file); file = u.path(); } Core::self()->documentController()->openDocument( KUrl( file ), line != -1 ? KTextEditor::Cursor(line, 0) : KTextEditor::Cursor() ); } if( splash && args->count() == 1 ) splash->showMessage(args->url(0).prettyUrl()); } return app.exec(); }