コード例 #1
0
ファイル: main.cpp プロジェクト: nschimme/MMapper
int main(int argc, char **argv)
{
    if (IS_DEBUG_BUILD) {
        // see http://doc.qt.io/qt-5/qtglobal.html#qSetMessagePattern
        // also allows environment variable QT_MESSAGE_PATTERN
        qSetMessagePattern(
            "[%{time} %{threadid}] %{type} in %{function} (at %{file}:%{line}): %{message}");
    }

    QApplication app(argc, argv);
    Q_INIT_RESOURCE(mmapper2);
    tryInitDrMingw();
    tryUseHighDpi(app);
    auto tryLoadingWinSock = std::make_unique<WinSock>();

    const auto &config = getConfig();
    if (config.canvas.softwareOpenGL) {
        app.setAttribute(Qt::AA_UseSoftwareOpenGL);
        if (CURRENT_PLATFORM == Platform::Linux) {
            qputenv("LIBGL_ALWAYS_SOFTWARE", "1");
        }
    } else {
        // Windows Intel drivers cause black screens if we don't specify OpenGL
        app.setAttribute(Qt::AA_UseDesktopOpenGL);
    }

    std::unique_ptr<ISplash> splash = !config.general.noSplash
                                          ? static_upcast<ISplash>(std::make_unique<Splash>())
                                          : static_upcast<ISplash>(std::make_unique<FakeSplash>());
    auto mw = std::make_unique<MainWindow>();
    tryAutoLoad(*mw);
    mw->show();
    splash->finish(mw.get());
    splash.reset();

    mw->startServices();
    const int ret = app.exec();
    mw.reset();
    config.write();
    return ret;
}
コード例 #2
0
int main (int argc, char *argv[])
{
	int echoSockFD,daytimeSockFD;
	int rc;
/*
 * Create the signal masks and start the signal_handler thread
 */

	sigemptyset (&signal_mask);
    	sigaddset (&signal_mask, SIGINT);
    	sigaddset (&signal_mask, SIGTERM);
    	sigaddset (&signal_mask, SIGPIPE);
    	rc = pthread_sigmask (SIG_BLOCK, &signal_mask, NULL);

    	if (rc != 0) {
       	 /* handle error */
    	}
	int sig_thr_id;

	rc = pthread_create (&sig_thr_id, NULL, signal_thread, NULL);
    	if (rc != 0) {
    	}

/*
 * startServices will create the sockets and put them in listen mode and call the superServer()
 */

	if(rc=startServices(&echoSockFD,&daytimeSockFD) == NO_ERROR)
	{
		printf("LOG \t: Server Initialized Successfully...\n");
		printf("LOG \t: Starting the super server...\n");
		startSuperServer(echoSockFD,daytimeSockFD);
	}
	else
		printf("ERROR \t: Server failed to start\n");
}
コード例 #3
0
ファイル: VisionCamTest.cpp プロジェクト: richardxu/panda-a4
int main()
{
    VisionCam * gCam = NULL;
    entryIndex index = 0;
    module_t handle = NULL;
    status_e ret = STATUS_SUCCESS;

#if defined(SOSAL_RUNTIME_DEBUG)
    debug_get_zone_mask("SOSAL_ZONE_MASK", &sosal_zone_mask);
#endif

#if defined(DVP_RUNTIME_DEBUG)
    debug_get_zone_mask("DVP_ZONE_MASK", &dvp_zone_mask);
#endif

    handle =  initModule( &gCam );
#ifdef VCAM_AS_SHARED
    if( handle == NULL )
        return -1;
#endif

    if( gCam )
    {
        setInitialValues( gCam );
        ret = startServices( gCam );
    }
    else
    {
        ret = STATUS_CATASTROPHIC;
    }

    if( ret !=  STATUS_SUCCESS )
    {
        ret = deinitModule( handle, &gCam );
    }
    else
    {
        while( 1 )
        {
            index = Menu( menu );
            if( index == -1 )
            {
                continue;
            }

            /// 'q' button (quit) is pressed
            if( menu[ index ]->ID == VCAM_CMD_QUIT )
            {
                index = getEntryIndex( menu , KEY_PREVIEW_STOP );
                ret = executeEntry( menu[ index ], gCam );
                break;
            }
            ret = executeEntry( menu[ index ] , gCam );
        }
        ret = stopServices( gCam );
        ret = deinitModule( handle, &gCam );
    }

    printf("\tvcam_test exiting with %d.\n", ret);

    if( STATUS_SUCCESS != ret )
        puts("\tTerminating application.");

    return ret;
}