Example #1
0
static void OnCommandInstallPath(void)
{
    char InstallPath[INSTALLFOLDER_MAX_PATH];

    carbon_debug("OnCommandInstallPath()\n");
    // Bring up dialog to prompt for new folder
    if(carbon_PromptForPath(InstallPath, INSTALLFOLDER_MAX_PATH))
    {
        // If user hit OK
        set_installpath(cur_info, InstallPath);

        carbon_SetEntryText(MyRes, OPTION_INSTALL_PATH_ENTRY_ID, GetSpecialPathName(InstallPath));
        update_space();
        check_install_button();
    }
}
Example #2
0
void MainWindow::on_pushButton_1_clicked()          //button "Update" - used for update info in tree
{
    setButtonState(false,false);
    int lvl = selected_lvl();
    space * wp = (space*)getRoot();
    if(lvl == 0)
    {
        update_space(ui->lineEdit_space->text());

    }else if(lvl == 1){
        int index_sx = selected_index(0);
        star * p_star = (star*)wp->sublvl[index_sx];
        update_star(p_star,ui->lineEdit_star_name->text(),
                    ui->lineEdit_star_class->text(),
                    ui->lineEdit_star_mass->text().toInt());

    }else if(lvl == 2){
        int index_sx = selected_index(1);
        star * p_star = (star*)wp->sublvl[index_sx];

        int index_px = selected_index(0);
        planet * p_planet = (planet*)p_star->sublvl[index_px];

        update_planet(p_planet,ui->lineEdit_planet_name->text(),
                      ui->lineEdit_dist_to_star->text().toFloat(),
                      ui->lineEdit_planet_mass->text().toFloat());

    }else if(lvl == 3){
        int index_sx = selected_index(2);
        star * p_star = (star*)wp->sublvl[index_sx];

        int index_px = selected_index(1);
        planet * p_planet = (planet*)p_star->sublvl[index_px];

        int index_satx = selected_index(0);
        satellite * p_sat = (satellite*)p_planet->sublvl[index_satx];

        update_satellite(p_sat,ui->lineEdit_sat_name->text(),
                         ui->lineEdit_sat_dist->text().toFloat(),
                         ui->checkBox->isChecked());

    }else{
        setButtonState(true,true);
        return;
    }
    show_tree();
}
Example #3
0
/********** EVENT HANDLERS **********/
void OnKeyboardEvent()
{
    carbon_debug("OnKeyboardEvent()\n");

    // If we're an app bundle, this field is disabled
    if(!GetProductIsAppBundle(cur_info))
    {
        // Set install and binary paths accordingly
        char string[1024];
        carbon_GetEntryText(MyRes, OPTION_INSTALL_PATH_ENTRY_ID, string, 1024);
        set_installpath(cur_info, string);
        // Only set binary path if symbolic link checkbox is set
        if(carbon_GetCheckbox(MyRes, OPTION_SYMBOLIC_LINK_CHECK_ID))
        {
            carbon_debug("OnCommandBeginInstall() - Setting binary path\n");
            carbon_GetEntryText(MyRes, OPTION_LINK_PATH_ENTRY_ID, string, 1024);
            set_symlinkspath(cur_info, string);
        }
        update_space();
        check_install_button();
    }
}
Example #4
0
static install_state carbonui_setup(install_info *info)
{
    //GtkWidget *window;
    //GtkWidget *options;
    OptionsBox *options;
    xmlNodePtr node;

    carbon_debug("***carbonui_setup()\n");

    // These are required before displaying the CDKey.  I'm not sure why this
    //  is true, but they show up blank later on...even when making a call to
    //  these functions later in this function.
    init_install_path();
    init_binary_path();
    update_size();
    update_space();

    // If CDKEY attribute was specified, show the CDKEY screen
    if(GetProductCDKey(cur_info))
    {
        // Show CDKey entry page and wait for user to hit cancel or continue
        carbon_SetProperWindowSize(MyRes, NULL);
        carbon_ShowInstallScreen(MyRes, CDKEY_PAGE);
        CDKeyOK = false;
        carbon_IterateForState(MyRes, &CDKeyOK);
        // Go back to the option page as normal for this function
        if(!express_setup)
            carbon_ShowInstallScreen(MyRes, OPTION_PAGE);
    }

    // If express setup, go right to copy page
    if(express_setup)
    {
        carbon_ShowInstallScreen(MyRes, COPY_PAGE);
        cur_state = SETUP_INSTALL;
        return cur_state;
    }

    // User could've canceled installation during the CDKey
    if(cur_state != SETUP_EXIT)
    {
        // Else, let the user select appropriate options
        //options = glade_xml_get_widget(setup_glade, "option_vbox");
        //gtk_container_foreach(GTK_CONTAINER(options), empty_container, options);
        options = carbon_OptionsNewBox(MyRes, true, OnOptionClickEvent);
        info->install_size = 0;
        node = info->config->root->childs;
        radio_list = NULL;
        in_setup = TRUE;
        while ( node ) {
		    if ( ! strcmp(node->name, "option") ) {
			    parse_option(info, NULL, node, options, 0, NULL, 0, NULL);
		    } else if ( ! strcmp(node->name, "exclusive") ) {
			    xmlNodePtr child;
			    RadioGroup *list = NULL;
			    for ( child = node->childs; child; child = child->next) {
				    parse_option(info, NULL, child, options, 0, NULL, 1, &list);
			    }
		    } else if ( ! strcmp(node->name, "component") ) {
                if ( match_arch(info, xmlGetProp(node, "arch")) &&
                    match_libc(info, xmlGetProp(node, "libc")) && 
				    match_distro(info, xmlGetProp(node, "distro")) ) {
                    xmlNodePtr child;
                    if ( xmlGetProp(node, "showname") ) {
                        //GtkWidget *widget = gtk_hseparator_new();
                        //gtk_box_pack_start(GTK_BOX(options), GTK_WIDGET(widget), FALSE, FALSE, 0);
                        //gtk_widget_show(widget);                
                        carbon_OptionsNewSeparator(options);
                        //widget = gtk_label_new(xmlGetProp(node, "name"));
                        //gtk_box_pack_start(GTK_BOX(options), GTK_WIDGET(widget), FALSE, FALSE, 10);
                        //gtk_widget_show(widget);
                        carbon_OptionsNewLabel(options, xmlGetProp(node, "name"));
                    }
                    for ( child = node->childs; child; child = child->next) {
					    if ( ! strcmp(child->name, "option") ) {
						    //parse_option(info, xmlGetProp(node, "name"), child, window, options, 0, NULL, 0, NULL);
                            parse_option(info, xmlGetProp(node, "name"), child, options, 0, NULL, 0, NULL);
					    } else if ( ! strcmp(child->name, "exclusive") ) {
						    xmlNodePtr child2;
						    RadioGroup *list = NULL;
						    for ( child2 = child->childs; child2; child2 = child2->next) {
							    //parse_option(info, xmlGetProp(node, "name"), child2, window, options, 0, NULL, 1, &list);
                                parse_option(info, xmlGetProp(node, "name"), child2, options, 0, NULL, 1, &list);
						    }
					    }
                    }
                }
		    }
		    node = node->next;
        }

        // Render and display options in window
        carbon_OptionsShowBox(options);
        // Refresh the enable/disable status of buttons
        carbon_RefreshOptions(options);
        // Resize the window if there are too many options to fit
        carbon_SetProperWindowSize(MyRes, options);

        init_install_path();
        init_binary_path();
        update_size();
        update_space();
        init_menuitems_option(info);

        in_setup = FALSE;

        int TempState = carbon_IterateForState(MyRes, &cur_state);
        // Return the window back to default size, if necessary except
        //  if we're exiting (so we don't redisplay the window after it
        //  has been hidden
        if(cur_state != SETUP_EXIT)
            carbon_SetProperWindowSize(MyRes, NULL);
        // Return the next state as appopriate
        return TempState;
    }

    // Return the current state if it's SETUP_EXIT
    return cur_state;
}