- connections = new QListWidget(&dlg);
- connections->setGeometry(170, 140, 130, 100);
-
- for (int i = 0; i < ConnectList.size(); i++) {
- e = ConnectList.at(i);
- connections->addItem(e->addr);
- }
-
- tmpQLabel = new QLabel("Connection list:", &dlg);
- tmpQLabel->setGeometry(170, 110, 100, 30);
-
- QPushButton *addbtn;
- QPushButton *delbtn;
- QPushButton *okbtn;
- QPushButton *cancelbtn;
- addbtn = new QPushButton("Add", &dlg);
- addbtn->setGeometry(310, 150, 60, 30);
- connect(addbtn, SIGNAL(clicked()), this, SLOT(AddAddress()));
-
- delbtn = new QPushButton("Del", &dlg);
- delbtn->setGeometry(310, 200, 60, 30);
- connect(delbtn, SIGNAL(clicked()), this, SLOT(DelAddress()));
-
- okbtn = new QPushButton("Ok", &dlg);
- okbtn->setGeometry(80, 260, 100, 30);
- okbtn->setDefault(TRUE);
- connect(okbtn, SIGNAL(clicked()), &dlg, SLOT(accept()));
-
- cancelbtn = new QPushButton("Cancel", &dlg);
- cancelbtn->setGeometry(210, 260, 100, 30);
- connect(cancelbtn, SIGNAL(clicked()), &dlg, SLOT(reject()));
-
- QGroupBox* group;
- group = new QGroupBox("Connection type", &dlg);
- group->setGeometry(20, 150, 120, 90);
- group->setAlignment(Qt::AlignLeft);
- group->lower();
-
- QVBoxLayout *vbox = new QVBoxLayout();
- vbox->addWidget(exp);
- vbox->addWidget(reg);
- vbox->addStretch(1);
- group->setLayout(vbox);
-
- dlg.resize(400, 310);
- if (dlg.exec()) {
- config_t cfg;
- config_setting_t *root;
- config_setting_t *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().toAscii().data());
- strcpy(progdir, progs->text().toAscii().data());
-
- setting = config_setting_add(root, "node_number",
- CONFIG_TYPE_INT);
- config_setting_set_int(setting, atoi(nn->text().toAscii().data()));
-
- 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->item(i)->text().toAscii().data());
- }
- } 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);