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 ContextMenu::rename() { QInputDialog* inputDialog = new QInputDialog(); inputDialog->setOptions(QInputDialog::NoButtons); QString oldName = getNearestPointName(_lastPosImage); QString newName = inputDialog->getText(NULL, tr("Rename"), tr("Point name:"), QLineEdit::Normal, oldName); if (!newName.isEmpty() && (newName != oldName)) emit changeName(oldName, newName); }
void dCacheMainWindow::showPassword() { /** * Show an input Dialog box to enter the proxy password */ bool ok; QInputDialog* inputDialog = new QInputDialog(); inputDialog->setOptions(QInputDialog::NoButtons); QString password = inputDialog->getText(this, tr("Enter password"), tr("Password:"******""), &ok); if(ok && !password.isEmpty()) { m_proxy->setPassword(password);//send the password to the process that creates the grid proxy } }
/** * Decrypts a text using cipher text and cipher key * Chooses between a permanent or a individual password using the preferences */ void MainWindow::on_actionDecrypt_triggered() { if (passwordUsed) { query.prepare("SELECT `Password` FROM `password`;"); query.exec(); QString passwordBase; while ( query.next() ) { passwordBase = query.value(0).toString(); } QByteArray passwordTemp = QByteArray::fromBase64( passwordBase.toUtf8() ); password = QString(passwordTemp); Regex regex; QRegExp rePassword( regex.getPassword() ); if ( !password.isEmpty() && password.contains(rePassword) ) { decrypted = decrypt(password); ui->textEdit_mainWindow_surface->setHtml( QString(decrypted) ); } else { QMessageBox::critical(this, tr("Error"), tr("An error has ocurred. Please revise your entries and note the following:\n" "A Password must contain at least one upper case letter.\n" "A Password must contain at least one lower case letter.\n" "A Password must contain at least one numeric digit.")); qDebug() << "Data could not be decrypted because the password requirements were not met."; } } else { bool ok = false; QInputDialog* inputDialog = new QInputDialog(); inputDialog->setAttribute(Qt::WA_DeleteOnClose, true); inputDialog->setOptions(QInputDialog::NoButtons); password = inputDialog->getText(NULL ,tr("Decryption"), tr("Password:"******"", &ok); if (ok) { Regex regex; QRegExp rePassword( regex.getPassword() ); if ( !password.isEmpty() && password.contains(rePassword) ) { decrypted = decrypt(password); ui->textEdit_mainWindow_surface->setHtml( QString(decrypted) ); } else { QMessageBox::critical(this, tr("Error"), tr("An error has ocurred. Please revise your entries and note the following:\n" "A Password must contain at least one upper case letter.\n" "A Password must contain at least one lower case letter.\n" "A Password must contain at least one numeric digit.")); qDebug() << "Data could not be decrypted because the password requirements were not met."; } } else { inputDialog->reject(); } inputDialog->close(); } }