void MainWindow::on_actionAgregar_Arista_triggered() { QInputDialog insert; QString nodo1; QString nodo2; double peso; nodo1 = insert.getText(this,"Insertar Arista","Ingrese el Nombre del Primer Nodo.").toUpper().trimmed(); if(!nodo1.isEmpty()){ nodo2 = insert.getText(this,"Agregar Arista","Ingrese el Nombre del Segundo Nodo.").toUpper().trimmed(); if(!nodo2.isEmpty()) peso = insert.getDouble(this,"Agregar Arista","Ingrese el Peso de La Arista",0.1,1); else return; }else return; QString dia = this->ui->cb_Dias->currentText().toUpper(); QString hora = this->ui->cb_Hora->currentText().toUpper(); int n1,n2; n1 = this->consul->mg->getIndexNodo(nodo1); n2 = this->consul->mg->getIndexNodo(nodo2); qDebug()<<"nodo1: "<<n1<<" nodo2:"<<n2; if(n1==-1 || n2==-1){ if(n1==-1) QMessageBox::critical(this,"Error","El nombre "+nodo1+" no existe!!"); if(n2==-1) QMessageBox::critical(this,"Error","El nombre "+nodo2+" no existe!!"); return; } this->consul->mg->addArista(n1,n2,dia,hora,(float)peso); this->mostrarFloy(); this->ui->gridLayoutWidget->update(); }
void MainWindow::onProfileYarpNetwork() { if(mainGraph.nodesCount()) { QMessageBox::StandardButton reply; reply = QMessageBox::question(this, "Profiling: clear current project", "Running profiler will clear the current project.\n Are you sure?", QMessageBox::Yes|QMessageBox::No); if (reply == QMessageBox::No) return; } mainGraph.clear(); QInputDialog* inputDialog = new QInputDialog(this); inputDialog->setOptions(QInputDialog::NoButtons); bool ok=false; float timeout = inputDialog->getDouble(nullptr ,"Profiling: yarp clean", "Do you want to run yarp clean before profiling?\n\n" "Be aware that yarp clean with a little timetout could\n" "unregister ports that are actually open.\n\n" "Timeout(seconds):", 0.3, 0, 2147483647, 1, &ok); if (ok) { messages.append("Cleaning death ports..."); NetworkProfiler::yarpClean(timeout); } messages.append("Getting the ports list..."); NetworkProfiler::ports_name_set ports; NetworkProfiler::yarpNameList(ports); messages.append("Getting the ports details..."); NetworkProfiler::ports_detail_set portsInfo; progressDlg = new QProgressDialog("...", "Cancel", 0, 100, this); progressDlg->setLabelText("Getting the ports details..."); progressDlg->reset(); progressDlg->setRange(0, ports.size()); progressDlg->setValue(0); progressDlg->setWindowModality(Qt::WindowModal); progressDlg->show(); for(size_t i=0; i<ports.size(); i++) { NetworkProfiler::PortDetails info; std::string portname = ports[i].find("name").asString(); std::string msg = string("Cheking ") + portname + "..."; messages.append(QString(msg.c_str())); if(NetworkProfiler::getPortDetails(portname, info)) portsInfo.push_back(info); progressDlg->setValue(i); if (progressDlg->wasCanceled()) return; } //progressDlg->setValue(ports.size()); stringModel.setStringList(messages); ui->messageView->update(); NetworkProfiler::setProgressCallback(this); progressDlg->setLabelText("Generating the graph..."); progressDlg->setRange(0, 100); progressDlg->setValue(0); NetworkProfiler::creatNetworkGraph(portsInfo, mainGraph); progressDlg->close(); delete progressDlg; progressDlg = nullptr; // update QoS NetworkProfiler::updateConnectionQosStatus(mainGraph); moduleParentItem->setExpanded(true); portParentItem->setExpanded(true); machinesParentItem->setExpanded(true); currentGraph = &mainGraph; // add process and port nodes to the tree populateTreeWidget(); drawGraph(*currentGraph); ui->actionHighlight_Loops->setEnabled(true); ui->actionHidePorts->setEnabled(true); ui->actionHideDisconnectedPorts->setEnabled(true); ui->actionHideConnectionsLable->setEnabled(true); ui->actionDebugMode->setEnabled(true); ui->actionUpdateConnectionQosStatus->setEnabled(true); ui->actionProfilePortsRate->setEnabled(true); }
void Program::addDelay() { QInputDialog message; bool ok; float score = message.getDouble(this, "تاخیر", "مقدار زمان تاخیر را وارد کنید",0,0,200,2 ,&ok); if (ok == true) { sql.addDelay(studentsCombo->itemData(studentsCombo->currentIndex()).toInt(),score); update_delays(); } }
void Program::setStudentScore() { QInputDialog message; bool ok; float score = message.getDouble(this, "نمره دهی", "نمره را وارد کنید",0,0,20,2 ,&ok); if (ok == true) { sql.setStudentScore(studentsCombo->itemData(studentsCombo->currentIndex()).toInt(),coursesCombo->itemData(coursesCombo->currentIndex()).toInt(),score); update_student_scores(); } }