示例#1
0
文件: main.cpp 项目: kammoh/kactus2
int main(int argc, char *argv[])
{
    Q_INIT_RESOURCE(kactus);
    QApplication a(argc, argv);

    // Set the palette to use nice pastel colors.
    QPalette palette = a.palette();
    palette.setColor(QPalette::Active, QPalette::Highlight, QColor(33, 135, 237));
    palette.setColor(QPalette::Disabled, QPalette::Highlight, QColor(166, 200, 234));
    palette.setColor(QPalette::Inactive, QPalette::Highlight, QColor(166, 200, 234));
    a.setPalette(palette);

	// Create the main window and close the splash after 1.5 seconds.
	MainWindow w;
		
	// the release mode
	#ifdef NDEBUG
	
	// Show the splash screen.
	SplashScreen splash;
    splash.show();
    splash.showMessage("");

	a.processEvents();

	QTimer::singleShot(1500, &splash, SLOT(close()));
	QTimer::singleShot(1500, &w, SLOT(show()));
	QTimer::singleShot(1700, &w, SLOT(onLibrarySearch()));

	// the debug mode
	#else
    QTimer::singleShot(200, &w, SLOT(onLibrarySearch()));
	w.show();    
	#endif    
    
	return a.exec();
}
示例#2
0
/**
* \brief Entry function.
* \param[in] argc - number of arguments
* \param[in] argv[] - argumnet list
* \return true if all went well
*/
int main(int argc, char *argv[])
{
	bool debug = false;
    bool remoteServers = true;
    QStringList localModules;
    QVector<MainWindow::Module> remoteModules;

	//process arguments
	for(int i=1; i<argc; i++)
	{
		QString cmd(argv[i]);

		if(cmd=="--debug")
		{
			debug = true;
		}
        else if(cmd=="--localMode")
        {
            remoteServers = false;
        }
		else if(cmd=="--localModules") // e.g. --localModules som,mtrnn,esn,tracker,era
		{
			QString module = argv[i+1];

			//read modules 
			if(!module.contains("--") || !module.isEmpty())
			{
				localModules = module.split(",");
				i++;
			}
		}
		else if(cmd=="--remoteModules") // e.g. --remoteModules 1=som,mtrnn,esn 2=tracker,era
		{
			QString command = argv[i+1];
			bool isNumber;

			//check if any modules were added at all
			if(!command.contains("--"))
			{

				//read modules until new parameter is found or no more parameters exist
				while(!command.contains("--") && i<argc-1)
				{
					i++;
					QStringList modules = command.split("=");

					if(!modules.empty())
					{
                        MainWindow::Module serverModule;
						modules.at(0).toInt(&isNumber);

						//check if the argument starts with server id
						if(isNumber)
						{
                            serverModule.serverID = modules.at(0);
                            serverModule.modules = modules.at(1).split(",");
                            remoteModules.push_back(serverModule);
						}
					}

					command = argv[i+1];
				}
			}
		}
	}

	//initialises message handeler
	if(!debug)
	{
		qInstallMsgHandler(customMessageHandler);
	}

    //current Aquila verions
    QString version = "Aquila 2.0";

    //localhost name
    QString hostName = QHostInfo::localHostName();

    //minimum version of YARP required for full support
    QString yarpVersion = "2.3.20";

    //add active developers to the list
    QStringList developers;
    developers<<" Martin Peniak"<<" & Anthony Morse";

    //initialise YARP
    yarp::os::Network yarp;

    //initialises Aquila and loads its icon
    QApplication *a = new QApplication(argc, argv);
    a->setWindowIcon(QPixmap(":/images/icon.png"));
    a->setAttribute(Qt::AA_X11InitThreads);

    //initialise splash screen
    QPixmap pixmap(":/images/splash.png");
    SplashScreen *splash = new SplashScreen(pixmap, 4);
    splash->setFont(QFont("Ariel", 8, QFont::Bold));
    splash->show();

    //initialise GUI, probe yarpservers, its modules and add local modules to GUI
    MainWindow *w = new MainWindow(0, version, hostName, yarpVersion);
    splash->showMessage(QString("Initialising ")+version,Qt::AlignLeft | Qt::AlignBottom,Qt::white);
    QObject::connect(a, SIGNAL(aboutToQuit()), w, SLOT(aboutToQuit()));
    a->processEvents();
    splash->showMessage(QObject::tr("Detecting available modules on the local network"),Qt::AlignLeft | Qt::AlignBottom,Qt::white);
    w->probeServers(remoteServers);
    a->processEvents();

	//start local modules
	if(!localModules.isEmpty())
	{
		splash->showMessage(QObject::tr("Starting local modules"),Qt::AlignLeft | Qt::AlignBottom,Qt::white);
		w->addLocalModules(localModules);
		a->processEvents();
	}

	//start remote modules
    if(!remoteModules.isEmpty())
	{
        if(remoteServers)
        {
            splash->showMessage(QObject::tr("Starting remote modules"),Qt::AlignLeft | Qt::AlignBottom,Qt::white);
            w->addRemoteModules(remoteModules);
            a->processEvents();
        }
        else
        {
            qWarning(" - main_gui: '--localMode' argument prevented remote modules from loading during startup");
        }
	}

	//load graphial user interface, show credits and close the splash
    splash->showMessage(QObject::tr("Loading graphical user interface"),Qt::AlignLeft | Qt::AlignBottom,Qt::white);
    a->processEvents();
    QString credits("Developed by");
    for(int i=0; i<developers.size(); i++)
    {
        credits.append(developers.at(i));
    }
    splash->showMessage(credits,Qt::AlignLeft | Qt::AlignBottom,Qt::white);
    a->processEvents();
    splash->finish(w);

    //show graphial user interface
    w->show();
    return a->exec();
}
示例#3
0
文件: main.cpp 项目: m2otech/emm
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    MainWindow w;

    QPixmap pixmap(":/app/icons/splash.png");

    SplashScreen *s = new SplashScreen(pixmap);
    s->show();
    s->showMessage("Event Music Machine starten...");

    QString path = Configuration::getStorageLocation();
    if (path == "") {
        QFileDialog dia(s);
        dia.setViewMode(QFileDialog::List);
        dia.setFileMode(QFileDialog::Directory);
        dia.setAcceptMode(QFileDialog::AcceptOpen);
        dia.setOptions(QFileDialog::ShowDirsOnly);
        dia.setWindowTitle(QObject::tr("Bitte selektieren Sie einen Ordner in dem die Konfigurations-Dateien abgelegt werden sollen."));
        if (dia.exec() == 1) {
            path = dia.selectedFiles().at(0);
            Configuration::setStorageLocation(path);
        }
    }

    s->showMessage("Slotspeicher verbinden...");
    if (!QFile(Configuration::getStorageLocation() + "/slotstore.emm").exists())
    {
        QMessageBox::information(s,"Slot-Speicher anlegen",QObject::tr("Es wurde keine gültige Slot-Datenbank gefunden. Sie wurde jetzt angelegt."));
        QFile::copy(":/slot-store.sqlite", Configuration::getStorageLocation() + "/slotstore.emm");
        QFile::setPermissions(Configuration::getStorageLocation() + "/slotstore.emm",QFile::ReadOther | QFile::WriteOther);
    }

    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    db.setDatabaseName(Configuration::getStorageLocation() + "/slotstore.emm");
    if (!db.open())
    {
        QMessageBox::warning(s,QObject::tr("Keine Verbindung zum Slot-Speicher"),QObject::tr("Es konnte keine Verbindung zum Slot-Speicher hergestellt werden!"));
    }

    s->showMessage("Verbindung zur Tastatur herstellen...");
    KeyboardController *keyController = KeyboardController::getInstance();
    QObject::connect(keyController, SIGNAL(errorOccured(QString)), s, SLOT(showErrorMessage(QString)));
    QObject::connect(keyController, SIGNAL(keyPressed(int,int)), &w, SLOT(keyboardSignal(int,int)));
    keyController->initializeKeyboardController();

    s->showMessage("Audiogeräte initialisieren...");

    AudioProcessor::getInstance()->initDevices(&w);

    s->showMessage("Audio-Plugins laden...");
    PluginLoader::loadPlugins();

    s->showMessage("Slots laden und überprüfen...");

    int number = 1;
    Configuration *config = Configuration::getInstance();
    for (int i=0;i<config->getLayer();i++)
    {
        for (int j=0;j<config->getVerticalSlots();j++)
        {
            for (int k=0;k<config->getHorizontalSlots();k++)
            {
                CartSlot *slot = AudioProcessor::getInstance()->getCartSlotWithNumber(number);
                s->showMessage("Slots laden und überprüfen...\r\n"+slot->getText1());
                if (slot->isMissing()) {
                    QMessageBox::information(s,"Datei wurde nicht gefunden","Slot "+QString::number(slot->getNumber())+" ("+slot->getText1()+") konnte nicht geladen werden, weil die Datei nicht gefunden wurde!");
                }
                number++;
            }
        }
    }
    s->showMessage("Benutzeroberfläche initialisieren...");
    w.init();
    s->close();


    w.show();
    return a.exec();
}
示例#4
0
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();
}