Exemple #1
0
void display_buddy(void)
{
	if(buddy_win < 0)
		{
			int our_root_win = -1;
			if (!windows_on_top) {
				our_root_win = game_root_win;
			}
			buddy_win = create_window(win_buddy, our_root_win, 0, buddy_menu_x, buddy_menu_y, 0, 0, ELW_USE_UISCALE|ELW_WIN_DEFAULT);

			set_window_handler(buddy_win, ELW_HANDLER_DISPLAY, &display_buddy_handler );
			set_window_handler(buddy_win, ELW_HANDLER_CLICK, &click_buddy_handler );
			set_window_handler(buddy_win, ELW_HANDLER_UI_SCALE, &ui_scale_buddy_handler );

			buddy_scroll_id = vscrollbar_add_extended (buddy_win, buddy_scroll_id, NULL, 0, 0, 0, 0, 0, 1.0, newcol_r, newcol_g, newcol_b, 0, 1, 0);
			buddy_button_id = button_add_extended(buddy_win, buddy_button_id, NULL, 0, 0, 0, 0, BUTTON_SQUARE, 1.0, newcol_r, newcol_g, newcol_b, buddy_add_str);
			widget_set_OnClick(buddy_win, buddy_button_id, click_buddy_button_handler);

			if (buddy_win >=0 && buddy_win < windows_list.num_windows)
				ui_scale_buddy_handler(&windows_list.window[buddy_win]);
		}
	else
		{
			toggle_window(buddy_win);
		}
}
Exemple #2
0
static int click_buddy_button_handler(widget_list *w, int mx, int my, Uint32 flags)
{
	if(buddy_add_win < 0) {
		buddy_add_win = display_buddy_add();
	} else {
		toggle_window(buddy_add_win);
	}
	return 1;
}
Exemple #3
0
automap::automap(level *l, int width, int height)
{
  w=width;
  h=height;

  tick=0;
  cur_lev=l;
  automap_window=NULL;
  toggle_window();
}
Exemple #4
0
static void icon_clicked_cb(GtkWidget* button, 
                            GdkEventButton* event, 
                            gpointer data){
   if (event->type != GDK_BUTTON_PRESS)
      return;
   if (event->button == 1)
      toggle_window(GTK_WIDGET(button), event);
   else if (event->button == 3)
      show_menu(event);
}
Exemple #5
0
int display_buddy_add(void)
{
	if(buddy_add_win < 0)
	{
		int label_id = 100, input_id = 101, button_id = 102;
		window_info *win = NULL;
		int label_width = 0;
		int win_x_len = 0;
		int win_y_len = 0;

		/* Create the window */
		buddy_add_win = create_window(buddy_add_str, buddy_win, 0, buddy_menu_x_len/2, buddy_menu_y_len/4, 0, 0, ELW_USE_UISCALE|ELW_WIN_DEFAULT);
		if (buddy_add_win <=0 || buddy_add_win >= windows_list.num_windows)
			return -1;
		win = &windows_list.window[buddy_add_win];

		/* Add name input and label */
		label_id = label_add_extended(buddy_add_win, label_id, NULL,
			buddy_border_space, buddy_border_space, 0, win->current_scale, newcol_r, newcol_g, newcol_b, buddy_name_str);
		label_width = widget_get_width(buddy_add_win, label_id);
		input_id = pword_field_add_extended(buddy_add_win, input_id, NULL,
			2 * buddy_border_space + label_width, buddy_border_space,
			MAX_USERNAME_LENGTH * win->default_font_len_x, win->default_font_len_y + buddy_border_space,
			P_TEXT, win->current_scale, newcol_r, newcol_g, newcol_b, buddy_name_buffer, MAX_USERNAME_LENGTH);
		widget_set_OnMouseover(buddy_add_win, label_id, name_onmouseover_handler);
		widget_set_OnMouseover(buddy_add_win, input_id, name_onmouseover_handler);
		widget_set_OnKey(buddy_add_win, input_id, name_input_keypress_handler);

		/* Add "Add buddy" button */
		button_id = button_add_extended(buddy_add_win, button_id, NULL, 0, 0, 0, 0, 0, win->current_scale, newcol_r, newcol_g, newcol_b, buddy_add_str);
		widget_set_OnClick(buddy_add_win, button_id, click_add_buddy_handler);

		/* Resize window and centre button */
		win_x_len = 3 * buddy_border_space + label_width + widget_get_width(buddy_add_win, input_id) + win->box_size;
		win_y_len = 3 * buddy_border_space + widget_get_height(buddy_add_win, input_id) + widget_get_height(buddy_add_win, button_id);
		resize_window(buddy_add_win, win_x_len, win_y_len);
		widget_move(buddy_add_win, button_id, (win_x_len - widget_get_width(buddy_add_win, button_id)) / 2, 3 * buddy_border_space + win->default_font_len_y);

		return buddy_add_win;
	}
	else
	{
		toggle_window(buddy_add_win);
		return buddy_add_win;
	}
}
Exemple #6
0
	//	Create the window or just toggle its open/closed state.
	//
	void List_Window::show(window_info *win)
	{
		if (win_id < 0 )
		{
			ItemLists::Vars::lists()->load();
			ItemLists::Vars::cat_maps()->load();
			filter[0] = '\0';

			calc_num_show_names(get_grid_size()*6+110);
			add_button_x = static_cast<int>(get_size_x() - DEFAULT_FONT_X_LEN*2);
			add_button_y = get_grid_size();

			win_id = create_window(item_list_preview_title, win->window_id, 0, get_window_pos_x(win), 0, get_size_x(), get_size_y(), ELW_WIN_DEFAULT|ELW_RESIZEABLE);
			set_window_handler(win_id, ELW_HANDLER_DISPLAY, (int (*)())&display_itemlist_handler );
			set_window_handler(win_id, ELW_HANDLER_CLICK, (int (*)())&click_itemlist_handler );
			set_window_handler(win_id, ELW_HANDLER_MOUSEOVER, (int (*)())&mouseover_itemlist_handler );
			set_window_handler(win_id, ELW_HANDLER_HIDE, (int (*)())&hide_itemlist_handler );
			set_window_handler(win_id, ELW_HANDLER_KEYPRESS, (int (*)())&keypress_itemlist_handler );
			set_window_handler(win_id, ELW_HANDLER_RESIZE, (int (*)())&resize_itemlist_handler );
			set_window_min_size(win_id, get_size_x(), get_size_y());

			cm_selected_item_menu = cm_create(cm_item_list_selected_str, cm_selected_item_handler);
			cm_names_menu = cm_create(cm_item_list_names_str, cm_names_handler);
			cm_set_pre_show_handler(cm_names_menu, cm_names_pre_show_handler);
			cm_add_region(cm_names_menu, win_id, 0, get_size_y()-get_names_size_y(), get_size_y(), get_names_size_y());

			names_scroll_id = vscrollbar_add_extended(win_id, 1, NULL,
				get_size_x()-ELW_BOX_SIZE, get_grid_size()*num_grid_rows, ELW_BOX_SIZE, get_names_size_y()-ELW_BOX_SIZE, 0,
				1.0, newcol_r, newcol_g, newcol_b, 0, 1, Vars::lists()->size()-num_show_names_list);

			init_ipu(&ipu_item_list_name, -1, -1, -1, 1, 1, NULL, NULL);
			
			make_active_visable();
		}
		else
		{
			toggle_window(win_id);
			make_active_visable();
			close_ipu(&ipu_item_list_name);
			Vars::quantity_input()->close();
		}
	}
Exemple #7
0
void automap::handle_event(event &ev)
{

  //only respond to stuff in our window or on the main screen
  if (ev.window==NULL || ev.window==automap_window)
  {
    switch (ev.type)
    {
      case EV_KEY :
        switch(ev.key)
    {
      case 'A' :
      case 'a' :
          toggle_window();
        break;
    }
    break;
      case EV_CLOSE_WINDOW :
        wm->close_window(automap_window);
    automap_window=NULL;
    break;
    }
  }
}
Exemple #8
0
//============================================================================
// Help menu
//============================================================================
void helpAbout_cb (puObject* obj)
{
  toggle_window (FUI_WINDOW_HELP_ABOUT,0);
}
Exemple #9
0
int check_browser_interface (window_info *win, int _x, int _y)
{
   	if (view_browser && _x > win->len_x-20 && _y <= 20)
	{
		view_browser = 0;
		return 1;
	}

	if(cd==-1){
		int id = _y / 18;
		if (_x > 210) id += 22;

		if(mc==1){
			if(id<=cc){
				ccat=id;
				mc=0;
				if(Cat[ccat].ns==1){
					int i=0;
					for(;i<dc;i++){
						if(Cat[ccat].Sub[0]==&Dir[i])
							cd=i;
					}
					mc=1;
				}
				
			}
		}else{
			if(id<Cat[ccat].ns){
				int i=0;
				for(;i<dc;i++){
					if(Cat[ccat].Sub[id]==&Dir[i])
						cd=i;
				}
			} else if(_x > win->len_x-16 && _y > 160 && _y < 240){
				mc=1;
			}
		}

	}else{
		if(_x>0 && _x<200 && _y>0 && _y<200){
			char fn[256];
			strcpy(fn,".");
			strcat(fn,Dir[cd].Files[cp]);
			selected_3d_object=add_e3d(fn,scene_mouse_x,scene_mouse_y,0,0,0,0,0,0,0,0,0);
			cur_tool=tool_select;
			if(close_browser_on_select) toggle_window(browser_win);
		}
		if(cp+2<Dir[cd].nf && _x>0 && _x<200 && _y>200 && _y<400){
			char fn[256];
			strcpy(fn,".");
			strcat(fn,Dir[cd].Files[cp+2]);
			selected_3d_object=add_e3d(fn,scene_mouse_x,scene_mouse_y,0,0,0,0,0,0,0,0,0);
			cur_tool=tool_select;
			if(close_browser_on_select) toggle_window(browser_win);
		}
		if(cp+1<Dir[cd].nf && _x>200 && _x<400 && _y>0 && _y<200){
			char fn[256];
			strcpy(fn,".");
			strcat(fn,Dir[cd].Files[cp+1]);
			selected_3d_object=add_e3d(fn,scene_mouse_x,scene_mouse_y,0,0,0,0,0,0,0,0,0);
			cur_tool=tool_select;
			if(close_browser_on_select) toggle_window(browser_win);
		}
		if(cp+3<Dir[cd].nf && _x>200 && _x<400 && _y>200 && _y<400){
			char fn[256];
			strcpy(fn,".");
			strcat(fn,Dir[cd].Files[cp+3]);
			selected_3d_object=add_e3d(fn,scene_mouse_x,scene_mouse_y,0,0,0,0,0,0,0,0,0);
			cur_tool=tool_select;
			if(close_browser_on_select) toggle_window(browser_win);
		}
	

		if(_x > win->len_x-16 && _x < win->len_x && _y > 18 && _y < 18+16){
			if(cp>=4)cp-=4;	
		}

		if(_x > win->len_x-16 && _x < win->len_x && _y > 380 && _y < 380+16){
			if(cp<(Dir[cd].nf-4))cp+=4;
		}

		if(_x > win->len_x-16 && _x < win->len_x && _y > 160 && _y < 240){
			cp=0;
			cd=-1;
		}
   }
   return 1;
}
Exemple #10
0
int display_book_handler(window_info *win)
{
	int x=32,i,p;
	char str[20];
	book *b=win->data;
	
	if(!b) {
		toggle_window(book_win);
		return 1;
	}
	switch(b->type){
		case 1:
#ifdef	NEW_TEXTURES
			bind_texture(paper1_text);
#else	/* NEW_TEXTURES */
			get_and_set_texture_id(paper1_text);
#endif	/* NEW_TEXTURES */
			break;
		case 2:
#ifdef	NEW_TEXTURES
			bind_texture(book1_text);
#else	/* NEW_TEXTURES */
			get_and_set_texture_id(book1_text);
#endif	/* NEW_TEXTURES */
			break;
	}
	glBegin(GL_QUADS);
		glTexCoord2f(0.0f,1.0f); glVertex3i(0,0,0);
		glTexCoord2f(0.0f,0.0f); glVertex3i(0,win->len_y-20,0);
		glTexCoord2f(1.0f,0.0f); glVertex3i(win->len_x,win->len_y-20,0);
		glTexCoord2f(1.0f,1.0f); glVertex3i(win->len_x,0,0);
	glEnd();
	glPushMatrix();
	if(b->type==1)
		glTranslatef(15,25,0);
	else if(b->type==2)
		glTranslatef(30,15,0);
	display_book(b, b->type);
	glPopMatrix();
	
	glPushMatrix();
	glTranslatef(0,win->len_y-18,0);
	book_mouse_y-=(win->len_y-18);
	x=10;
	if(book_mouse_y>0 && book_mouse_y<18 && book_mouse_x>10 && book_mouse_x<(get_string_width((unsigned char*)"<-")*11.0f/12.0f)){
		glColor3f(0.95f, 0.76f, 0.52f);
		draw_string(10,-2,(unsigned char*)"<-",0);
		
		glColor3f(0.77f,0.59f, 0.38f);
		draw_string(win->len_x-33,-2,(unsigned char*)"->",0);
	} else if(book_mouse_y>0 && book_mouse_y<18 && book_mouse_x>win->len_x-33 && book_mouse_x<win->len_x-33+(get_string_width((unsigned char*)"->")*11.0f/12.0f)){
		glColor3f(0.95f, 0.76f, 0.52f);
		draw_string(win->len_x-33,-2,(unsigned char*)"->",0);
		
		glColor3f(0.77f,0.59f, 0.38f);
		draw_string(10,-2,(unsigned char*)"<-",0);
	} else {
		glColor3f(0.77f,0.59f, 0.38f);
		draw_string(10,-2,(unsigned char*)"<-",0);
		draw_string(win->len_x-33,-2,(unsigned char*)"->",0);
	}
	if(b->type==1) {
		x=50;
		p=b->active_page-5;
		if(p>=0){
			safe_snprintf(str,sizeof(str),"%d",p+1);

			if(book_mouse_y>0 && book_mouse_y<18 && book_mouse_x>x && book_mouse_x<x+(get_string_width((unsigned char*)str)*11.0f/12.0f)){
				glColor3f(0.95f, 0.76f, 0.52f);
				draw_string(x,0,(unsigned char*)str,0);
				glColor3f(0.77f,0.59f, 0.38f);
			} else 
				draw_string(x,0,(unsigned char*)str,0);
		}
		x=100;
		p=b->active_page-2;
		if(p>=0){
			safe_snprintf(str,sizeof(str),"%d",p+1);
			
			if(book_mouse_y>0 && book_mouse_y<18 && book_mouse_x>x && book_mouse_x<x+(get_string_width((unsigned char*)str)*11.0f/12.0f)){
				glColor3f(0.95f, 0.76f, 0.52f);
				draw_string(x,0,(unsigned char*)str,0);
				glColor3f(0.77f,0.59f, 0.38f);
			} else 
				draw_string(x,0,(unsigned char*)str,0);
		}
		x=win->len_x-120;
		p=b->active_page+2;
		if(p<b->no_pages){
			safe_snprintf(str,sizeof(str),"%d",p+1);
			
			if(book_mouse_y>0 && book_mouse_y<18 && book_mouse_x>x && book_mouse_x<x+(get_string_width((unsigned char*)str)*11.0f/12.0f)){
				glColor3f(0.95f, 0.76f, 0.52f);
				draw_string(x,0,(unsigned char*)str,0);
				glColor3f(0.77f,0.59f, 0.38f);
			} else 
				draw_string(x,0,(unsigned char*)str,0);
		}
		x=win->len_x-70;
		p=b->active_page+5;
		if(p<b->no_pages){
			safe_snprintf(str,sizeof(str),"%d",p+1);
			
			if(book_mouse_y>0 && book_mouse_y<18 && book_mouse_x>x && book_mouse_x<x+(get_string_width((unsigned char*)str)*11.0f/12.0f)){
				glColor3f(0.95f, 0.76f, 0.52f);
				draw_string(x,0,(unsigned char*)str,0);
				glColor3f(0.77f,0.59f, 0.38f);
			} else 
				draw_string(x,0,(unsigned char*)str,0);
		}
	} else if(b->type==2) {
		x=win->len_x/2-60;
		for(i=1;i<5;i++){
			p=b->active_page-i*b->type;
			if(p>=0){
				safe_snprintf(str,sizeof(str),"%d",p+1);
				
				if(book_mouse_y>0 && book_mouse_y<18 && book_mouse_x>x && book_mouse_x<x+(get_string_width((unsigned char*)str)*11.0f/12.0f)){
					glColor3f(0.95f, 0.76f, 0.52f);
					draw_string(x,0,(unsigned char*)str,0);
					glColor3f(0.77f,0.59f, 0.38f);
				} else
					draw_string(x,0,(unsigned char*)str,0);
			}
			x-=40;
		}
		x=win->len_x/2+50;
		for(i=1;i<5;i++){
			p=b->active_page+i*b->type;
			if(p<b->no_pages){
				safe_snprintf(str,sizeof(str),"%d",p+1);
				
				if(book_mouse_y>0 && book_mouse_y<18 && book_mouse_x>x && book_mouse_x<x+(get_string_width((unsigned char*)str)*11.0f/12.0f)){
					glColor3f(0.95f, 0.76f, 0.52f);
					draw_string(x,0,(unsigned char*)str,0);
					glColor3f(0.77f,0.59f, 0.38f);
				} else
					draw_string(x,0,(unsigned char*)str,0);
			}
			x+=40;
		}
	}
	
	if(book_mouse_y>0 && book_mouse_y<18 && book_mouse_x>win->len_x/2-15 && book_mouse_x<win->len_x/2+15)
		glColor3f(0.95f, 0.76f, 0.52f);
	
	draw_string(win->len_x/2-15,0,(unsigned char*)"[X]",0);
	glPopMatrix();
#ifdef OPENGL_TRACE
CHECK_GL_ERRORS();
#endif //OPENGL_TRACE
	return 1;
}
Exemple #11
0
void init_stuff()
{
	int i;
	int seed;

	chdir(DATA_DIR);
	
#ifndef WINDOWS
	setlocale(LC_NUMERIC,"en_US");
#endif
	init_translatables();

	//create_error_mutex();
	init_globals();
	init_crc_tables();
	init_zip_archives();
	cache_system_init(MAX_CACHE_SYSTEM);
	init_texture_cache();

	init_vars();
	
	read_config();

	file_check_datadir();

#ifdef LOAD_XML
	//Well, the current version of the map editor doesn't support having a datadir - will add that later ;-)
	load_translatables();
#endif

#ifdef LINUX
#ifdef GTK2
	init_filters();
#else
	file_selector = create_fileselection();
#endif
#endif	//LINUX

	init_gl();

	window_resize();
	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LESS);
//	glDepthFunc(GL_LEQUAL);
    glEnable(GL_TEXTURE_2D);
	glShadeModel(GL_SMOOTH);
	glFrontFace(GL_CCW);
	glCullFace(GL_BACK);
	glEnable(GL_NORMALIZE);
	glClearColor( 0.0, 0.0, 0.0, 0.0 );
	glClearStencil(0);

	seed = time (NULL);
  	srand (seed);

	init_texture_cache();
	init_particles ();
	init_e3d_cache();
	init_2d_obj_cache();

	for(i=0; i<256; i++)
        tile_list[i]=0;

	for (i = 0; i < MAX_LIGHTS; i++)
		lights_list[i] = NULL;

	new_map(256,256);
	load_all_tiles();

	//lights setup
	build_global_light_table();
	build_sun_pos_table();
	reset_material();
	init_lights();
	//disable_local_lights();
	//clear_error_log();

	// Setup the new eye candy system
#ifdef	EYE_CANDY
	ec_init();
#endif	//EYE_CANDY

	init_gl_extensions();

	if(have_multitexture)
#ifdef	NEW_TEXTURES
		ground_detail_text = load_texture_cached("./textures/ground_detail.bmp", tt_mesh);
#else	/* NEW_TEXTURES */
		ground_detail_text = load_texture_cache ("./textures/ground_detail.bmp",255);
#endif	/* NEW_TEXTURES */

	//load the fonts texture
	init_fonts();
#ifdef	NEW_TEXTURES
	icons_text=load_texture_cached("./textures/gamebuttons.bmp", tt_gui);
	buttons_text=load_texture_cached("./textures/buttons.bmp", tt_gui);
#else	/* NEW_TEXTURES */
	icons_text=load_texture_cache("./textures/gamebuttons.bmp",0);
	buttons_text=load_texture_cache("./textures/buttons.bmp",0);
#endif	/* NEW_TEXTURES */
	//get the application home dir

	have_multitexture=0;//debug only

#ifndef LINUX
	GetCurrentDirectory(sizeof(exec_path),exec_path);
#else
	exec_path[0]='.';exec_path[1]='/';exec_path[2]=0;
#endif
	init_browser();

    if(SDL_InitSubSystem(SDL_INIT_TIMER)<0)
    { 
        char str[120];
        snprintf(str, sizeof(str), "Couldn't initialize the timer: %s\n", SDL_GetError());
        log_error(__FILE__, __LINE__, str);
        SDL_Quit();
	    exit(1);
    }

	SDL_SetTimer (1000/(18*4), my_timer);

	SDL_EnableUNICODE(1);

    //we might want to do this later.

	// creating windows
	display_browser();
	toggle_window(browser_win);

	display_o3dow();
	toggle_window(o3dow_win);

	display_replace_window();
	toggle_window(replace_window_win);

	display_edit_window();
	toggle_window(edit_window_win);

	create_particles_window ();
}
Exemple #12
0
ConfigWindow::ConfigWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::ConfigWindow)
{
    signal_mapper = new QSignalMapper();

    ui->setupUi(this);
    ui_debug = std::unique_ptr<DebugWindow>(new DebugWindow());
    log_class = ui_debug.get();

    qInstallMsgHandler(handle_message);

#ifndef Q_WS_X11
    // Do not show X11 specific options on other platforms
    ui->label_bypass_wm->setVisible(false);
    ui->x11_bypass_wm->setVisible(false);
#endif

    // Setup tray icon and menu
    tray_icon.setIcon(QIcon(":/icons/res/tray_icon.png"));

    tray_menu.addAction(trUtf8("Open configuration"),this,SLOT(show()));
    tray_menu.addAction(trUtf8("Close application"),QCoreApplication::instance(),SLOT(quit()));

    connect(&tray_icon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(toggle_window(QSystemTrayIcon::ActivationReason)));
    tray_icon.setContextMenu(&tray_menu);
    tray_icon.show();

    // Setup the toolbar buttons
    action_group = new QActionGroup(ui->toolBar);
    action_addponies = new QAction(QIcon(":/icons/res/add_icon.png"), trUtf8("Add ponies"), action_group);
    action_addponies->setCheckable(true);
    action_addponies->setChecked(true);
    action_activeponies = new QAction(QIcon(":/icons/res/active_icon.png"), trUtf8("Active ponies"), action_group);
    action_activeponies->setCheckable(true);
    action_configuration = new QAction(QIcon(":/icons/res/settings.png"), trUtf8("Configuration"), action_group);
    action_configuration->setCheckable(true);

    signal_mapper->setMapping(action_addponies,0);
    connect(action_addponies, SIGNAL(triggered()), signal_mapper, SLOT(map()));
    ui->toolBar->addAction(action_addponies);

    signal_mapper->setMapping(action_activeponies,1);
    connect(action_activeponies, SIGNAL(triggered()), signal_mapper, SLOT(map()));
    ui->toolBar->addAction(action_activeponies);

    signal_mapper->setMapping(action_configuration,2);
    connect(action_configuration, SIGNAL(triggered()), signal_mapper, SLOT(map()));
    ui->toolBar->addAction(action_configuration);

    ui->toolBar->setIconSize(QSize(100,100));

    connect(signal_mapper, SIGNAL(mapped(int)), ui->stackedWidget, SLOT(setCurrentIndex(int)));

    list_model = new QStandardItemModel(this);
    active_list_model = new QStandardItemModel(this);

    load_settings();

    ui->tabbar->setShape(QTabBar::RoundedWest);

    // Load available ponies into the list
    reload_available_ponies();

    connect(ui->tabbar, SIGNAL(currentChanged(int)), this, SLOT(lettertab_changed(int)));

    ui->available_list->setIconSize(QSize(100,100));
    ui->available_list->setModel(list_model);
    ui->available_list->setAlternatingRowColors(true);

    ui->active_list->setIconSize(QSize(100,100));
    ui->active_list->setModel(active_list_model);
    ui->active_list->setAlternatingRowColors(true);

    connect(ui->available_list->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(newpony_list_changed(QModelIndex)));

    // Start update timer
    update_timer.setInterval(30);
    update_timer.start();

    interaction_timer.setInterval(500);
    interaction_timer.start();

    QObject::connect(&interaction_timer, SIGNAL(timeout()), this, SLOT(update_interactions()));

    // Load every pony specified in configuration
    QSettings settings;
    int size = settings.beginReadArray("loaded-ponies");
    for(int i=0; i< size; i++) {
        settings.setArrayIndex(i);
        try {
            ponies.emplace_back(std::make_shared<Pony>(settings.value("name").toString(), this));
            QObject::connect(&update_timer, SIGNAL(timeout()), ponies.back().get(), SLOT(update()));
        } catch (std::exception &e) {
            qCritical() << "Could not load pony" << settings.value("name").toString();
        }
    }
    settings.endArray();
    list_model->sort(1);

    update_active_list();

    // Load interactions
    QFile ifile(QString("%1/interactions.ini").arg(getSetting<QString>("general/pony-directory")));
    if(!ifile.open(QIODevice::ReadOnly | QIODevice::Text)) {
        qCritical() << "Cannot open interactions.ini";
        qCritical() << ifile.errorString();
    }

    if( ifile.isOpen() ) {
        QString line;
        QTextStream istr(&ifile);

        while (!istr.atEnd() ) {
            line = istr.readLine();

            if(line[0] != '\'' && !line.isEmpty()) {
                std::vector<QVariant> csv_data;
                CSVParser::ParseLine(csv_data, line, ',', Interaction::OptionTypes);
                try {
                    interactions.emplace_back(csv_data);
                } catch (std::exception &e) {
                    qCritical() << "Could not load interaction.";
                }

            }
        }

        ifile.close();
    } else {
        qCritical() << "Cannot read interactions.ini";
    }

}