- QLineEdit* progs;
- progs = new QLineEdit( &dlg, "progs" );
- progs->setGeometry( 150, 20, 180, 30 );
- progs->setText(progdir);
-
- QLabel* tmpQLabel;
- tmpQLabel = new QLabel( &dlg, "Label_1" );
- tmpQLabel->setGeometry( 30, 20, 120, 30 );
- tmpQLabel->setText( "Programs directory" );
-
- QFrame* tmpQFrame;
- tmpQFrame = new QFrame( &dlg, "Frame_2" );
- tmpQFrame->setGeometry( 10, 60, 380, 30 );
- tmpQFrame->setFrameStyle( 52 );
-
- tmpQLabel = new QLabel( &dlg, "Label_2" );
- tmpQLabel->setGeometry( 10, 80, 340, 30 );
- tmpQLabel->setText( "Virtual Processor properties (activated after restarting VLP):" );
-
- QLineEdit *nn;
- char nns[256];
- nn = new QLineEdit( &dlg, "LineEdit_2" );
- nn->setGeometry( 110, 110, 40, 30 );
- sprintf(nns,"%d",NodeNumber);
- nn->setText(nns);
-
- tmpQLabel = new QLabel( &dlg, "Label_3" );
- tmpQLabel->setGeometry( 20, 110, 90, 30 );
- tmpQLabel->setText( "Node number:" );
-
- QRadioButton *exp,*reg;
- exp = new QRadioButton( &dlg, "RadioButton_3" );
- exp->setGeometry( 30, 170, 100, 30 );
- exp->setText( "Explicit" );
- exp->setChecked( TRUE );
-
- reg = new QRadioButton( &dlg, "RadioButton_4" );
- reg->setGeometry( 30, 200, 100, 30 );
- reg->setText( "Registration" );
- reg->setEnabled(FALSE);
-
- connections = new QListBox( &dlg, "ListBox_1" );
- connections->setGeometry( 170, 140, 130, 100 );
- e = ConnectList.first();
- while(e != NULL) {
- connections->insertItem(e->addr);
- e = ConnectList.next();
- }
-
- tmpQLabel = new QLabel( &dlg, "Label_5" );
- tmpQLabel->setGeometry( 170, 110, 100, 30 );
- tmpQLabel->setText( "Connection list:" );
-
- QPushButton* addbtn,*delbtn,*okbtn,*cancelbtn;
- addbtn = new QPushButton( &dlg, "PushButton_1" );
- addbtn->setGeometry( 310, 150, 60, 30 );
- addbtn->setText( "Add" );
- delbtn = new QPushButton( &dlg, "PushButton_2" );
- delbtn->setGeometry( 310, 200, 60, 30 );
- delbtn->setText( "Del" );
- connect(addbtn,SIGNAL(clicked()),this,SLOT(AddAddress()));
- connect(delbtn,SIGNAL(clicked()),this,SLOT(DelAddress()));
- okbtn = new QPushButton( &dlg, "PushButton_3" );
- okbtn->setGeometry( 80, 260, 100, 30 );
- okbtn->setText( "Ok" );
- okbtn->setDefault(TRUE);
- cancelbtn = new QPushButton( &dlg, "PushButton_4" );
- cancelbtn->setGeometry( 210, 260, 100, 30 );
- cancelbtn->setText( "Cancel" );
- connect(okbtn,SIGNAL(clicked()),&dlg,SLOT(accept()));
- connect(cancelbtn,SIGNAL(clicked()),&dlg,SLOT(reject()));
- QButtonGroup* group;
- group = new QButtonGroup( &dlg, "ButtonGroup_1" );
- group->setGeometry( 20, 150, 120, 90 );
- group->setTitle( "Connection type" );
- group->setAlignment( 1 );
- group->lower();
- group->insert(exp,1);
- group->insert(reg,2);
-
- dlg.resize( 400, 310 );
- if(dlg.exec()) {
- config_t cfg;
- config_setting_t *root, *setting;
- config_init(&cfg);
-
- root = config_root_setting(&cfg);
-
- setting = config_setting_add(root, "progdir", CONFIG_TYPE_STRING);
- config_setting_set_string(setting, progs->text().ascii());
- strcpy(progdir,progs->text());
-
- setting = config_setting_add(root, "node_number", CONFIG_TYPE_INT);
- config_setting_set_int(setting, atoi(nn->text()));
-
- setting = config_setting_add(root, "homedir", CONFIG_TYPE_STRING);
- config_setting_set_string(setting, HomeDir);
-
- setting = config_setting_add(root, "type", CONFIG_TYPE_STRING);
- if (exp->isChecked()) {
- config_setting_set_string(setting, "explicit");
-
- config_setting_t *hosts = NULL;
- hosts = config_setting_add(root, "host", CONFIG_TYPE_ARRAY);
- for(i=0;i<connections->count();i++) {
- setting = config_setting_add(hosts, NULL, CONFIG_TYPE_STRING);
- config_setting_set_string(setting, connections->text(i).ascii());
- }
- } else {
- config_setting_set_string(setting, "register");
- }
-
- if(!config_write_file(&cfg, "vlp.cfg")) {
- fprintf(stderr, "Error while writing to file: %s.\n", "vlp.cfg");
- }
- config_destroy(&cfg);