Esempio n. 1
0
int main( int argc, char** argv )
{
    QCoreApplication::setApplicationName( "Audioscrobbler" );
    QCoreApplication::setApplicationVersion( VERSION );

#ifdef NDEBUG
    UniqueApplication uapp( moose::id() );
    if (uapp.isAlreadyRunning())
		return uapp.forward( argc, argv ) ? 0 : 1;
    uapp.init1();
#endif
	
    try
    {
        audioscrobbler::Application app( argc, argv );
      #ifdef NDEBUG
		uapp.init2( &app );
        app.connect( &uapp, SIGNAL(arguments( QStringList )), SLOT(parseArguments( QStringList )) );
      #endif
        return app.exec();
    }
    catch (unicorn::Application::StubbornUserException&)
    {
        // user wouldn't log in
        return 0;
    }
}
Esempio n. 2
0
int main( int argc, char** argv )
{    
    QCoreApplication::setApplicationName( moose::applicationName() );
    QCoreApplication::setApplicationVersion( VERSION );
    QCoreApplication::setOrganizationName( CoreSettings::organizationName() );
    QCoreApplication::setOrganizationDomain( CoreSettings::organizationDomain() );

#ifdef NDEBUG
    UniqueApplication uapp( moose::id() );
    if (uapp.isAlreadyRunning())
		return uapp.forward( argc, argv ) ? 0 : 1;
    uapp.init1();
#endif	
    
    try
    {
        App app( argc, argv );
      #ifdef NDEBUG
		uapp.init2( &app );
        app.connect( &uapp, SIGNAL(arguments( QStringList )), SLOT(parseArguments( QStringList )) );
      #endif

      #ifdef Q_WS_MAC
        AEEventHandlerUPP h = NewAEEventHandlerUPP( appleEventHandler );
        AEInstallEventHandler( 'GURL', 'GURL', h, 0, false );
        //AEInstallEventHandler( kCoreEventClass, kAEQuitApplication, h, 0, false ); //QCoreApplication handles this for us
        AEInstallEventHandler( kCoreEventClass, kAEReopenApplication, h, 0, false );
      #endif

        Container container; gcon = &container;
        container.show();

        if (!app.arguments().contains( "--tray" ))
            container.show();

        app.parseArguments( app.arguments() );

        return app.exec();
    }
    catch (unicorn::Application::StubbornUserException&)
    {
        // user wouldn't log in
        return 0;
    }    
}