- QDialog dlg(this,"",TRUE);
- QLabel* tmpQLabel;
- QPushButton *addbtn,*delbtn,*okbtn,*cancelbtn;
- VLPEntry *pom;
- int i,j;
- char pomstr[255];
-
- //dlg.setStyle(WindowsStyle);
- nodelist = new QListBox( &dlg, "ListBox_1" );
- nodelist->setGeometry( 20, 40, 480, 160 );
-
- tmpQLabel = new QLabel( &dlg, "Label_1" );
- tmpQLabel->setGeometry( 20, 10, 100, 30 );
- tmpQLabel->setText( "Nodes:" );
-
- addbtn = new QPushButton( &dlg, "PushButton_1" );
- addbtn->setGeometry( 30, 210, 100, 30 );
- addbtn->setText( "Add VLP" );
- connect(addbtn,SIGNAL(clicked()),this,SLOT(AddNode()));
- delbtn = new QPushButton( &dlg, "PushButton_2" );
- delbtn->setGeometry( 150, 210, 100, 30 );
- delbtn->setText( "Del VLP" );
- connect(delbtn,SIGNAL(clicked()),this,SLOT(DelNode()));
- okbtn = new QPushButton( &dlg, "PushButton_3" );
- okbtn->setGeometry( 270, 210, 100, 30 );
- okbtn->setText( "Save files" );
- connect(okbtn,SIGNAL(clicked()),&dlg,SLOT(accept()));
- cancelbtn = new QPushButton( &dlg, "PushButton_4" );
- cancelbtn->setGeometry( 390, 210, 100, 30 );
- cancelbtn->setText( "Cancel" );
- connect(cancelbtn,SIGNAL(clicked()),&dlg,SLOT(reject()));
- dlg.resize( 520, 260 );
-
-
- if (dlg.exec()){
- if (!Nodes.isEmpty())
- {
- pom = Nodes.first();
- while (pom!=NULL)
- {
- j = Nodes.at();
- sprintf(pomstr,"%s.cfg",pom->addr);
-
- config_t cfg;
- config_setting_t *root, *setting;
- config_init(&cfg);
-
- root = config_root_setting(&cfg);
-
- setting = config_setting_get_member(root, "progdir");
- if(!setting) {
- setting = config_setting_add(root, "progdir", CONFIG_TYPE_STRING);
- }
- config_setting_set_string(setting, pom->progdir);
-
- setting = config_setting_get_member(root, "homedir");
- if(!setting) {
- setting = config_setting_add(root, "homedir", CONFIG_TYPE_STRING);
- }
- config_setting_set_string(setting, pom->homedir);
-
- setting = config_setting_get_member(root, "node_number");
- if(!setting) {
- setting = config_setting_add(root, "node_number", CONFIG_TYPE_INT);
- }
- config_setting_set_int(setting, pom->ID);
-
- if (pom->type == 0)
- {
- setting = config_setting_get_member(root, "type");
- if(!setting) {
- setting = config_setting_add(root, "type", CONFIG_TYPE_STRING);
- }
- config_setting_set_string(setting, "explicit");
- }
- for(i=0;i<Nodes.count();i++)
- {
- if (pom!=Nodes.at(i))
- {
- setting = config_setting_get_member(root, "host");
- if(!setting) {
- setting = config_setting_add(root, "host", CONFIG_TYPE_STRING);
- }
- config_setting_set_string(setting, Nodes.at(i)->addr);
- };
- }
-
- if(!config_write_file(&cfg, pomstr))
- {
- fprintf(stderr, "Error while writing to file: %s.\n", pomstr);
- }
- config_destroy(&cfg);
-
- pom = Nodes.at(j);
- pom = Nodes.next();
- }
- }
-
- };
-
-
-