Example #1
0
void SkinWidget::find_file(QString path)
{
    QDir picdir(path);
    QStringList filters;
    filters << "*.bmp" << "*.jpg" << "*.png" << "*.gif";
    picdir.setNameFilters(filters);

    if (!picdir.exists()) {
        return;
    }

    picdir.setFilter(QDir::Dirs | QDir::Files);
    picdir.setSorting(QDir::DirsFirst);
    QFileInfoList list = picdir.entryInfoList();
    for_each(list.begin(), list.end(),
    [&](QFileInfoList::value_type fileInfo) {
        if (pic_list.count(fileInfo.fileName())
            || (fileInfo.fileName() == ".")
            || (fileInfo.fileName() == "..")) {
            return;
        } else {
            pic_list.append(fileInfo.fileName());
            init_skin(fileInfo.fileName());
        }
    });
}
void mainwindow_loadskin (gchar *skinpath,_loadskin_types loadtype) {
	// Have we got a window at all ?
	if (mainwindow_data.window==NULL) return;

	DPRINT (__DEBUG_GTK__,"Loading skin");
	// Prevent any display operations while loading
	mainwindow_data.loading_skin = TRUE;
	// Load skin configuration
	init_skin (skinpath,loadtype);
	// Create double-buffered pixmap
	// unref pixmap, in case we call this function again
	if (mainwindow_data.dbuf_pixmap!=NULL) gdk_pixmap_unref (mainwindow_data.dbuf_pixmap);
	mainwindow_data.dbuf_pixmap = gdk_pixmap_new (mainwindow_data.window->window,
						      plugin_config->skin_width,plugin_config->skin_height,
						      -1);
	// Set new window size
	gtk_widget_set_usize (mainwindow_data.window,plugin_config->skin_width,plugin_config->skin_height);
	// Allow window operations again
	mainwindow_data.loading_skin = FALSE;

	// Repaint the new window
	loadimage (findcover_filename);
}
Example #3
0
void init()
{
	sigset_t sigmask;
	sigemptyset(&sigmask);
	sigaddset(&sigmask, SIGALRM);
	sigaddset(&sigmask, SIGUSR1);
	
	sigprocmask(SIG_BLOCK, &sigmask, NULL);

	console_print("Emergence Client " VERSION "\n");
	
	SDL_Init(SDL_INIT_AUDIO);
	
	init_user();
	init_network();
	init_timer();
	init_openssl();
	init_key();
	init_download();
	init_servers();

	create_cvars();
	init_console_cvars();
	init_render_cvars();
	init_map_cvars();
	create_control_cvars();
//	create_input_cvars();
	init_tick_cvars();

	init_console();
	create_colour_cvars();
	
	struct string_t *string = new_string_string(emergence_home_dir);
	string_cat_text(string, "/client.config");
	
	if(!exec_config_file(string->text))
	{
		exec_config_file(find_resource("default-controls.config"));
	}
	else
	{
		char *ver = get_cvar_string("version");
		
		if(*ver == '\0')
		{
			struct string_t *command = new_string_text("rm ");
			string_cat_string(command, emergence_home_dir);
			string_cat_text(command, "/skins/default.skin*");
			
			console_print("%s\n", command->text);
			system(command->text);
			
			vid_mode = -1;	// find a nice mode

			exec_config_file(find_resource("default-controls.config"));
		}
		
		free(ver);
	}
	
	free_string(string);
	
	
	set_cvar_string("version", VERSION);
	
	init_skin();
	init_input();
	init_control();
	

	init_render();
	init_rcon();
	init_ping();

	create_cvar_command("quit", client_shutdown_char);
	

	init_sound();
	init_game();
	
	init_alarm();
	
	render_frame();
	
	string = new_string_text("%s%s", emergence_home_dir->text, "/client.autoexec");
	if(!exec_config_file(string->text))
		exec_config_file(find_resource("default-client.autoexec"));
	free_string(string);
	
	start_server_discovery();
}