bool Project_Gravity::setup(void)
{
	std::cout<<"setup"<<std::endl;
	
	// Setup resources
    mRoot = new Ogre::Root(mPluginsCfg);
    setupResources();

	// Configure the settings
    bool carryOn = configure();
    if (!carryOn) return false;

	// Initialize ogre elements
    chooseSceneManager();
    createCamera();
    createViewports();

	initCEGUI();
	
	SplashScreen *splashScreen = new SplashScreen(mWindow);
	splashScreen->show();


    // Set default mipmap level (NB some APIs ignore this)
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

	return true;
}
void CryptobullionApplication::createSplashScreen(bool isaTestNet)
{
    SplashScreen *splash = new SplashScreen(QPixmap(), isaTestNet);
    splash->setAttribute(Qt::WA_DeleteOnClose);
    splash->show();
    connect(this, SIGNAL(splashFinished(QWidget*)), splash, SLOT(slotFinish(QWidget*)));
}
Example #3
0
SplashScreen* SplashScreen::create()
{
    SplashScreen* screen = new SplashScreen();
    screen->autorelease();
    
    return screen;
}
void Game::ShowSplashScreen()
{	
  SplashScreen splashScreen;

  splashScreen.Show(_mainWindow);
 _gameState = Game::ShowingMenu;
}
Example #5
0
void Game::GameLoop() {

	sf::Event event;
	Screen screen;
	SplashScreen splashScreen;
		while (renderWindow.pollEvent(event)) {

			switch (gameState) {
			case Game::ScreenMenu: {
				renderWindow.clear(sf::Color::Blue);
				renderWindow.display();
				break;
			}
			case Game::ScreenSplash: {
					
				splashScreen.showScreen(renderWindow);
				gameState = splashScreen.processChoice();
				break;
			}
			case Game::ScreenGame: {
				break;
			}
			case Game::ScreenScore: {
				break;
			}
			}
			if (event.type == sf::Event::Closed) {
				gameState = Exiting;
			}

		}
}
Example #6
0
BOOL InformApp::InitInstance()
{
  InitCommonControls();
  CWinApp::InitInstance();
  theOS.Init();
  theOS.BufferedPaintInit();

  if (!AfxOleInit())
    return FALSE;
  if (!Scintilla_RegisterClasses(AfxGetInstanceHandle()))
    return FALSE;

  if (GetIEVersion() < 5.0)
  {
    CString msg;
    msg.Format("Internet Explorer version 5 or higher must be installed.");
    AfxMessageBox(msg,MB_ICONSTOP|MB_OK);
    exit(0);
  }
  CheckMSXML();

  SetRegistryKey("David Kinder");
  SetFonts();
  ReportHtml::SetIEPreferences(REGISTRY_PATH_BROWSER);

  // Set the HOME environment variable to the My Documents folder,
  // used by the Natural Inform compiler, and make sure directories
  // under My Documents exist.
  SetMyDocuments();

  // Discard any log file from a previous run
  /*::DeleteFile(m_home+LOG_FILE);*/

  // Install the protocol for inform: URLs
  m_protocol.Install(L"inform");
  CString dir = GetAppDir();
  m_protocol.AddDirectory(dir+"\\Documentation");
  m_protocol.AddDirectory(dir+"\\Documentation\\doc_images");
  m_protocol.AddDirectory(dir+"\\Documentation\\sections");
  m_protocol.AddDirectory(L"//Extensions",m_home+"\\Inform\\Documentation");
  m_protocol.AddDirectory(L"//Extensions",dir+"\\Documentation");

  // Find and create documentation for extensions
  FindExtensions();
  RunCensus(false);

  // Show the splash screen
  SplashScreen splash;
  splash.ShowSplash();

  // Only continue if a project has been opened
  if (AfxGetMainWnd() == NULL)
    return FALSE;
  return TRUE;
}
Example #7
0
int main()
{
	SetupCallbacks();

	scePowerSetClockFrequency(333, 333, 166);

	//initialize render manager
	RenderManager::InstancePtr()->Init();
	RenderManager::InstancePtr()->CollectPerformance(true);
	RenderManager::InstancePtr()->InitDebugFont();

	//set perspectives
	RenderManager::InstancePtr()->SetOrtho(0,0,0,0,0,0);
	
	//init and load sounds
	SoundManager::Instance()->Init();

	srand(time(NULL));

	//new state manager
	StateManager stateManager;
	stateManager.Init();

	RenderManager::InstancePtr()->SetClearColour(0xFF000000);

	//splash screens
	SplashScreen *screen = new SplashScreen(TextureHelper::Instance()->GetTexture(TextureHelper::Genesis),0,0,480,272,3);
	screen->ShowSplash();
	delete screen;
	SplashScreen *screen2 = new SplashScreen(TextureHelper::Instance()->GetTexture(TextureHelper::PspTeam),0,0,424,72,3);
	screen2->ShowSplash();
	delete screen2;

	RenderManager::InstancePtr()->SetClearColour(0xFFF5B783);

	//new active state
	StateMenu *statePlay = new StateMenu();
	statePlay->Init();
	stateManager.ChangeState(statePlay);

	//trun
	while ( stateManager.Running() )
	{
		stateManager.HandleEvents();
		stateManager.Update();
		stateManager.Draw();
	}

	sceGuTerm();			// Terminating the Graphics System
	sceKernelExitGame();	// Quits Application

	return 0;
}
Example #8
0
int main(int argc, char *argv[])
{
	SplashScreen *ss;
	QApplication a(argc, argv);
	QString routeFile;

	QCoreApplication::setOrganizationName("IvimeyCom");
	QCoreApplication::setOrganizationDomain("ivimey.com");
	QCoreApplication::setApplicationName(PROGRAM_NAME);

	setupLogEngine();

	for(int i = 1; i < argc; i++)
	{
		if (argv[i][0] == '-')
		{
			if (strcmp(argv[i], "--help") == 0)
			{
				printf(PROGRAM_NAME " (c) 2013-2014 IvimeyCom, by Ruth Ivimey-Cook\n"
						"\nUsage: RWMapMaker [--help] [path..to..RouteProperties.xml]\n");
				exit(0);
			}
		}
		else
		{
			routeFile = argv[i];
			break;
		}
	}

	ss = new SplashScreen();
	ss->show();
	try
	{
		RWMapMaker *w = new RWMapMaker(routeFile);
		w->show();
		return a.exec();
	}
	catch(std::exception ex)
	{
		printf(PROGRAM_NAME " Exception caught:\n%s", ex.what());
		exit(1);
	}
	catch(...)
	{
		printf(PROGRAM_NAME " Exception caught:\n");
		exit(2);
	}
}
Example #9
0
int main(int argc, char *argv[]) {
	std::cout << "Itchy++" << std::flush;

	QApplication a(argc, argv);

	SplashScreen *splash = new SplashScreen(true, QPixmap(":/logos/res/splash.png"));
	splash->show();

	itchy w;
    w.show();

    splash->hide();

	return a.exec();
}
Example #10
0
    //==============================================================================
    void initialise (const String& /*commandLine*/)
    {
#if JUCE_DEBUG && DROWAUDIO_UNIT_TESTS
        UnitTestRunner testRunner;
        testRunner.runAllTests();
#endif
        
        SplashScreen* splash = new SplashScreen();
        splash->show ("dRowAudio Demo",
                      ImageCache::getFromMemory (BinaryData::splash_screen_png, BinaryData::splash_screen_pngSize),
                      0, true);

        // Do your application's initialisation code here..
        mainWindow = new MainAppWindow();
    }
Example #11
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    Configuration::getInstance()->mainWindow = new Output();
    Output *w = static_cast<Output*>(Configuration::getInstance()->mainWindow); 
//    w.show();
    SplashScreen *splash = new SplashScreen(4000);
    splash->show();
    qDebug()<<w;
    
    Q_ASSERT(SIEmethods::mW);
    
    splash->connect(splash,SIGNAL(startApp()),w,SLOT(start()));
  return a.exec();
}
Example #12
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    for(int i =0 ; i< argc ; i++)
    {
        QString arg(argv[i]);
        if(arg == "rotate" || arg == "-rotate" || arg == "-r")
        {
            //CHECK Value
            if(i < argc-1)
            {
                QString value(argv[i+1]);
                bool success;
                int v = value.toInt(&success);
                if(success){
                    QTransform trans;
                    trans.translate(180,120);
                    trans.rotate(v);
                    trans.translate(-180,-120);
                    Configuration::getInstance()->transform = trans;
                }else
                {
                    qDebug() <<"WARNING: Invalid value for rotate";
                }
            }else
            {
                qDebug()<<"WARNING: You must provide an angle (degrees) after rotate";
            }
        }
    }
    QApplication::setOverrideCursor(Qt::BlankCursor);

    Output *w = new Output(24);
    qDebug()<<w->cursor().pos();
    w->cursor().setPos(320,240);
    SplashScreen *splash = new SplashScreen(3000);

    QFile bold(":fonts/Bold");
    bold.open(QIODevice::ReadOnly);
    int id = QFontDatabase::addApplicationFontFromData(bold.readAll());
    QFont f(QFontDatabase::applicationFontFamilies(id).first());
    QApplication::setFont(f);
    splash->showFullScreen();
    splash->connect(splash,SIGNAL(startApp()),w,SLOT(start()));

  return a.exec();
}
Example #13
0
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();
}
Example #14
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();
}
Example #15
0
/*!
 * \brief OMEditApplication::OMEditApplication
 * \param argc
 * \param argv
 * \param threadData
 */
OMEditApplication::OMEditApplication(int &argc, char **argv, threadData_t* threadData)
  : QApplication(argc, argv)
{
  // set the stylesheet
  setStyleSheet("file:///:/Resources/css/stylesheet.qss");
#if !(QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
  QTextCodec::setCodecForTr(QTextCodec::codecForName(Helper::utf8.toLatin1().data()));
  QTextCodec::setCodecForCStrings(QTextCodec::codecForName(Helper::utf8.toLatin1().data()));
#endif
#ifndef WIN32
  QTextCodec::setCodecForLocale(QTextCodec::codecForName(Helper::utf8.toLatin1().data()));
#endif
  setAttribute(Qt::AA_DontShowIconsInMenus, false);
  // Localization
  //*a.severin/ add localization
  const char *omhome = getenv("OPENMODELICAHOME");
#ifdef WIN32
  if (!omhome) {
    QMessageBox::critical(0, QString(Helper::applicationName).append(" - ").append(Helper::error),
                          GUIMessages::getMessage(GUIMessages::OPENMODELICAHOME_NOT_FOUND), Helper::ok);
    quit();
    exit(1);
  }
#else /* unix */
  omhome = omhome ? omhome : CONFIG_DEFAULT_OPENMODELICAHOME;
#endif
  QSettings *pSettings = Utilities::getApplicationSettings();
  QLocale settingsLocale = QLocale(pSettings->value("language").toString());
  settingsLocale = settingsLocale.name() == "C" ? pSettings->value("language").toLocale() : settingsLocale;
  QString locale = settingsLocale.name().isEmpty() ? QLocale::system().name() : settingsLocale.name();
  /* Set the default locale of the application so that QSpinBox etc show values according to the locale.
   * Set OMEdit locale to C so that we get dot as decimal separator instead of comma.
   */
  QLocale::setDefault(QLocale::c());

  QString translationDirectory = omhome + QString("/share/omedit/nls");
  // install Qt's default translations
  QTranslator *pQtTranslator = new QTranslator(this);
#ifdef Q_OS_WIN
  pQtTranslator->load("qt_" + locale, translationDirectory);
#else
  pQtTranslator->load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
#endif
  installTranslator(pQtTranslator);
  // install application translations
  QTranslator *pTranslator = new QTranslator(this);
  pTranslator->load("OMEdit_" + locale, translationDirectory);
  installTranslator(pTranslator);
  // Splash Screen
  QPixmap pixmap(":/Resources/icons/omedit_splashscreen.png");
  SplashScreen *pSplashScreen = SplashScreen::instance();
  pSplashScreen->setPixmap(pixmap);
  pSplashScreen->show();
  Helper::initHelperVariables();
  /* Force C-style doubles */
  setlocale(LC_NUMERIC, "C");
  // if user has requested to open the file by passing it in argument then,
  bool debug = false;
  QString fileName = "";
  QStringList fileNames;
  if (arguments().size() > 1) {
    for (int i = 1; i < arguments().size(); i++) {
      if (strncmp(arguments().at(i).toStdString().c_str(), "--Debug=",8) == 0) {
        QString debugArg = arguments().at(i);
        debugArg.remove("--Debug=");
        if (0 == strcmp("true", debugArg.toStdString().c_str())) {
          debug = true;
        } else {
          debug = false;
        }
      } else {
        fileName = arguments().at(i);
        if (!fileName.isEmpty()) {
          // if path is relative make it absolute
          QFileInfo file (fileName);
          QString absoluteFileName = fileName;
          if (file.isRelative()) {
            absoluteFileName = QString("%1/%2").arg(QDir::currentPath()).arg(fileName);
          }
          absoluteFileName = absoluteFileName.replace("\\", "/");
          if (QFile::exists(absoluteFileName)) {
            fileNames << absoluteFileName;
          } else {
            printf("Invalid command line argument: %s %s\n", fileName.toStdString().c_str(), absoluteFileName.toStdString().c_str());
          }
        }
      }
    }
  }
  // MainWindow Initialization
  MainWindow *pMainwindow = MainWindow::instance(debug);
  pMainwindow->setUpMainWindow(threadData);
  if (pMainwindow->getExitApplicationStatus()) {        // if there is some issue in running the application.
    quit();
    exit(1);
  }
  // open the files passed as command line arguments
  foreach (QString fileName, fileNames) {
    pMainwindow->getLibraryWidget()->openFile(fileName);
  }
Example #16
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();
}
int InteractiveApplication::run(int argc, char** argv)
{
   // Generate the XML files
   if (generateXml() == false)
   {
      return -1;
   }

   // Set the application to run in interactive mode
   ApplicationServicesImp* pApp = ApplicationServicesImp::instance();
   if (pApp != NULL)
   {
      pApp->setInteractive();
   }

   // Initialize the Qt application
   QApplication& qApplication = dynamic_cast<QApplication&>(getQApp());
#if !defined(LINUX)
   qApplication.setFont(QFont("Tahoma", 8));
#endif

   bool configSettingsValid = false;
   string configSettingsErrorMsg = "";

   ConfigurationSettingsImp* pConfigSettings = ConfigurationSettingsImp::instance();
   if (pConfigSettings != NULL)
   {
      configSettingsValid = pConfigSettings->isInitialized();
      if (pConfigSettings->getInitializationErrorMsg() != NULL)
      {
         configSettingsErrorMsg = pConfigSettings->getInitializationErrorMsg();
      }
      if (configSettingsValid)
      {
         pConfigSettings->validateInitialization();
         configSettingsValid = pConfigSettings->isInitialized();
         if (pConfigSettings->getInitializationErrorMsg() != NULL)
         {
            configSettingsErrorMsg = pConfigSettings->getInitializationErrorMsg();
         }
      }
   }

   if (!configSettingsValid)
   {
      if (configSettingsErrorMsg.empty())
      {
         configSettingsErrorMsg = "Unable to locate configuration settings";
      }

      reportError(configSettingsErrorMsg);
      return -1;
   }
   else
   {
      if (!configSettingsErrorMsg.empty())
      {
         reportWarning(configSettingsErrorMsg);
      }
   }

   { // scope the lifetime of the lock
      SessionSaveLock lock;

      // Create a progress object
      mpProgress = new ProgressAdapter();

      // Splash screen
      Q_INIT_RESOURCE(Application);
      SplashScreen* pSplash = new SplashScreen(mpProgress);
      vector<string> splashPaths = Service<InstallerServices>()->getSplashScreenPaths();
      pSplash->setSplashImages(list<string>(splashPaths.begin(), splashPaths.end()));
      pSplash->show();

      qApplication.processEvents();

      // process pending extension uninstalls
      InstallerServicesImp::instance()->processPending(mpProgress);
      string errMsg;
      if(!ConfigurationSettingsImp::instance()->loadSettings(errMsg))
      {
         if (QMessageBox::warning(pSplash, "Error loading configuration settings",
            QString("Warning: unable to reload application settings.\n%1\nContinue loading Opticks?").arg(QString::fromStdString(errMsg)),
            QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::No)
         {
            pSplash->close();
            delete pSplash;
            return -1;
         }
      }

      // Initialization
      int iReturn = Application::run(argc, argv);
      if (iReturn == -1)
      {
         pSplash->close();
         delete pSplash;
         return -1;
      }

      qApplication.processEvents();

      // process auto-installs
      QDirIterator autos(QString::fromStdString(ConfigurationSettingsImp::instance()->getSettingExtensionFilesPath()->getFullPathAndName())
         + "/AutoInstall", QStringList() << "*.aeb", QDir::Files);
      vector<string> pendingInstall;
      while (autos.hasNext())
      {
         pendingInstall.push_back(autos.next().toStdString());
      }
      bool autoInstallOccurred = false;
      InstallerServicesImp::instance()->setPendingInstall(pendingInstall);
      for (vector<string>::iterator autoIter = pendingInstall.begin();
           autoIter != pendingInstall.end();
           ++autoIter)
      {
         bool success = InstallerServicesImp::instance()->installExtension(*autoIter, mpProgress);
         if(!success)
         {
            QFileInfo autoInfo(QString::fromStdString(*autoIter));
            // Attempt to parse the AEB so we can get a better name
            string extName = autoInfo.fileName().toStdString();
            { // scope the AebIo so we don't hold a handle to the aeb file and can delete it below
               Aeb extension;
               AebIo io(extension);
               string errMsg; // ignored
               if (io.fromFile(autoInfo.filePath().toStdString(), errMsg))
               {
                  extName = extension.getName();
               }
            }
            if(DesktopServicesImp::instance()->showMessageBox("Installation error", "Unable to install " + extName
               + "\nWould you like to delete the file?", "Yes", "No") == 0)
            {
               QFile::remove(QString::fromStdString(*autoIter));
            }
         }
         else
         {
            autoInstallOccurred = true;
            QFile::remove(QString::fromStdString(*autoIter));
         }
      }
      InstallerServicesImp::instance()->setPendingInstall();
      if (autoInstallOccurred)
      {
         // rescan the plug-ins
         PlugInManagerServicesImp::instance()->buildPlugInList(Service<ConfigurationSettings>()->getPlugInPath());
      }


      // Create the main GUI window
      mpProgress->updateProgress("Creating the main application window...", 0, NORMAL);

      ApplicationWindow* pAppWindow = new ApplicationWindow(pSplash);
      qApplication.processEvents();

      // Execute startup plug-ins
      PlugInManagerServicesImp* pManager = PlugInManagerServicesImp::instance();
      if (pManager != NULL)
      {
         pManager->executeStartupPlugIns(mpProgress);
         qApplication.processEvents();
      }

      // Restore the previous position and visibility state of the toolbars and dock windows
      pAppWindow->restoreConfiguration();

      // Keep the splash screen up until all images have been shown to the user.
      while (!pSplash->canClose()) {}

      // Display the main application window
      pAppWindow->show();

      // Destroy the splash screen
      pSplash->close();
      delete pSplash;

      // Create a progress dialog
      ProgressDlg* pProgressDlg = new ProgressDlg(APP_NAME, pAppWindow);
      mpProgress->attach(SIGNAL_NAME(Subject, Modified), Slot(pProgressDlg, &ProgressDlg::progressUpdated));
      mpProgress->attach(SIGNAL_NAME(Subject, Deleted), Slot(pProgressDlg, &ProgressDlg::progressDeleted));

      // Load files specified on the command line
      ArgumentList* pArgList(ArgumentList::instance());
      if (pArgList != NULL)
      {
         FileType fileType;

         vector<string> filenames(pArgList->getOptions(""));
         for (vector<string>::size_type i = 0; i < filenames.size(); ++i)
         {
            FilenameImp filename(filenames[i]);

            QString strFilename = QString::fromStdString(filename.getFullPathAndName());
            if (strFilename.isEmpty() == false)
            {
               QFileInfo info(strFilename);
               if ((info.suffix() == "wiz") || (info.suffix() == "batchwiz"))
               {
                  if ((fileType.isValid() == true) && (fileType != WIZARD_FILES))
                  {
                     fileType = EnumWrapper<FileTypeEnum>();
                     break;
                  }

                  fileType = WIZARD_FILES;
               }
               else if (info.suffix() == "session")
               {
                  if (fileType.isValid() == true)
                  {
                     fileType = EnumWrapper<FileTypeEnum>();
                     break;
                  }

                  fileType = SESSION_FILE;
               }
               else
               {
                  if ((fileType.isValid() == true) && (fileType != DATASET_FILES))
                  {
                     fileType = EnumWrapper<FileTypeEnum>();
                     break;
                  }

                  fileType = DATASET_FILES;
               }
            }
         }

         if (fileType.isValid() == true)
         {
            // Check for valid filenames
            vector<string> validFilenames;
            for (vector<string>::size_type i = 0; i < filenames.size(); ++i)
            {
               FilenameImp filename(filenames[i]);

               string normalizedFilename = filename.getFullPathAndName();
               if (normalizedFilename.empty() == false)
               {
                  QString strFilename = QString::fromStdString(normalizedFilename);

                  QFileInfo info(strFilename);
                  if ((info.isFile() == true) && (info.exists() == true))
                  {
                     validFilenames.push_back(normalizedFilename);
                  }
                  else
                  {
                     reportWarning("The specified file '" + normalizedFilename +
                        "' does not exist and cannot be loaded.");
                  }
               }
            }

            // Load the files
            switch (fileType)
            {
               case WIZARD_FILES:
               {
                  for (vector<string>::size_type i = 0; i < validFilenames.size(); ++i)
                  {
                     string filename = validFilenames[i];
                     QString strFilename = QString::fromStdString(filename);

                     QFileInfo info(strFilename);
                     if (info.suffix() == "wiz")
                     {
                        pAppWindow->runWizard(strFilename);
                     }
                     else if (info.suffix() == "batchwiz")
                     {
                        vector<string> batchFiles;
                        batchFiles.push_back(filename);
                        WizardUtilities::runBatchFiles(batchFiles, mpProgress);
                     }
                  }

                  break;
               }

               case SESSION_FILE:
               {
                  if (validFilenames.empty() == false)
                  {
                     VERIFYRV(validFilenames.size() == 1, -1);
                     string filename = validFilenames.front();

                     string saveKey = SessionManager::getSettingQueryForSaveKey();
                     SessionSaveType saveType = SESSION_DONT_AUTO_SAVE;
                     DataVariant dvSaveType(saveType);

                     pConfigSettings->adoptTemporarySetting(saveKey, dvSaveType);
                     pAppWindow->openSession(QString::fromStdString(filename));
                     pConfigSettings->deleteTemporarySetting(saveKey);
                  }

                  break;
               }

               case DATASET_FILES:
               {
                  if (validFilenames.empty() == false)
                  {
                     ImporterResource importer("Auto Importer", validFilenames, mpProgress, false);
                     importer->execute();
                  }

                  break;
               }

               default:
                  break;
            }
         }
         else if (filenames.empty() == false)
         {
            string msg = "Unable to import the files specified on the command line.  " + string(APP_NAME) +
               " supports loading one session file, one or more wizard files, or one or more data set files.";
            mpProgress->updateProgress(msg, 0, ERRORS);
         }
      }

      // If there are any wizards, run them
      executeStartupBatchWizards();

      // Destroy the progress object and progress dialog
      delete dynamic_cast<ProgressAdapter*>(mpProgress);

      vector<string> autoExitOptions = pArgList->getOptions("autoExit");
      if (autoExitOptions.empty() == false)
      {
         SessionSaveType tempSettingQueryForSave = SESSION_DONT_AUTO_SAVE;
         const string sessionFilename = autoExitOptions.front();
         if (sessionFilename.empty() == false)
         {
            tempSettingQueryForSave = SESSION_AUTO_SAVE;
            pAppWindow->setSessionFilename(FilenameImp(sessionFilename).getFullPathAndName());
         }
         DataVariant dvTempSettingQueryForSave(tempSettingQueryForSave);

         pConfigSettings->adoptTemporarySetting(SessionManager::getSettingQueryForSaveKey(), dvTempSettingQueryForSave);
         pAppWindow->close();
         return iReturn;
      }

      // Set the application window to auto-generate textures
      QTimer textureGenerationTimer;
      bool generation = RasterLayer::getSettingBackgroundTileGeneration();
      if (generation == true)
      {
         textureGenerationTimer.setInterval(100);
         pAppWindow->connect(&textureGenerationTimer, SIGNAL(timeout()), SLOT(pregenerateTexture()));
      }

   }
   // Initiate the GUI event loop, which returns when the user exits the application
   return qApplication.exec();
}
Example #18
0
void Game::showSplashScreen(std::string file)
{
	SplashScreen splashScreen;
	splashScreen.show(_mainWindow, file);
	_gameState = Game::ShowingMenu;
}
Example #19
0
void ApplicationManager::drawFrame()
{
	if (networkManager_)
		networkManager_->tick();

	// if we're in app mode, skip the first 10 frames as black screen
	// because a pattern like surfaceChanged(a,b), drawFrame, drawFrame, drawFrame, ..., surfaceChanged(b,a) is possible
	// and we want to execute lua files after getting the final device resolution
	if (player_ == false)
	{
		if (nframe_++ < 10)
		{
			glClearColor(0, 0, 0, 1);
			glClear(GL_COLOR_BUFFER_BIT);

			return;
		}
	}

	if (player_ == false)
	{
		if (applicationStarted_ == false)
		{
			loadProperties();

			// Gideros has became open source and free, because this, there's no more splash art			

			loadLuaFiles();
			skipFirstEnterFrame_ = true;

			/*
			bool licensed = (licenseKey_[15] == 'f' && licenseKey_[16] == 'f');

			if (licensed)
			{
				loadLuaFiles();
				skipFirstEnterFrame_ = true;
			}
			else
			{
				application_->getApplication()->setBackgroundColor(0, 0, 0);
				splashScreen_ = new SplashScreen(application_->getApplication());
				application_->getApplication()->stage()->addChild(splashScreen_);
				splashScreen_->unref();
			}
			*/

			applicationStarted_ = true;
		}
		
		if (splashScreen_ && splashScreen_->isFinished())
		{
			application_->getApplication()->stage()->removeChild(splashScreen_);
			splashScreen_ = NULL;
			application_->getApplication()->setBackgroundColor(1, 1, 1);

			loadLuaFiles();
			skipFirstEnterFrame_ = true;
		}
	}	

	if (skipFirstEnterFrame_ == true)
	{	
		skipFirstEnterFrame_ = false;
	}
	else
	{
		GStatus status;
		application_->enterFrame(&status);
		if (status.error())
			luaError(status.errorString());
	}

	application_->clearBuffers();
	application_->renderScene(1);
	drawIPs();
}
Example #20
0
void Magazin::ShowSplash()
{
    SplashScreen ss;
    ss.show(_mainWindow);
    _state=showingLogInfoState;
}
bool HostFilterComponent::perform (const InvocationInfo& info)
{
    Config* config = Config::getInstance();

    GraphComponent* graph = main->getGraph ();
    Transport* transport = getFilter()->getTransport();

    switch (info.commandID)
    {
    //----------------------------------------------------------------------------------------------
    case CommandIDs::pluginOpen:
        {
            graph->loadAndAppendPlugin ();
            break;
        }
    case CommandIDs::pluginClose:
        {
            graph->closeSelectedPlugins ();
            break;
        }
    case CommandIDs::pluginClear:
        {
            graph->closeAllPlugins ();
            break;
        }
    case CommandIDs::showPluginListEditor:
        {
           if (PluginListWindow::currentPluginListWindow == 0)
               PluginListWindow::currentPluginListWindow = new PluginListWindow (knownPluginList);

           PluginListWindow::currentPluginListWindow->toFront (true);
            
            break;
        }

    //----------------------------------------------------------------------------------------------
#ifndef JOST_VST_PLUGIN
    case CommandIDs::audioOptions:
        {
            StandaloneFilterWindow* window = findParentComponentOfClass ((StandaloneFilterWindow*) 0);
            if (window)
                window->showAudioSettingsDialog ();

            break;
        }
#endif

    case CommandIDs::audioPlay:
        {
            transport->play ();
            break;
        }
    case CommandIDs::audioPlayPause:
        {
            transport->togglePlay ();
            break;
        }
    case CommandIDs::audioStop:
        {
            transport->stop ();
            break;
        }
    case CommandIDs::audioRecord:
        {
            transport->record ();
            break;
        }
    case CommandIDs::audioRewind:
        {
            transport->rewind ();
            break;
        }
    case CommandIDs::audioLoop:
        {
            transport->setLooping (! transport->isLooping());
            break;
        }

    //----------------------------------------------------------------------------------------------
    case CommandIDs::sessionNew:
        {
           bool retValue = 
               AlertWindow::showYesNoCancelBox (AlertWindow::WarningIcon,
                                             T("Unsaved Changes"),
                                             T("Are you sure you want to close the current session? You may lose any unsaved changes."));
            if (retValue)
            {
               closePluginEditorWindows ();
               getFilter()->getHost ()->closeAllPlugins (true);

               clearComponents ();
               Config::getInstance()->lastSessionFile = File::nonexistent;
               rebuildComponents ();
            }
            break;
        }
    
    case CommandIDs::sessionLoad:
        {
            FileChooser myChooser (T("Load a session file..."),
                                    Config::getInstance ()->lastSessionDirectory,
                                    JOST_SESSION_WILDCARD, JOST_USE_NATIVE_FILE_CHOOSER);

            if (myChooser.browseForFileToOpen())
            {
              bool retValue = 
               AlertWindow::showYesNoCancelBox (AlertWindow::WarningIcon,
                                             T("Unsaved Changes"),
                                             T("Are you sure you want to close the current session? You may lose any unsaved changes."));
               if (retValue)
               {

                MemoryBlock fileData;
                File fileToLoad = myChooser.getResult();

                if (fileToLoad.existsAsFile()
                    && fileToLoad.loadFileAsData (fileData))
                {
                    getFilter ()->setStateInformation (fileData.getData (), fileData.getSize());

                    Config::getInstance()->addRecentSession (fileToLoad);
                    Config::getInstance()->lastSessionFile = fileToLoad;
                }
               }
            }
            break;
        }
    case CommandIDs::sessionSave:
        {
            handleSaveCommand();
            break;
        }
    case CommandIDs::sessionSaveNoPrompt:
        {
            handleSaveCommand(true);
            break;
        }

    case CommandIDs::audioStemsStartStop:
        {
            getHost()->toggleStemRendering();
            break;
        }
    case CommandIDs::audioStemsSetup:
        {
            FileChooser myChooser (T("Save Rendered Stem Files To..."),
                                    Config::getInstance ()->lastStemsDirectory);
            if (myChooser.browseForDirectory ())
            {
                Config::getInstance ()->lastStemsDirectory = myChooser.getResult();
            }
            break; 
        }

    //----------------------------------------------------------------------------------------------
    case CommandIDs::appToolbar:
        {
            toolbar->showCustomisationDialog (*factory,
                                              Toolbar::allCustomisationOptionsEnabled);
                                              // (Toolbar::allowIconsOnlyChoice | Toolbar::showResetToDefaultsButton));
            break;
        }
    case CommandIDs::appBrowser:
        {
            setBrowserVisible (! config->showBrowser, config->browserLeft);
            break;
        }
    case CommandIDs::appFullScreen:
        {
            DocumentWindow* window = findParentComponentOfClass <DocumentWindow> ();
            if (window) {
                window->setFullScreen (! window->isFullScreen ());
                window->setMenuBar (window->isFullScreen () ? 0 : this);
            }
            break;
        }
    case CommandIDs::appExit:
        {
            deleteAndZero(PluginListWindow::currentPluginListWindow);
            JUCEApplication::getInstance()->systemRequestedQuit();
            break;
        }
    case CommandIDs::appAbout:
        {
//            Image* splashImage = ImageCache::getFromMemory (Resource::jost_about,
//                                                            Resource::jost_about_size);
         // todo: move appResourcesFolder() to somewhere everyone can use it
#if JUCE_MAC
			File appResourcesFolder(File::getSpecialLocation(File::currentApplicationFile).getChildFile("./Contents/Resources"));
#else
			File appResourcesFolder(File::getSpecialLocation(File::currentApplicationFile).getParentDirectory());
#endif
			File splashImageFile(appResourcesFolder.getChildFile("JiveAbout.png"));
            Image* splashImage = ImageFileFormat::loadFrom(splashImageFile);
            SplashScreen* splash = new SplashScreen();
            splash->show (T(JucePlugin_Name), splashImage, 3500, false);
            break;
        }

    //----------------------------------------------------------------------------------------------
    default:
        return false;
    }

    return true;
}
BOOL Application::InitInstance()
{
  // ćŠ‚æžœäž€äžȘèżèĄŒćœš Windows XP 侊的ćș”甚皋ćșæž…ć•æŒ‡ćźšèŠ
	// äœżç”š ComCtl32.dll ç‰ˆæœŹ 6 æˆ–æ›Žé«˜ç‰ˆæœŹæ„ćŻç”šćŻè§†ćŒ–æ–čćŒïŒŒ
	//ćˆ™éœ€èŠ InitCommonControlsEx()。  ćŠćˆ™ïŒŒć°†æ— æł•ćˆ›ć»șçȘ—ćŁă€‚
	INITCOMMONCONTROLSEX InitCtrls;
	InitCtrls.dwSize = sizeof(InitCtrls);
	// ć°†ćźƒèźŸçœźäžșćŒ…æ‹Źæ‰€æœ‰èŠćœšćș”甚皋ćșäž­äœżç”šçš„
	// ć…Źć…±æŽ§ä»¶ç±»ă€‚
	InitCtrls.dwICC = ICC_WIN95_CLASSES;
	InitCommonControlsEx(&InitCtrls);

	CWinApp::InitInstance();

  HANDLE hMutex = CreateMutex(NULL, TRUE, APPID);
  if (hMutex == NULL) {
    AfxMessageBox(IDS_PROMPT_APP_INIT_FAILED, MB_ICONERROR | MB_OK);
    return FALSE;
  }
  if (GetLastError() == ERROR_ALREADY_EXISTS) {
    // application already running.
    return FALSE;
  }

	AfxEnableControlContainer();


	// æ ‡ć‡†ćˆć§‹ćŒ–
	// ćŠ‚æžœæœȘäœżç”šèż™äș›ćŠŸèƒœćč¶ćžŒæœ›ć‡ć°
	// æœ€ç»ˆćŻæ‰§èĄŒæ–‡ä»¶çš„ć€§ć°ïŒŒćˆ™ćș”ç§»é™€äž‹ćˆ—
	// 䞍需芁的ç‰čćźšćˆć§‹ćŒ–äŸ‹çš‹
	// 曎æ”č甹äșŽć­˜ć‚šèźŸçœźçš„æłšć†ŒèĄšéĄč
	// TODO:  ćș”é€‚ćœ“äżźæ”čèŻ„ć­—çŹŠäžČ
	// äŸ‹ćŠ‚äżźæ”čäžșć…Źćžæˆ–ç»„ç»‡ć
	SetRegistryKey(_T("ZMVision"));

  CoInitialize(NULL);

  if (!GuiResources::GetInstance()->Init()) {
    AfxMessageBox(IDS_PROMPT_APP_INIT_FAILED, MB_OK | MB_ICONERROR);
    return FALSE;
  }

  for (int i = 1; i < __argc; i++) {
    if (_tcscmp(__targv[i], _T("-skipupdate")) == 0) {
      skipUpdate_ = true;
    }
  }

  if (WorkingParameters::GetInstance()->IsFTPInfoBlank())
  {
	  CInputNameKey inputDlg;
	  if (inputDlg.DoModal() != IDOK)
	  {
		  return FALSE;
	  }
  }

  SplashScreen splash;
  if (splash.DoModal() != IDOK) {
    return FALSE;
  }

  LoginDialog login;
  if (login.DoModal() != IDOK) {
    return FALSE;
  }

  if (!DebugLogger::GetInstance()->Init()) {
    AfxMessageBox(IDS_PROMPT_APP_INIT_FAILED, MB_OK | MB_ICONERROR);
    return FALSE;
  }

	MainDialog dlg;
	m_pMainWnd = &dlg;
	INT_PTR nResponse = dlg.DoModal();
	if (nResponse == IDOK)
	{
		// TODO:  ćœšæ­€æ”Ÿçœźć€„ç†äœ•æ—¶ç”š
		//  â€œçĄźćźšâ€æ„ć…łé—­ćŻčèŻæĄ†çš„ä»Łç 
	}
	else if (nResponse == IDCANCEL)
	{
		// TODO:  ćœšæ­€æ”Ÿçœźć€„ç†äœ•æ—¶ç”š
		//  â€œć–æ¶ˆâ€æ„ć…łé—­ćŻčèŻæĄ†çš„ä»Łç 
	}
	else if (nResponse == -1)
	{
		TRACE(traceAppMsg, 0, "è­Šć‘Š: ćŻčèŻæĄ†ćˆ›ć»șć€±èŽ„ïŒŒćș”甚皋ćșć°†æ„ć€–ç»ˆæ­ąă€‚\n");
	}


	// 由äșŽćŻčèŻæĄ†ć·Čć…łé—­ïŒŒæ‰€ä»„ć°†èż”ć›ž FALSE ä»„äŸżé€€ć‡șćș”甚皋ćșïŒŒ
	//  è€Œäžæ˜ŻćŻćŠšćș”甚皋ćșçš„æ¶ˆæŻæł”。
	return FALSE;
}
Example #23
0
File: main.cpp Project: 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();
}
Example #24
0
/**
 * Program entry point
 */
bool Game_Develop_EditorApp::OnInit()
{
    //Setting up working directory:
#ifdef LINUX
    string tmp; //Make sure current working directory is executable directory.
    if ( string(argv[0]) != "/" )
    {
        char buffer[1024];
        tmp += ( getcwd( buffer, 1024 ) );
        tmp += "/";
    }
    tmp += argv[0];
    tmp = tmp.substr( 0, tmp.find_last_of( "/" ) );
    chdir( tmp.c_str() );
#endif
#ifdef WINDOWS
    wxString exeDirectory = argv[0]; //Make sure current working directory is executable directory.
    unsigned int backslashpos = exeDirectory.find_last_of( "\\" );
    if ( backslashpos > exeDirectory.length() ) backslashpos = 0;
    unsigned int slashpos = exeDirectory.find_last_of( "/" );
    if ( slashpos > exeDirectory.length() ) slashpos = 0;

    exeDirectory = exeDirectory.substr( 0, slashpos > backslashpos ? slashpos : backslashpos );
    chdir( exeDirectory.c_str() );
#endif

    //Parse command line:
    wxCmdLineEntryDesc cmdLineDesc[] = {
        {wxCMD_LINE_PARAM, NULL, NULL, ("Files to open"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL},
        {wxCMD_LINE_SWITCH, "h", "help", ("Display help about launching GDevelop using command line") },
        {wxCMD_LINE_SWITCH, "v", "version", ("Display GDevelop version and quit"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
        {wxCMD_LINE_OPTION, NULL, ("lang"), ("Force loading a specific language ( Example : /lang=en_GB )"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL },
        {wxCMD_LINE_SWITCH, NULL, ("allowMultipleInstances"), ("Allow to launch GDevelop even if it is already opened") },
        {wxCMD_LINE_SWITCH, NULL, ("noCrashCheck"), ("Don't check if GDevelop crashed during last use.") },
        {wxCMD_LINE_NONE}
    };

    wxCmdLineParser parser (cmdLineDesc, argc, argv);
    parser.AddUsageText("For more information about using GDevelop, please refer to the online help.");
    if ( parser.Parse(false) > 0 )
        ;
    else if ( parser.Found( wxT("version") ) )
    {
        cout << gd::VersionWrapper::FullString() << endl;
        return false;
    }
    else if ( parser.Found( wxT("help") ) )
    {
        cout << parser.GetUsageString();
        return false;
    }

    cout << "GDevelop initialization started:" << endl;
    SetAppName("GDIDE");
    SetAppDisplayName("GDevelop IDE");

    std::vector<std::string> filesToOpen;
    for (unsigned int i = 0;i<parser.GetParamCount();++i)
    {
        filesToOpen.push_back(string(parser.GetParam(i).mb_str()));
    }

    //Load configuration
    #if defined(LINUX)
    wxString ConfigPath = wxFileName::GetHomeDir() + "/.config/GDevelop/";
    #else
    wxString ConfigPath = wxFileName::GetHomeDir() + "/.GDevelop/";
    #endif
    if ( !wxDirExists( ConfigPath ) )
        wxMkdir( ConfigPath );

    wxFileConfig *config = new wxFileConfig( _T( "GDevelop" ), _T( "Compil Games" ), ConfigPath + "options.cfg" );
    wxConfigBase::Set( config );
    cout << "* Config file set." << endl;

    //Set language
    {
        wxString wantedLanguage;
        if ( !parser.Found( wxT("lang") ))
            config->Read("/Lang", &wantedLanguage);
        else
            parser.Found( wxT("lang"), &wantedLanguage);

        //If SelectLanguage.cfg file exists, then read the language from it
        if ( wxFileExists(ConfigPath+"SelectLanguage.cfg") )
        {
            wxTextFile languageFile;
            languageFile.Open(ConfigPath+"SelectLanguage.cfg");

            wantedLanguage = languageFile.GetFirstLine();
            languageFile.Close();

            wxRemoveFile(ConfigPath+"SelectLanguage.cfg");
        }

        //Retrieve languages files
        std::vector <std::string> languagesAvailables;
        wxDir dir(wxGetCwd()+"/locale/");
        wxString filename;

        bool cont = dir.GetFirst(&filename, "", wxDIR_DIRS);
        while ( cont )
        {
            languagesAvailables.push_back(string(filename.mb_str()));
            cont = dir.GetNext(&filename);
        }

        //Retrieve selected language
        int languageId = wxLANGUAGE_DEFAULT;
        for (unsigned int i = 0;i<languagesAvailables.size();++i)
        {
            if ( wxLocale::FindLanguageInfo(languagesAvailables[i])->CanonicalName == wantedLanguage )
                languageId = wxLocale::FindLanguageInfo(languagesAvailables[i])->Language;
        }

        gd::LocaleManager::Get()->SetLanguage(languageId);

    }
    cout << "* Language loaded" << endl;

    #ifdef RELEASE
    {
        wxLogNull noLogPlease;
        singleInstanceChecker = new wxSingleInstanceChecker;
        if ( singleInstanceChecker->IsAnotherRunning() && !parser.Found( wxT("allowMultipleInstances") ) )
        {
            //There is already another instance running: Ask it to open the requested files.
            cout << "* Instance already existing: Redirecting the file to open to it." << endl;

            STClient * client = new STClient;
            wxString hostName = "localhost"; //Mandatory to provide the host ( for TCP/IP based implementations ).
            wxConnectionBase * connection = client->MakeConnection(hostName, "GDIDE", "GDevelop IDE");

            if ( connection )
            {
                for (unsigned int i = 0; i < filesToOpen.size(); ++i)
                    connection->Execute(filesToOpen[i]);

                connection->Disconnect();
                delete connection;
            }
            else
            {
                if ( !filesToOpen.empty() )
                    wxMessageBox(_("It seems that GDevelop is busy and can't open the requested file.\nPlease close any open dialogs and retry."),
                        _("Sorry! :/"), wxICON_INFORMATION|wxOK);
            }

            delete client;
            delete singleInstanceChecker;

            cout << "* Bye!" << endl;
            return false; // OnExit() won't be called if we return false
        }
        else
        {
            //No other instance running: Set this instance as the main one, creating a server that will
            //be called by other instance if necessary.
            server = new STServer;
            if ( !server->Create("GDIDE") )
                cout << " * FAILED to create an IPC service.";
        }
    }
    #endif

    cout << "* Single instance handling done" << endl;

    wxInitAllImageHandlers();

    cout << "* Image handlers loaded" << endl;

    //Check if the last session terminated not normally.
    bool recoveringFromBug = false;
    #if defined(RELEASE)
    if ( !parser.Found( wxT("noCrashCheck") )
        && wxFileExists(wxFileName::GetTempDir()+"/GameDevelopRunning.log")
        && !wxFileExists(wxFileName::GetTempDir()+"/ExtensionBeingLoaded.log") )
    {
        recoveringFromBug = true;

        //Get the files opened during the last crash
        std::vector<string> openedFiles;
        wxTextFile projectsLogFile(wxFileName::GetTempDir()+"/GameDevelopRunning.log");
        if (projectsLogFile.Open())
        {
            for (wxString str = projectsLogFile.GetFirstLine(); !projectsLogFile.Eof(); str = projectsLogFile.GetNextLine())
                openedFiles.push_back(gd::ToString(str));
        }

        projectsLogFile.Close();

        //Show an explanation window and offer the user to load the autosaves.
        BugReport dialog(NULL, openedFiles);
        if ( dialog.ShowModal() == 1 )
        {
            for (unsigned int i = 0; i < openedFiles.size(); ++i)
            {
                if ( wxFileExists(openedFiles[i]+".autosave") )
                    filesToOpen.push_back(openedFiles[i]+".autosave");
            }

        }
    }
    #endif
    cout << "* Crash management ended" << endl;

    //Creating the console Manager
    /* Deactivated, as the compilation thread can output messages at any time, resulting in the wxTextCtrl of console frame to be updated at any time
       which is dangerous ( GUI must be only updated from main thread )
    #if defined(RELEASE) && defined(WINDOWS)
    ConsoleManager * consoleManager;
    consoleManager = ConsoleManager::Get();
    cout << "ConsoleManager created" << endl;
    #endif
    */

    //Splash screen
    wxBitmap bitmap;
    bitmap.LoadFile( wxString("res/GD-Splashscreen.png"), wxBITMAP_TYPE_PNG );
    SplashScreen * splash = new SplashScreen(bitmap, 2, 0, -1, wxNO_BORDER | wxFRAME_SHAPED);
    cout << "* Splash Screen created" << endl;

    //Create the file logging the opened projects
    wxFile errorDetectFile(wxFileName::GetTempDir()+"/GameDevelopRunning.log", wxFile::write);
    errorDetectFile.Write(" ");
    errorDetectFile.Close();

    //Les log
    cout << "* Displaying GDevelop version information :" << endl;
    cout << "GDevelop " << gd::VersionWrapper::FullString() << ", built "
         << gd::VersionWrapper::Date() << "/" << gd::VersionWrapper::Month() << "/" << gd::VersionWrapper::Year() << endl;

    cout << "* Creating a useless SFML texture" << endl;
    sf::RenderWindow window;
    sf::Window window2;

    cout << "* Removing CppPlatform/Extensions/AStarAutomatism.xgdle" << endl;
    if ( wxFileExists("CppPlatform/Extensions/AStarAutomatism.xgdle") )
        wxRemoveFile("CppPlatform/Extensions/AStarAutomatism.xgdle");

    //Load platforms and extensions
    cout << "* Loading platforms and extensions:" << endl;
    bool loadExtensions = true;

    #if defined(RELEASE)
    if ( !parser.Found( wxT("noCrashCheck") ) && wxFileExists(wxFileName::GetTempDir()+"/ExtensionBeingLoaded.log") )
    {
        int whattodo = 0;
        {
            wxTextFile extensionErrorDetectFile;
            extensionErrorDetectFile.Open(wxFileName::GetTempDir()+"/ExtensionBeingLoaded.log");

            ExtensionBugReportDlg dialog(NULL, extensionErrorDetectFile.GetFirstLine());
            whattodo = dialog.ShowModal();
        }
        wxRemoveFile(wxFileName::GetTempDir()+"/ExtensionBeingLoaded.log");

        if ( whattodo == 0 ) return false;
        else if ( whattodo == 1 ) loadExtensions = false;
    }
    #endif

    if ( loadExtensions ) gd::PlatformLoader::LoadAllPlatformsInManager(".");

    #if defined(RELEASE)
    wxSetAssertHandler(NULL); //Don't want to have annoying assert dialogs in release
    #endif

    cout << "* Platform and extensions loading ended." << endl;
    wxFileSystem::AddHandler( new wxZipFSHandler );

    //Creating main window
    cout << "* Creating main window" << endl;
    mainEditor = new MainFrame( 0 );
    SetTopWindow( mainEditor );

    //Open files
    for (unsigned int i = 0;i<filesToOpen.size();++i)
        mainEditor->Open(filesToOpen[i]);

    cout << "* Connecting shortcuts" << endl;
    Connect(wxID_ANY,wxEVT_KEY_DOWN, wxKeyEventHandler(Game_Develop_EditorApp::OnKeyPressed));

    //Set help provider
    {
        gd::HelpFileAccess::Get()->SetHelpProvider(::HelpProvider::Get());
        ::HelpProvider::Get()->SetParentWindow(mainEditor);
    }
    cout << "* Help provider set" << endl;

    cout << "* Loading events editor configuration" << endl;
    gd::InstructionSentenceFormatter::Get()->LoadTypesFormattingFromConfig();

    //Save the event to log file
    cout << "* Creating log file (if activated)" << endl;
    LogFileManager::Get()->InitalizeFromConfig();
    LogFileManager::Get()->WriteToLogFile("GDevelop initialization ended"),

    //Fin du splash screen, affichage de la fenĂȘtre
    splash->Destroy();
    mainEditor->Show();
    cout << "* Initializing platforms..." << endl;

    gd::PlatformManager::Get()->NotifyPlatformIDEInitialized();

    cout << "* Initialization ended." << endl;

    //gd::LogWarning(_("This is a beta version of GDevelop 3.\n\nSome features may be missing and bugs present: Report any feedback on www.forum.compilgames.net.\nThanks!"));

    //Checking for updates
    {
        wxString result;
        config->Read( "Startup/CheckUpdate", &result );
        if ( result != "false" )
        {
            UpdateChecker * checker = UpdateChecker::Get();
            checker->DownloadInformation();
            if ( checker->newVersionAvailable )
            {
                MAJ dialog(mainEditor, true);
                if ( dialog.ShowModal() == 2 )
                {
                    mainEditor->Destroy();
                    return true;
                }
            }
        }
        mainEditor->RefreshNews();
    }

    //Pay what you want reminder
    if (!recoveringFromBug)
    {
        int result = 3;
        config->Read( "Startup/Reminder", &result );

        //Force again the display when upgrading from a version older than 3.3.71
        bool reminder3371Shown = false;
        config->Read( "Startup/Reminder3371Shown", &reminder3371Shown );
        if (!reminder3371Shown)
        {
            result = 3;
            config->Write( "Startup/Reminder3371Shown", true);
        }

        //Decrement the counter and show the reminder only after 3 launch in a row.
        if ( result > 0 )
        {
            result--;
            config->Write( "Startup/Reminder", result);
        }
        if ( result == 0 )
        {
            ReminderDialog dialog(mainEditor);
            dialog.ShowModal();
        }

    }


    return true;

}
Example #25
0
bool DrawApp::OnInit() {


	/* Read params from szarp.cfg. */
#if wxUSE_UNICODE
	libpar_read_cmdline_w(&argc, argv);
#else
	libpar_read_cmdline(&argc, argv);
#endif

#if BOOST_FILESYSTEM_VERSION == 3
	boost::filesystem::wpath::imbue(std::locale("C")); 	
#else
	boost::filesystem::wpath_traits::imbue(std::locale("C")); 	
#endif

	if (!DrawGLApp::OnInit())
		return false;


	SetProgName(_T("Draw 3"));
	//signal(SIGINT, INThandler);

	if (m_just_print_version) {
		std::cout << SZARP_VERSION << std::endl;
		return false;
	}
	m_server = NULL;
	m_db_queue = NULL;
	m_executor = NULL;
	m_remarks_handler = NULL;

#ifdef __WXGTK__
	libpar_init();

	char *base = NULL;
	if (m_base == wxEmptyString) {
		base = libpar_getpar("", "config_prefix", 1);
		m_base = SC::L2S(base);
		free(base);
	}

	{

		if (m_base_type != IKS_BASE) {
			char *iks_server = libpar_getpar("draw3", "iks_server", 0);
			if (iks_server) {
				m_iks_server = SC::L2S(iks_server);
				m_base_type = IKS_BASE;
				free(iks_server);
			}

			char *iks_port = libpar_getpar("draw3", "iks_server_port", 0);
			if (iks_port) {
				m_iks_port = SC::L2S(iks_port);
				free(iks_port);
			}
		}
	}

	m_probers_from_szarp_cfg = get_probers_addresses();
#endif

#ifdef MINGW32
	WORD wVersionRequested = MAKEWORD(2, 2);
	WSADATA wsaData;
	WSAStartup(wVersionRequested, &wsaData);
#endif
	/* Set logging to stderr. */
	wxLog *logger = new wxLogStderr();
	//wxLog *logger = new wxLogGui();
	wxLog::SetActiveTarget(logger);


	m_instance = new szSingleInstanceChecker(_T(".szarp_m_instance_lock"), wxEmptyString, 
			_T("draw3"));
	if (m_instance->IsAnotherRunning()) {
		if (!m_url.IsEmpty()) {
			if (m_url_open_in_existing)
				SendToRunningInstance(_T("START_URL"), m_url.c_str());
			else
				SendToRunningInstance(_T("START_URL_EXISTING"), m_url.c_str());
		} else if (!m_base.IsEmpty()) {		
			SendToRunningInstance(_T("START_BASE"), m_base.c_str());
		} else {
			wxLogError(_T("base not given"));
			return false;
		}
		return false;
	}
        

	InitGL();

	SplashScreen *splash = NULL;
	wxBitmap bitmap;

	// this loads draw64_xpm under Linux, or draw64 icon resource under Windows
	szFrame::setDefaultIcon(wxICON(draw64));

	wxString splashimage = GetSzarpDir();

#ifndef MINGW32
	splashimage += _T("resources/wx/images/szarp-logo.png");
#else
	splashimage += _T("resources\\wx\\images\\szarp-logo.png");
#endif

#if wxUSE_LIBPNG
	/* Activate PNG image handler. */
	wxImage::AddHandler( new wxPNGHandler );
#endif

	if (bitmap.LoadFile(splashimage, wxBITMAP_TYPE_PNG))
		splash = new SplashScreen(&bitmap);
	else
		splash = new SplashScreen();
	splash->Show(true);

	splash->PushStatusText(_("Setting locale..."));
	
	/* Set locale. */
	this->InitializeLocale(_T("draw3"), locale);

	splash->PushStatusText(_("Reading params from szarp.cfg..."));

	wxString _lang = wxConfig::Get()->Read(_T("LANGUAGE"), AUTO_LANGUAGE);
	if (_lang == AUTO_LANGUAGE)
		_lang = DEFAULT_LANGUAGE;

	splash->PushStatusText(_("Initializing IPKContainer..."));
	IPKContainer::Init(GetSzarpDataDir().c_str(), 
			GetSzarpDir().c_str(), 
			_lang.c_str());
	m_cfg_mgr = new ConfigManager(GetSzarpDataDir(), IPKContainer::GetObject());

	m_cfg_mgr->SetSplashScreen(splash);

	splash->PushStatusText(_("Initializing szbase..."));

	splash->PushStatusText(_("Initializing XML Resources..."));
    
	InitXmlResource();

	splash->PushStatusText(_("Starting database query mechanism..."));

	m_db_queue = new DatabaseQueryQueue();
	m_dbmgr = new DatabaseManager(m_db_queue, m_cfg_mgr);
	m_db_queue->SetDatabaseManager(m_dbmgr);
	m_dbmgr->SetProbersAddresses(GetProbersAddresses());

	Draw3Base* draw_base;
	switch (m_base_type) {
		case SZBASE_BASE:
			draw_base = new SzbaseBase(m_dbmgr, GetSzarpDataDir().c_str(),
				&ConfigurationFileChangeHandler::handle,
				wxConfig::Get()->Read(_T("SZBUFER_IN_MEMORY_CACHE"), 0L));
			break;
		case SZ4_BASE:
			draw_base = new Sz4Base(m_dbmgr, GetSzarpDataDir().c_str(),
				IPKContainer::GetObject());
			break;
		case IKS_BASE:
			draw_base = new Sz4ApiBase(m_dbmgr, m_iks_server.c_str(), m_iks_port.c_str(),
				IPKContainer::GetObject());
			break;
	}

	m_executor = new QueryExecutor(m_db_queue, m_dbmgr, draw_base);
	m_executor->Create();
	m_executor->SetPriority((WXTHREAD_MAX_PRIORITY + WXTHREAD_DEFAULT_PRIORITY) / 2);
	m_executor->Run();

	m_cfg_mgr->SetDatabaseManager(m_dbmgr);

	ConfigurationFileChangeHandler::database_manager = m_dbmgr;

	/* default config */
	wxString defid;

	DrawsSets *config = NULL;

	splash->PushStatusText(_("Loading configuration..."));

	/* init activity logger with base name as server name. This assumes that 
	 * server has written basename to /etc/hosts on linux machines and probably
	 * doesn't work on windows.
	 */
	UDPLogger::SetAppName( "draw3" );
	UDPLogger::SetAddress( (const char*)m_base.mb_str(wxConvUTF8) );
	UDPLogger::SetPort   ( "7777" );
	UDPLogger::LogEvent  ( "drawapp:start" );



	wxString prefix, window;
	PeriodType pt = PERIOD_T_YEAR;
	time_t time = -1;
	int selected_draw = 0;

	if (!m_url.IsEmpty()) {
		if (!decode_url(m_url, prefix, window, pt, time, selected_draw)) {
			wxLogError(_T("Invalid URL"));
			StopThreads();
			return FALSE;
		}
	} else if (!m_base.IsEmpty()) {
		if ((config = m_cfg_mgr->LoadConfig(m_base,std::wstring(),m_show_logparams)) == NULL) {
			wxLogError(_("Error occurred while loading default configuration. Check your szarp.cfg file."));
			StopThreads();
			return FALSE;
		}
		prefix = m_base;
	} else {
		wxLogError(_("Missing starting base specification."));
		StopThreads();
		return FALSE;
	}


#ifndef MINGW32
	libpar_done();
#endif

	m_help = new szHelpController;
#ifndef MINGW32
	m_help->AddBook(wxGetApp().GetSzarpDir() + L"/resources/documentation/new/draw3/html/draw3.hhp");
#else
	m_help->AddBook(wxGetApp().GetSzarpDir() + L"\\resources\\documentation\\new\\draw3\\html\\draw3.hhp");
#endif
	szHelpControllerHelpProvider* provider = new szHelpControllerHelpProvider;
	wxHelpProvider::Set(provider);
	provider->SetHelpController(m_help);

	splash->PushStatusText(_("Initizalizing remarks..."));
	
	m_remarks_handler = new RemarksHandler(m_cfg_mgr);
	m_remarks_handler->Start();
	
	splash->PushStatusText(_("Creating Frame Manager..."));

	VersionChecker* version_checker = new VersionChecker(argv[0]);
	version_checker->Start();

	FrameManager *fm = new FrameManager(m_dbmgr, m_cfg_mgr, m_remarks_handler);

	/*@michal  */
	if (!fm->CreateFrame(prefix, window, pt, time, wxSize(width, height), wxPoint(x, y), selected_draw, m_url.IsEmpty(), m_full_screen)) {
		StopThreads();
		wxLogError(_T("Unable to load base: %s"), prefix.c_str());
		return FALSE;
	}

	StartInstanceServer(fm, m_cfg_mgr);

	wxToolTip::SetDelay(1000);
    
	SetAppName(_T("SZARPDRAW3"));

	splash->Destroy();

	m_cfg_mgr->ResetSplashScreen();

#ifndef NO_GSTREAMER
	if (!gst_init_check(NULL, NULL, NULL)) 
		return 1;
#endif

	return TRUE;
}
Example #26
0
int main(int argc, char *argv[])
{
	try {
		// Options...
		char *cp;
		struct option *op;
		char opts[NELEM(long_opts) * 3 + 1];

		// Build up the short option QString
		cp = opts;
		for (op = long_opts; op < &long_opts[NELEM(long_opts)]; op++) {
			*cp++ = op->val;
			if (op->has_arg)
				*cp++ = ':';
			if (op->has_arg == optional_argument )
				*cp++ = ':';  // gets another one
		}

		QApplication* pQApp = new QApplication(argc, argv);

		// Deal with the options
		QString songFilename;
#ifdef H2CORE_HAVE_JACKSESSION
		QString sessionId;
#endif
		QString playlistFilename;
		bool bNoSplash = false;
		QString sys_data_path;
		QString sSelectedDriver;
		bool showVersionOpt = false;
		unsigned logLevelOpt = H2Core::Logger::Error;
		QString drumkitName;
		QString drumkitToLoad;
		bool showHelpOpt = false;

		int c;
		for (;;) {
			c = getopt_long(argc, argv, opts, long_opts, NULL);
			if (c == -1)
				break;

			switch(c) {
			case 'P':
				sys_data_path = QString::fromLocal8Bit(optarg);
				break;

				case 'd':
					sSelectedDriver = QString::fromLocal8Bit(optarg);
					break;

				case 's':
					songFilename = QString::fromLocal8Bit(optarg);
					break;
#ifdef H2CORE_HAVE_JACKSESSION
			case 'S':
				sessionId = QString::fromLocal8Bit(optarg);
				break;
#endif

				case 'p':
					playlistFilename = QString::fromLocal8Bit(optarg);
					break;

				case 'k':
					//load Drumkit
					drumkitToLoad = QString::fromLocal8Bit(optarg);
					break;

				case 'v':
					showVersionOpt = true;
					break;

				case 'i':
					//install h2drumkit
					drumkitName = QString::fromLocal8Bit( optarg );
					break;

				case 'V':
					if( optarg ) {
						logLevelOpt = H2Core::Logger::parse_log_level( optarg );
					} else {
						logLevelOpt = H2Core::Logger::Error|H2Core::Logger::Warning;
					}
					break;
				case 'n':
					bNoSplash = true;
					break;

				case 'h':
				case '?':
					showHelpOpt = true;
					break;
			}
		}

		setup_unix_signal_handlers();

		if( showVersionOpt ) {
			std::cout << H2Core::get_version() << std::endl;
			exit(0);
		}
		showInfo();
		if( showHelpOpt ) {
			showUsage();
			exit(0);
		}

		// Man your battle stations... this is not a drill.
		H2Core::Logger::create_instance();
		H2Core::Logger::set_bit_mask( logLevelOpt );
		H2Core::Logger* logger = H2Core::Logger::get_instance();
		H2Core::Object::bootstrap( logger, logger->should_log(H2Core::Logger::Debug) );
		if(sys_data_path.length()==0 ) {
			H2Core::Filesystem::bootstrap( logger );
		} else {
			H2Core::Filesystem::bootstrap( logger, sys_data_path );
		}
		MidiMap::create_instance();
		H2Core::Preferences::create_instance();
		// See below for H2Core::Hydrogen.


		___INFOLOG( QString("Using QT version ") + QString( qVersion() ) );
		___INFOLOG( "Using data path: " + H2Core::Filesystem::sys_data_path() );

		H2Core::Preferences *pPref = H2Core::Preferences::get_instance();
		pPref->setH2ProcessName( QString(argv[0]) );

#ifdef H2CORE_HAVE_LASH

		LashClient::create_instance("hydrogen", "Hydrogen", &argc, &argv);
		LashClient* lashClient = LashClient::get_instance();

#endif
		if( ! drumkitName.isEmpty() ){
			H2Core::Drumkit::install( drumkitName );
			exit(0);
		}
		
		if (sSelectedDriver == "auto") {
			pPref->m_sAudioDriver = "Auto";
		}
		else if (sSelectedDriver == "jack") {
			pPref->m_sAudioDriver = "Jack";
		}
		else if ( sSelectedDriver == "oss" ) {
			pPref->m_sAudioDriver = "Oss";
		}
		else if ( sSelectedDriver == "alsa" ) {
			pPref->m_sAudioDriver = "Alsa";
		}

		QString family = pPref->getApplicationFontFamily();
		pQApp->setFont( QFont( family, pPref->getApplicationFontPointSize() ) );

		QTranslator qttor( 0 );
		QTranslator tor( 0 );
		QString sTranslationFile = QString("hydrogen.") + QLocale::system().name();
		QString sLocale = QLocale::system().name();
		if ( sLocale != "C") {
			if (qttor.load( QString( "qt_" ) + sLocale,
				QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
				pQApp->installTranslator( &qttor );
			else
				___INFOLOG( QString("Warning: No Qt translation for locale %1 found.").arg(QLocale::system().name()));


			QString sTranslationPath = "data/i18n";
			QString total = sTranslationPath + "/" + sTranslationFile + ".qm";

			bool bTransOk = tor.load( total, "." );
			if ( bTransOk ) {
				___INFOLOG( QString( "Using locale: %1/%2" ).arg( sTranslationPath ).arg( sTranslationFile ) );
			}
			else {
				sTranslationPath = H2Core::Filesystem::i18n_dir();
				total = sTranslationPath + "/" + sTranslationFile + ".qm";
				bTransOk = tor.load( total, "." );
				if (bTransOk) {
					___INFOLOG( "Using locale: " + sTranslationPath + "/" + sTranslationFile );
				}
				else {
					___INFOLOG( "Warning: no locale found: " + sTranslationPath + "/" + sTranslationFile );
				}
			}
			if (tor.isEmpty()) {
				___INFOLOG( "Warning: error loading locale: " +  total );
			}
		}
		pQApp->installTranslator( &tor );

		QString sStyle = pPref->getQTStyle();
		if ( !sStyle.isEmpty() ) {
			pQApp->setStyle( sStyle );
		}

		setPalette( pQApp );

		SplashScreen *pSplash = new SplashScreen();

		if (bNoSplash) {
			pSplash->hide();
		}
		else {
			pSplash->show();
		}

#ifdef H2CORE_HAVE_LASH
		if ( H2Core::Preferences::get_instance()->useLash() ){
			if (lashClient->isConnected())
			{
				lash_event_t* lash_event = lashClient->getNextEvent();
				if (lash_event && lash_event_get_type(lash_event) == LASH_Restore_File)
				{
					// notify client that this project was not a new one
					lashClient->setNewProject(false);

					songFilename = "";
					songFilename.append( QString::fromLocal8Bit(lash_event_get_string(lash_event)) );
					songFilename.append("/hydrogen.h2song");

					//        				H2Core::Logger::get_instance()->log("[LASH] Restore file: " + songFilename);

					lash_event_destroy(lash_event);
				}
				else if (lash_event)
				{
					//        				H2Core::Logger::get_instance()->log("[LASH] ERROR: Instead of restore file got event: " + lash_event_get_type(lash_event));
					lash_event_destroy(lash_event);
				}
			}
		}
#endif

#ifdef H2CORE_HAVE_JACKSESSION
		if(!sessionId.isEmpty()){
			pPref->setJackSessionUUID( sessionId );

			/*
					 * imo, jack sessions use jack as default audio driver.
					 * hydrogen remember last used audiodriver.
					 * here we make it save that hydrogen start in a jacksession case
					 * every time with jack as audio driver
					 */
			pPref->m_sAudioDriver = "Jack";

		}

		/*
		 * the use of applicationFilePath() make it
		 * possible to use different executables.
		* for example if you start hydrogen from a local
		* build directory.
		*/

		QString path = pQApp->applicationFilePath();
		pPref->setJackSessionApplicationPath( path );
#endif

		// Hydrogen here to honor all preferences.
		H2Core::Hydrogen::create_instance();

#ifdef H2CORE_HAVE_NSMSESSION
		H2Core::Hydrogen::get_instance()->startNsmClient();
		songFilename = pPref->getNsmSongName();
#endif

		MainForm *pMainForm = new MainForm( pQApp, songFilename );
		pMainForm->show();
		pSplash->finish( pMainForm );

		if( ! playlistFilename.isEmpty() ){
			bool loadlist = HydrogenApp::get_instance()->getPlayListDialog()->loadListByFileName( playlistFilename );
			if ( loadlist ){
				Playlist::get_instance()->setNextSongByNumber( 0 );
			} else {
				___ERRORLOG ( "Error loading the playlist" );
			}
		}

		if( ! drumkitToLoad.isEmpty() ) {
			H2Core::Drumkit* drumkitInfo = H2Core::Drumkit::load_by_name( drumkitToLoad, true );
			if ( drumkitInfo ) {
				H2Core::Hydrogen::get_instance()->loadDrumkit( drumkitInfo );
				HydrogenApp::get_instance()->onDrumkitLoad( drumkitInfo->get_name() );
			} else {
				___ERRORLOG ( "Error loading the drumkit" );
			}
		}

		pQApp->exec();

		delete pSplash;
		delete pMainForm;
		delete pQApp;
		delete pPref;
		delete H2Core::EventQueue::get_instance();
		delete H2Core::AudioEngine::get_instance();

		delete MidiMap::get_instance();
		delete MidiActionManager::get_instance();

		___INFOLOG( "Quitting..." );
		cout << "\nBye..." << endl;
		delete H2Core::Logger::get_instance();

		if (H2Core::Object::count_active()) {
			H2Core::Object::write_objects_map_to_cerr();
		}

	}
	catch ( const H2Core::H2Exception& ex ) {
		std::cerr << "[main] Exception: " << ex.what() << std::endl;
	}
	catch (...) {
		std::cerr << "[main] Unknown exception X-(" << std::endl;
	}

	return 0;
}
Example #27
0
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);
}
Example #28
0
void Application::start(void)
{
	PROFILE;

    TRACE("Starting application...");

    /* Preferably, the share directory is specified in an environment variable.
	 * We'll set this to our working directory.
	 * XXX: We don't want to write files to the share directory!
	 */
	{
		const char * share;

		share = getenv("ARBARLITH2_SHARE");

		if(!share) {
			setWorkingDirectory(getApplicationDirectory());
		} else {
			setWorkingDirectory(share);
		}
	}

	// Parse the setup files
	loadXmlConfigFiles();

	// Initialize APIs
	startOpenGL();
	startDevIL();

	// Create the effect manager
	EffectManager::GetSingleton().create();

	// Load the font setup file
	loadFonts();

	// Load the key bindings
	TRACE("Loading controller bindings...");
	new Controller();
	TRACE("...Loaded controller bindings");

	// Seed the random number generator
	TRACE("Seeding the random number generator...");
	srand(SDL_GetTicks());
	TRACE("...Seeded the random number generator");

	// Do the splash screen
	{
		TRACE("Doing splash screen...");
		SplashScreen splashScreen;
		splashScreen.doSplash(5000);
		TRACE("...Finished with splash screen");
	}

	// Initialize the wait screen
	new WaitScreen();
	g_WaitScreen.Render();
	TRACE("Wait screen started.");

	// Create the frame timer
	TRACE("Creating the frame timer...");
	fme = new NeHe::Frame();
	TRACE("...Created the frame timer");

	// Create the sound manager
	soundSystem = new SoundSystem();
	soundSystem->create();
	TRACE("Sound system initialized");

	// Prepare handlers for various key press events
	addTask(new ScreenShotTask);
	TRACE("Started screen shot task");

	addTask(new EditorKeyDetector);
	TRACE("Started editor hotkey task");

	addTask(new MenuKeyDetector);
	TRACE("Started menu hotkey task");

	addTask(new SpellMenuKeyDetector);
	TRACE("Started spell-menu hotkey task");

	addTask(new DebugDisplayToggleKeyDetector(*this));
	TRACE("Started debug-info hotkey task");

	addTask(new FPSDisplayToggleKeyDetector);
	TRACE("Started FPS-display hotkey task");


	// Create a task to handle the GUI
	new WidgetManager;
	TRACE("Started the game GUI task");
	g_WaitScreen.Render();

	// Start the profiler system
#ifdef ENABLE_PROFILER
	Profiler::ProfileInit();
	addTask(makePeriodicCallbackTask(500.0f,
                                     &Profiler::ProfileDumpOutputToBuffer));
	TRACE("Started the game profiler task");
	g_WaitScreen.Render();
#endif

	// set up the game states
	TRACE("Creating game state objects...");
	{
		states[GAME_STATE_RUN] = new GameStateRun(*this);
		TRACE("...created GameStateRun...");

		states[GAME_STATE_EDITOR] = new GameStateEditor(*this);
		TRACE("...created GameStateEditor...");

		states[GAME_STATE_MENU] = new GameStateMenu(*this);
		TRACE("...created GameStateMenu...");

		states[GAME_STATE_SPELL_MENU] = new GameStateSpellMenu(*this);
		TRACE("...created GameStateSpellMenu...");

		states[GAME_STATE_CREDITS] = new GameStateCredits(*this);
		TRACE("...created GameStateCredits...");
	}
	TRACE("...finished (Creating game state objects)");

	TRACE("Entering the menu game state...");
	gameState = GAME_STATE_MENU;
	states[GAME_STATE_MENU]->onEnter();
	TRACE("...finished (Entering the menu game state)");

	// Complete
	TRACE("...Finished starting up");
	g_WaitScreen.Render();
}