Пример #1
0
void InexorCefApp::InitAppLayer(std::string instance_id, std::string host, std::string port)
{
    std::string layer_name("app");
    std::string layer_url("http://" + host + ":" + port + "/api/v1/interfaces/client-interface/index.html?instanceId=" + instance_id + "&host=" + host + "&port=" + port);
    app_layer = new layer::InexorAppLayer(layer_name, layer_url);
    app_layer->Hide();
    context_manager->AddSubContext(app_layer);
    layer_manager->AddLayerProvider(app_layer);
    Log.ui->debug("init: cef: app layer");
}
Пример #2
0
void InexorCefApp::InitConsoleLayer(std::string instance_id, std::string host, std::string port)
{
    std::string layer_name("console");
    std::string layer_url("http://" + host + ":" + port + "/api/v1/interfaces/console/index.html?instanceId=" + instance_id + "&host=" + host + "&port=" + port);
    console_layer = new layer::InexorConsoleLayer(layer_name, layer_url);
    console_layer->Show();
    context_manager->AddSubContext(console_layer);
    layer_manager->AddLayerProvider(console_layer);
    Log.ui->debug("init: cef: console layer");
}
/**
 * Open the dest files
 * @return 1 if it worked else 0
 */
static int open_dest_files( userdata *u, char *barefile, format *fmt )
{
    int res = 0;
    u->text_dest = dest_file_create( text_kind, NULL, "", barefile, fmt );
    if ( u->text_dest != NULL )
    {
        res = dest_file_open( u->text_dest );
        if ( res )
        {
            // always at least one markup df is needed
            dest_file *df = dest_file_create( markup_kind, NULL, 
                (char*)fmt->middle_name, barefile, fmt );
            if ( df != NULL && u->rules != NULL )
            {
                // ask the recipe which markup files to create
                int i,n_layers = recipe_num_layers( u->rules );
                u->markup_dest = calloc( n_layers+2, sizeof(dest_file*));
                if ( u->markup_dest != NULL )
                {
                    u->markup_dest[0] = df;
                    for ( i=1;i<=n_layers;i++ )
                    {
                        layer *l = recipe_layer( u->rules, i-1 );
                        char *name = layer_name( l );
                        int mlen = strlen(fmt->middle_name)
                            +strlen(name)+2;
                        char *mid_name = malloc( mlen );
                        if ( mid_name != NULL )
                        {
                            snprintf( mid_name, mlen, "%s-%s", 
                                fmt->middle_name, name );
                            //dest_kind kind, layer *l, char *midname, 
                            //char *name, format *f
                            u->markup_dest[i] = dest_file_create( markup_kind,
                                l, mid_name, barefile, fmt );
                            free( mid_name );
                        }
                        else
                        {
                            fprintf(stderr,
                                "stripper: failed to allocate name\n");
                            break;
                        }
                    }
                    if ( i == n_layers )
                        res = 1;
                }
                else
                    fprintf(stderr,
                        "stripper: failed to allocate markup array\n");
                // now open the markup dest files 
                if ( res )
                {
                    i = 0;
                    while ( u->markup_dest[i] != NULL && res )
                        res = dest_file_open( u->markup_dest[i++] );
                }
            }
        }
    }
    if ( res )
        u->dest_map = hashmap_create();
    return res&&(u->dest_map!=NULL);
}