int main(int argc, char** argv)
{
   if (argc > 2)
      if (strcmp(argv[1], "-d") == 0) {
         debug = 1;
         debug_file = fopen(argv[2], "w");
      }

   char namestring[MAXNAME];

   printf("what will you define?\n");

   fgets(namestring, MAXNAME, stdin);
   *(strchr(namestring, '\n')) = '\0';

   struct node* root = setup_tree(namestring);

   if (debug)
      print_tree(root);

   printf("total cost for %s is %.2f\n", namestring, calculate_cost(root, 1));

   free_tree(root);

   if (debug)
      fclose(debug_file);

   return 0;
}
void
init_agent (const char *app)
{
  /* get current time (ie, the time the agent started) */
  gettimeofday(&starttime, NULL);
  starttime.tv_sec--;
  starttime.tv_usec += 1000000L;

  /* we handle alarm signals ourselves in the select loop */
  ds_set_boolean(DS_LIBRARY_ID, DS_LIB_ALARM_DONT_USE_SIG, 1);

#ifdef CYGPKG_SNMPAGENT_V3_SUPPORT
  usm_set_reportErrorOnUnknownID(1);
#endif

#ifdef CAN_USE_NLIST
  init_kmem("/dev/kmem");
#endif

  setup_tree();

  init_agent_read_config(app);

#ifdef TESTING
  auto_nlist_print_tree(-2, 0);
#endif

  /* initialize agentx subagent if necessary. */
#ifdef USING_AGENTX_SUBAGENT_MODULE
  if(ds_get_boolean(DS_APPLICATION_ID, DS_AGENT_ROLE) == SUB_AGENT)
      subagent_pre_init();
#endif

}  /* end init_agent() */
//Graph
void mNodeListSlot(GtkWidget * widget, gpointer user_data)
{
	gtk_widget_show(glade_xml_get_widget(xml, "frmTVNodes"));
	setup_tree (view->g[view->activeGraph]);


}
Exemple #4
0
/* calculate a merkle tree on data */
int
merkletree_data(merkletree_t *tree, const void *v, size_t size, const char *alg, size_t blocksize)
{
	if (!setup_tree(tree, size, alg, blocksize)) {
		return 0;
	}
	return calc_row(tree, NULL, __UNCONST(v), tree->size, 0);
}
int get_entries(char* line, struct entry* parts) {
   int index = 0;

   char name_buffer[MAXNAME], num_buffer[MAXDIGITS];

   int i = 0;
   int entries = 0;

   /* my hacky parsing solution */
   while (1) {
      while (isspace(line[index])) 
         index++; // skip whitespace
 
      i = 0;     
      while (isdigit(line[index]))
         num_buffer[i++] = line[index++]; // copy number
      num_buffer[i] = '\0';
      
      while (line[index] != '*') {
         if (line[index] == '\0')
            return entries;
         index++; // skip to '*' character
      }

      index++; // skip over '*' character
      
      while (isspace(line[index]))
         index++; //skip whitespace
      
      i = 0;
      while (isalpha(line[index]))
         name_buffer[i++] = line[index++]; // copy name
      name_buffer[i] = '\0';

      if ((strlen(num_buffer) == 0) || (strlen(name_buffer) == 0))
         return entries;

      if (debug) {
         fprintf(debug_file, "\n[DEBUG] num_buffer contains string %s\n", num_buffer);
         fprintf(debug_file, "[DEBUG] name_buffer contains string %s\n\n", name_buffer);
      }

      parts->ct = atoi(num_buffer); // store in data structure
      parts->nd = setup_tree(name_buffer);

      entries++;
      parts++;

      while(line[index] != '+') {
         if (line[index] == '\0')
            return entries;
         index++;
      }
      index++; // skip over '+' character
   }
   return entries;
}
Exemple #6
0
/* calculate a merkle tree on a file */
int
merkletree_file(merkletree_t *tree, const char *f, const char *alg, size_t blocksize)
{
	struct stat	 st;
	size_t		 size;
	char		*mapped;
	char		*alloc;
	FILE		*fp;
	int		 ret;

	if (tree == NULL || f == NULL || alg == NULL || blocksize == 0) {
		return 0;
	}
	if ((fp = fopen(f, "r")) == NULL) {
		fprintf(stderr, "can't open file '%s'\n", f);
		return 0;
	}
	ret = 0;
	fstat(fileno(fp), &st);
	size = st.st_size;
	alloc = NULL;
	if ((mapped = mmap(NULL, size, PROT_READ, MAP_SHARED, fileno(fp), 0)) == MAP_FAILED) {
		if ((alloc = calloc(1, blocksize)) == NULL) {
			goto done;
		}
		if (!setup_tree(tree, size, alg, blocksize)) {
			goto done;
		}
		ret = calc_row(tree, fp, alloc, tree->size, 0);
	} else {
		ret = merkletree_data(tree, mapped, size, alg, blocksize);
	}
done:
	if (mapped != MAP_FAILED) {
		munmap(mapped, tree->size);
	}
	if (alloc) {
		free(alloc);
	}
	fclose(fp);
	return ret;
}
	void surface_fractal_terrain::generate_mesh(const std::vector<std::vector<double> > &height, int size, double sidelen) {
		double scale = sidelen / size, delta = 1.0 / size;
		std::vector<point3D> vertices;

#define __id(i, j) ((i) * (size + 1) + (j))
		for (int i = 0; i <= size; ++i) {
			for (int j = 0; j <= size; ++j) {
				vertices.push_back(point3D(i * scale, j * scale, height[i][j]));
			}
		}
		setup_vertex(vertices);
		for (int i = 0; i < size; ++i) {
			for (int j = 0; j < size; ++j) {
				double u = i * delta, v = j * delta;

				add_surface(__id(i, j), __id(i + 1, j), __id(i, j + 1)).set_UV(point2D(u, v), point2D(u + delta, v), point2D(u, v + delta));
				add_surface(__id(i + 1, j), __id(i + 1, j + 1), __id(i, j + 1)).set_UV(point2D(u + delta, v), point2D(u + delta, v + delta), point2D(u, v + delta));
			}
		}
#undef __id
		setup_tree();
		interpolate_normal();
	}
Exemple #8
0
/**
 * Initialize the agent.  Calls into init_agent_read_config to set tha app's
 * configuration file in the appropriate default storage space,
 *  NETSNMP_DS_LIB_APPTYPE.  Need to call init_agent before calling init_snmp.
 *
 * @param app the configuration file to be read in, gets stored in default
 *        storage
 *
 * @return Returns non-zero on failure and zero on success.
 *
 * @see init_snmp
 */
int
init_agent(const char *app)
{
    int             r = 0;

    if(++done_init_agent > 1) {
        snmp_log(LOG_WARNING, "ignoring extra call to init_agent (%d)\n", 
                 done_init_agent);
        return r;
    }

    /*
     * get current time (ie, the time the agent started) 
     */
    gettimeofday(&starttime, NULL);
    starttime.tv_sec--;
    starttime.tv_usec += 1000000L;

    /*
     * we handle alarm signals ourselves in the select loop 
     */
    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
			   NETSNMP_DS_LIB_ALARM_DONT_USE_SIG, 1);

#ifdef CAN_USE_NLIST
    init_kmem("/dev/kmem");
#endif

    setup_tree();

    init_agent_read_config(app);

#ifdef TESTING
    auto_nlist_print_tree(-2, 0);
#endif

    _init_agent_callback_transport();
    
    netsnmp_init_helpers();
    init_traps();
    netsnmp_container_init_list();

#if defined(USING_AGENTX_SUBAGENT_MODULE) || defined(USING_AGENTX_MASTER_MODULE)
    /*
     * initialize agentx configs
     */
    agentx_config_init();
    if(netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
                              NETSNMP_DS_AGENT_ROLE) == SUB_AGENT)
        subagent_init();
#endif

    /*
     * Register configuration tokens from transport modules.  
     */
#ifdef SNMP_TRANSPORT_UDP_DOMAIN
    netsnmp_udp_agent_config_tokens_register();
#endif
#ifdef SNMP_TRANSPORT_UDPIPV6_DOMAIN
    netsnmp_udp6_agent_config_tokens_register();
#endif
#ifdef SNMP_TRANSPORT_UNIX_DOMAIN
    netsnmp_unix_agent_config_tokens_register();
#endif

#ifdef NETSNMP_EMBEDDED_PERL
    init_perl();
#endif

#ifdef USING_AGENTX_SUBAGENT_MODULE
    /*
     * don't init agent modules for a sub-agent
     */
    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
			       NETSNMP_DS_AGENT_ROLE) == SUB_AGENT)
        return r;
#endif

#  include "agent_module_inits.h"

    return r;
}                               /* end init_agent() */
GaimGtkXferDialog *
gaim_gtkxfer_dialog_new(void)
{
	GaimGtkXferDialog *dialog;
	GtkWidget *window;
	GtkWidget *vbox1, *vbox2;
	GtkWidget *bbox;
	GtkWidget *sw;
	GtkWidget *sep;
	GtkWidget *button;
	GtkWidget *disclosure;
	GtkWidget *table;
	GtkWidget *checkbox;

	dialog = g_new0(GaimGtkXferDialog, 1);
	dialog->keep_open =
		gaim_prefs_get_bool("/gaim/gtk/filetransfer/keep_open");
	dialog->auto_clear =
		gaim_prefs_get_bool("/gaim/gtk/filetransfer/clear_finished");

    dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_role(GTK_WINDOW(window), "file transfer");
	gtk_window_set_title(GTK_WINDOW(window), _("File Transfers"));
	gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
	gtk_container_set_border_width(GTK_CONTAINER(window), BOX_SPACING);

	g_signal_connect(G_OBJECT(window), "delete_event",
					 G_CALLBACK(delete_win_cb), dialog);

	/* Create the parent vbox for everything. */
	vbox1 = gtk_vbox_new(FALSE, BOX_SPACING);
    gtk_container_add(GTK_CONTAINER(window), vbox1);

	gtk_widget_show(vbox1);

	/* Create the main vbox for top half of the window. */
	vbox2 = gtk_vbox_new(FALSE, CONTAINER_BORDER_WIDTH);
	gtk_box_pack_start(GTK_BOX(vbox1), vbox2, TRUE, TRUE, 0);
	gtk_widget_show(vbox2);

	/* Setup the listbox */
	sw = setup_tree(dialog);
	gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0);
	gtk_widget_set_size_request(sw,-1, 140);

	/* "Keep the dialog open" */
	checkbox = gtk_check_button_new_with_mnemonic(
			_("_Keep the dialog open"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox),
								 dialog->keep_open);
	g_signal_connect(G_OBJECT(checkbox), "toggled",
					 G_CALLBACK(toggle_keep_open_cb), dialog);
	gtk_box_pack_start(GTK_BOX(vbox2), checkbox, FALSE, FALSE, 0);
	gtk_widget_show(checkbox);

	/* "Clear finished transfers" */
	checkbox = gtk_check_button_new_with_mnemonic(
			_("_Clear finished transfers"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox),
								 dialog->auto_clear);
	g_signal_connect(G_OBJECT(checkbox), "toggled",
					 G_CALLBACK(toggle_clear_finished_cb), dialog);
	gtk_box_pack_start(GTK_BOX(vbox2), checkbox, FALSE, FALSE, 0);
	gtk_widget_show(checkbox);

	/* "Download Details" arrow */
	disclosure = gaim_disclosure_new(_("Show transfer details"),
									 _("Hide transfer details"));
	dialog->disclosure = disclosure;
	gtk_box_pack_start(GTK_BOX(vbox2), disclosure, FALSE, FALSE, 0);
	gtk_widget_show(disclosure);

	gtk_widget_set_sensitive(disclosure, FALSE);

#if 0
	g_signal_connect(G_OBJECT(disclosure), "toggled",
					 G_CALLBACK(toggle_details_cb), dialog);
#endif

	/* Separator */
	sep = gtk_hseparator_new();
	gtk_box_pack_start(GTK_BOX(vbox2), sep, FALSE, FALSE, 0);
	gtk_widget_show(sep);

	/* The table of information. */
	table = make_info_table(dialog);
	gtk_box_pack_start(GTK_BOX(vbox2), table, TRUE, TRUE, 0);

	/* Setup the disclosure for the table. */
	gaim_disclosure_set_container(GAIM_DISCLOSURE(disclosure), table);

    /* Now the button box for the buttons */
    bbox = gtk_hbutton_box_new();
    gtk_box_set_spacing(GTK_BOX(bbox), CONTAINER_BORDER_WIDTH);
    gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
    gtk_box_pack_end(GTK_BOX(vbox1), bbox, FALSE, TRUE, 0);
	gtk_widget_show(bbox);

	/* Open button */
	button = gtk_button_new_from_stock(GTK_STOCK_OPEN);
	gtk_widget_set_sensitive(button, FALSE);
	gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
	gtk_widget_show(button);
	dialog->open_button = button;

	g_signal_connect(G_OBJECT(button), "clicked",
					 G_CALLBACK(open_button_cb), dialog);
	/* Pause button */
	button = gtk_button_new_with_mnemonic(_("_Pause"));
#ifndef GAIM_SMALL_SCREEN
	gtk_widget_set_sensitive(button, FALSE);
	gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
	gtk_widget_show(button);
#endif
	dialog->pause_button = button;

	g_signal_connect(G_OBJECT(button), "clicked",
					 G_CALLBACK(pause_button_cb), dialog);

	/* Resume button */
	button = gtk_button_new_with_mnemonic(_("_Resume"));
#ifndef GAIM_SMALL_SCREEN
    gtk_widget_set_sensitive(button, FALSE);
    gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
    gtk_widget_show(button);
#endif
	dialog->resume_button = button;

	g_signal_connect(G_OBJECT(button), "clicked",
					 G_CALLBACK(resume_button_cb), dialog);

	/* Remove button */
	button = gtk_button_new_from_stock(GTK_STOCK_REMOVE);
#ifndef GAIM_SMALL_SCREEN
    gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
    gtk_widget_hide(button);
#endif
	dialog->remove_button = button;

	g_signal_connect(G_OBJECT(button), "clicked",
					 G_CALLBACK(remove_button_cb), dialog);

	/* Stop button */
	button = gtk_button_new_from_stock(GTK_STOCK_STOP);
#ifndef GAIM_SMALL_SCREEN
    gtk_widget_set_sensitive(button, FALSE);
    gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
    gtk_widget_show(button);
#endif
	dialog->stop_button = button;

	g_signal_connect(G_OBJECT(button), "clicked",
					 G_CALLBACK(stop_button_cb), dialog);

	/* Close button */
	button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
    gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
    gtk_widget_show(button);
	dialog->close_button = button;

	g_signal_connect(G_OBJECT(button), "clicked",
					 G_CALLBACK(close_button_cb), dialog);

	return dialog;
}
Exemple #10
0
int main (int   argc,char *argv[])
{
	Persona p;
	Familia f;
	open_file(&p,&f);
	make_tree(&f);
	set_position(&f);
	
	GtkWidget *window;  
	GtkWidget *paned_container_horizontal;
	GtkWidget *paned_container_vertical;
	GtkWidget *fixed_container;
	GtkWidget *list_container;
	GtkWidget *drawing_area;
	GtkWidget *scroll_draw_zone;
	GtkWidget *scroll_tree_zone;
	GtkWidget *scroll_list_zone;
	GtkWidget *memberTextArea;
	GtkWidget *tree_box;
	GtkWidget *list_box;
	
	gtk_init (&argc, &argv);

	// Configuracion de Ventana
	main_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	window = main_window;
	config_window(GTK_WINDOW(window),WIDTH,HEIGHT,"Arbol Genealogico",TRUE);
	// Configuracion de ventana que muestra los datos de las familias

	
	// Configuracion de Container
	paned_container_horizontal =  gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
	paned_container_vertical   =  gtk_paned_new (GTK_ORIENTATION_VERTICAL);
	gtk_container_set_border_width (GTK_CONTAINER (window), 0);
	gtk_container_add (GTK_CONTAINER (window), paned_container_horizontal);
	fixed_container = gtk_fixed_new();
	list_container = gtk_fixed_new();
	drawing_area = gtk_drawing_area_new();
	gtk_widget_set_size_request (GTK_WIDGET(drawing_area), 2000, 2000);

	scroll_draw_zone = gtk_scrolled_window_new(NULL, NULL);
	scroll_list_zone = gtk_scrolled_window_new(NULL, NULL);
	scroll_tree_zone = gtk_scrolled_window_new(NULL, NULL);
	
	gtk_scrolled_window_set_min_content_width (GTK_SCROLLED_WINDOW(scroll_draw_zone),800);
	gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW(scroll_draw_zone),600 - 50);
	
	
	gtk_fixed_put(GTK_FIXED(fixed_container), GTK_WIDGET(scroll_draw_zone), 0, 20);
	gtk_fixed_put(GTK_FIXED(list_container), GTK_WIDGET(scroll_draw_zone), 0, 0);
	
	
	// Se configura la caja que contiene a las familias
	tree_box = setup_tree("FAMILIAS");
	add_family_to_list(tree_box,&f);
	// Se configura la caja que muestr a las personas
	list_box = setup_tree("PERSONAS");
	add_member_to_list(list_box,&p);
	
	gtk_container_add(GTK_CONTAINER(scroll_draw_zone), GTK_WIDGET(drawing_area));
	gtk_container_add(GTK_CONTAINER(scroll_tree_zone), GTK_WIDGET(tree_box));
	gtk_container_add(GTK_CONTAINER(scroll_list_zone), GTK_WIDGET(list_box));
	
	// Se agregan los elementos a la ventana
	gtk_paned_add1(GTK_PANED(paned_container_vertical),scroll_tree_zone);
	gtk_paned_add2(GTK_PANED(paned_container_vertical),scroll_list_zone);

	gtk_paned_add1(GTK_PANED(paned_container_horizontal),paned_container_vertical);
	gtk_paned_add2(GTK_PANED(paned_container_horizontal),fixed_container);

	
	// se conecta la senial "destroy" con la funcion gtk_main_quit
	g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
	g_signal_connect(G_OBJECT(drawing_area), "draw", G_CALLBACK(draw_tree), &f);
	g_signal_connect(G_OBJECT(tree_box), "row-activated", G_CALLBACK(show_family_info),GTK_WINDOW(window));
	g_signal_connect(G_OBJECT(list_box), "row-activated", G_CALLBACK(show_member_info),NULL);
	
	// los widget GTK estan escondidos por defecto, con esto los volvemos visibles
	gtk_widget_show_all (window);
	gtk_main ();	
	return 0;
}
Exemple #11
0
/**
 * Initialize the agent.  Calls into init_agent_read_config to set tha app's
 * configuration file in the appropriate default storage space,
 *  NETSNMP_DS_LIB_APPTYPE.  Need to call init_agent before calling init_snmp.
 *
 * @param app the configuration file to be read in, gets stored in default
 *        storage
 *
 * @return Returns non-zero on failure and zero on success.
 *
 * @see init_snmp
 */
int
init_agent(const char *app)
{
    int             r = 0;

    if(++done_init_agent > 1) {
        snmp_log(LOG_WARNING, "ignoring extra call to init_agent (%d)\n", 
                 done_init_agent);
        return r;
    }

    /*
     * get current time (ie, the time the agent started) 
     */
    gettimeofday(&starttime, NULL);
    starttime.tv_sec--;
    starttime.tv_usec += 1000000L;

    /*
     * we handle alarm signals ourselves in the select loop 
     */
    netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, 
			   NETSNMP_DS_LIB_ALARM_DONT_USE_SIG, 1);

#ifdef NETSNMP_CAN_USE_NLIST
    init_kmem("/dev/kmem");
#endif

    setup_tree();

	/* add by frank */
	/*´´½¨ÓëÊý¾Ý¿âÄ£¿é»¥³âͨѶµÄÍⲿSOCKET½Ó¿Ú*/
	dbsdev = dbsOpen(MID_SNMP);
	if( NULL != dbsdev )
	{
		dbsWaitModule(dbsdev, MF_CMM|MF_ALARM|MF_TM);
		//printf("init_agent: dbsOpen\n");
	}
	else
	{
		fprintf(stderr,"ERROR: snmpd->dbsOpen error, exited !\n");
	}
	
    if( CMM_SUCCESS != snmp2cmm_init() )
    {
    	  printf("module snmpd snmp2cmm_init error\n");
         dbs_sys_log(dbsdev, DBS_LOG_ERR, "module snmpd snmp2cmm_init error");
    }

    init_agent_read_config(app);

#ifdef TESTING
    auto_nlist_print_tree(-2, 0);
#endif

    _init_agent_callback_transport();
    
    netsnmp_init_helpers();
    init_traps();
    netsnmp_container_init_list();

#if defined(USING_AGENTX_SUBAGENT_MODULE) || defined(USING_AGENTX_MASTER_MODULE)
    /*
     * initialize agentx configs
     */
    agentx_config_init();
    if(netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID,
                              NETSNMP_DS_AGENT_ROLE) == SUB_AGENT)
        subagent_init();
#endif

    /*
     * Register configuration tokens from transport modules.  
     */
#ifdef NETSNMP_TRANSPORT_UDP_DOMAIN
    netsnmp_udp_agent_config_tokens_register();
#endif
#ifdef NETSNMP_TRANSPORT_UDPIPV6_DOMAIN
    netsnmp_udp6_agent_config_tokens_register();
#endif
#ifdef NETSNMP_TRANSPORT_UNIX_DOMAIN
    netsnmp_unix_agent_config_tokens_register();
#endif

#ifdef NETSNMP_EMBEDDED_PERL
    init_perl();
#endif

#ifdef USING_AGENTX_SUBAGENT_MODULE
    /*
     * don't init agent modules for a sub-agent
     */
    if (netsnmp_ds_get_boolean(NETSNMP_DS_APPLICATION_ID, 
			       NETSNMP_DS_AGENT_ROLE) == SUB_AGENT)
        return r;
#endif

#  include "agent_module_inits.h"

    return r;
}                               /* end init_agent() */
LauncherWindow::LauncherWindow(MainObject *mainOb, QWidget *parent)
    : QMainWindow(parent)
{

    mainObject = mainOb;
    setProperty("settings_namespace", QVariant("launcher_window"));
    mainObject->settings->restoreWindow(this);

    setWindowTitle("fgX Launcher");
    setWindowIcon(QIcon(":/icons/launcher"));
    //setWindowFlags(  Qt::WindowStaysOnTopHint);


    //* MainWidget and MainLayout
    QWidget *mainWidget = new QWidget(this);
    setCentralWidget(mainWidget);


    QVBoxLayout *mainVBox = new QVBoxLayout();
    mainVBox->setContentsMargins(0,0,0,0);
    mainVBox->setSpacing(0);
    mainWidget->setLayout(mainVBox);

    //** Header Banner across the top =========================
    QString header_style("padding: 10px; font-size: 11pt; font-weight: bold; background-color: qlineargradient(x1: 0, y1: 0, x2: 1, y2: 0, stop: 0 white, stop: 1 #F0DD17);");
    headerLabel = new QLabel(this);
    headerLabel->setText("fgX Launcher");
    headerLabel->setStyleSheet(header_style);
    mainVBox->addWidget(headerLabel, 0);

    splitter = new QSplitter();
    mainVBox->addWidget(splitter, 20);

    //** Main Tab =========================
    tabWidget = new QTabWidget(this);
    splitter->addWidget(tabWidget);
    connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(on_tab_changed(int)));

    //==================================================
    // Widgets

    //* Aircraft Widget
    aircraftWidget = new AircraftWidget(mainObject);
    tabWidget->addTab(aircraftWidget, tr("Aircraft"));
    connect(aircraftWidget, SIGNAL(set_arg(QString,QString,QString)), this, SLOT(set_arg(QString,QString,QString)));


    //* Options
    mainOptionsWidget = new MainOptionsWidget(mainObject);
    tabWidget->addTab(mainOptionsWidget, tr("Main Options"));
    connect(mainOptionsWidget, SIGNAL(set_arg(QString,QString,QString)), this, SLOT(set_arg(QString,QString,QString)));

    //* MpServers
    mpServersWidget = new MpServersWidget(mainObject);
    tabWidget->addTab(mpServersWidget, tr("Network"));
    connect(mpServersWidget, SIGNAL(set_arg(QString,QString,QString)), this, SLOT(set_arg(QString,QString,QString)));









    //* Airports Widget
    airportsWidget = new AirportsWidget(mainObject);
    tabWidget->addTab(airportsWidget, tr("Airports"));
    connect(airportsWidget, SIGNAL(set_arg(QString,QString,QString)), this, SLOT(set_arg(QString,QString,QString)));

    //=============================================================
    // ## Tree
    tree = new QTreeWidget();
    tree->setRootIsDecorated(false);
    tree->setMinimumWidth(400);
    tree->headerItem()->setText(0, "Option");
    tree->headerItem()->setText(1, "Value");
    tree->header()->setStretchLastSection(true);
    tree->setColumnWidth(C_ARG, 200);
    splitter->addWidget(tree);
    setup_tree();

    splitter->setStretchFactor(0,3);
    splitter->setStretchFactor(1,1);


    //*********************************************************
    //** Control Bar
    //*********************************************************
    controlBarWidget = new ControlBarWidget(mainObject);
    mainVBox->addWidget(controlBarWidget, 1);
    //controlBarWidget->hide();

    set_paths();

}
Exemple #13
0
PidginXferDialog *
pidgin_xfer_dialog_new(void)
{
	PidginXferDialog *dialog;
	GtkWidget *window;
	GtkWidget *vbox1, *vbox2;
	GtkWidget *sw;
	GtkWidget *button;
	GtkWidget *expander;
	GtkWidget *table;
	GtkWidget *checkbox;

	dialog = g_new0(PidginXferDialog, 1);
	dialog->keep_open =
		purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/filetransfer/keep_open");
	dialog->auto_clear =
		purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/filetransfer/clear_finished");

	/* Create the window. */
	dialog->window = window = pidgin_create_dialog(_("File Transfers"), PIDGIN_HIG_BORDER, "file transfer", TRUE);

	g_signal_connect(G_OBJECT(window), "delete_event",
					 G_CALLBACK(delete_win_cb), dialog);

	/* Create the parent vbox for everything. */
	vbox1 = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(window), FALSE, PIDGIN_HIG_BORDER);

	/* Create the main vbox for top half of the window. */
	vbox2 = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE);
	gtk_box_pack_start(GTK_BOX(vbox1), vbox2, TRUE, TRUE, 0);
	gtk_widget_show(vbox2);

	/* Setup the listbox */
	sw = setup_tree(dialog);
	gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0);
	gtk_widget_set_size_request(sw,-1, 140);

	/* "Close this window when all transfers finish" */
	checkbox = gtk_check_button_new_with_mnemonic(
			_("Close this window when all transfers _finish"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox),
								 !dialog->keep_open);
	g_signal_connect(G_OBJECT(checkbox), "toggled",
					 G_CALLBACK(toggle_keep_open_cb), dialog);
	gtk_box_pack_start(GTK_BOX(vbox2), checkbox, FALSE, FALSE, 0);
	gtk_widget_show(checkbox);

	/* "Clear finished transfers" */
	checkbox = gtk_check_button_new_with_mnemonic(
			_("C_lear finished transfers"));
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox),
								 dialog->auto_clear);
	g_signal_connect(G_OBJECT(checkbox), "toggled",
					 G_CALLBACK(toggle_clear_finished_cb), dialog);
	gtk_box_pack_start(GTK_BOX(vbox2), checkbox, FALSE, FALSE, 0);
	gtk_widget_show(checkbox);

	/* "Download Details" arrow */
	expander = gtk_expander_new_with_mnemonic(_("File transfer _details"));
	dialog->expander = expander;
	gtk_box_pack_start(GTK_BOX(vbox2), expander, FALSE, FALSE, 0);
	gtk_widget_show(expander);

	gtk_widget_set_sensitive(expander, FALSE);

	/* The table of information. */
	table = make_info_table(dialog);
	gtk_container_add(GTK_CONTAINER(expander), table);
	gtk_widget_show(table);

	/* Open button */
	button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_OPEN, G_CALLBACK(open_button_cb), dialog);
	gtk_widget_set_sensitive(button, FALSE);
	dialog->open_button = button;

	/* Pause button */
	button = pidgin_dialog_add_button(GTK_DIALOG(window), _("_Pause"), G_CALLBACK(pause_button_cb), dialog);
	gtk_widget_set_sensitive(button, FALSE);
	dialog->pause_button = button;

	/* Resume button */
	button = pidgin_dialog_add_button(GTK_DIALOG(window), _("_Resume"), G_CALLBACK(resume_button_cb), dialog);
	gtk_widget_set_sensitive(button, FALSE);
	dialog->resume_button = button;

	/* Remove button */
	button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_REMOVE, G_CALLBACK(remove_button_cb), dialog);
	gtk_widget_hide(button);
	dialog->remove_button = button;

	/* Stop button */
	button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_STOP, G_CALLBACK(stop_button_cb), dialog);
	gtk_widget_set_sensitive(button, FALSE);
	dialog->stop_button = button;

	/* Close button */
	button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE, G_CALLBACK(close_button_cb), dialog);
	dialog->close_button = button;

#ifdef _WIN32
	g_signal_connect(G_OBJECT(dialog->window), "show",
		G_CALLBACK(winpidgin_ensure_onscreen), dialog->window);
#endif

	return dialog;
}