void MainWindow::on_pushButtonPlay_clicked() { QMessageBox messageBox; if(ui->spinBoxHora->value() || ui->spinBoxMin->value()){ if(!ui->lineEditNome->text().isEmpty()){ ui->stackedWidget->setCurrentIndex(1); ui->timeEdit->setTime(QTime(ui->spinBoxHora->value(), ui->spinBoxMin->value())); ui->progressBar->setValue(0); QString pasta = "mkdir videos/" + ui->lineEditNome->text(); system(pasta.toUtf8()); if(connectPort("ttyUSB0")) QObject::connect(&serialPort, SIGNAL(readyRead()), this, SLOT(read())); else{ messageBox.critical(0,"Erro","Conexão falhou"); messageBox.setFixedSize(500,200); } if( !video() ){ messageBox.critical(0,"Erro","Falha na captura de vídeo"); messageBox.setFixedSize(500,200); } }else{ messageBox.critical(0,"Erro","Nome inválido"); messageBox.setFixedSize(500,200); } }else{ messageBox.critical(0,"Erro","Tempo inválido"); messageBox.setFixedSize(500,200); } }
void YarrGui::on_init_button_clicked(){ int index = ui->device_comboBox->currentIndex(); if(specVec.size() == 0 || index > specVec.size()){ QMessageBox errorBox; errorBox.critical(0, "Error", "Device not found!"); return; }else{ specVec[index]->init(index); if (specVec[index]->isInitialized()) { ui->specid_value->setNum(specVec[index]->getId()); ui->bar0_value->setNum(specVec[index]->getBarSize(0)); ui->bar4_value->setNum(specVec[index]->getBarSize(4)); ui->main_tabWidget->setTabEnabled(1, true); ui->main_tabWidget->setTabEnabled(2, true); tx = specVec[index]; rx = specVec[index]; bk = new Bookkeeper(tx, rx); }else{ QMessageBox errorBox; errorBox.critical(0, "Error", "Initialization not successful!"); return; } } ui->actionBenchmark->setEnabled(true); ui->actionCreate_scan->setEnabled(true); ui->actionEEPROM->setEnabled(true); return; }
void Customers::on_deleteCustomer_clicked() { QMessageBox::StandardButton reply; QMessageBox msgBox; reply = QMessageBox::question(this, "Delete Customer", "Are you want to delete customer?",QMessageBox::Yes|QMessageBox::No); if (reply == QMessageBox::Yes) { qDebug() << "Yes was clicked"; DbMysql* d = DbMysql::getInstance(); QString customer_id = ui->customersDetailsTable->selectedItems().at(0)->text(); if (!d->getConnection().open()) { msgBox.critical(this,"Error","Failed to connect database."); } else { QSqlQuery query("delete from customers where customer_id="+customer_id+";",d->getConnection()); if( !query.exec() ) { msgBox.critical(this,"Error","Failed to execute query."); qDebug()<<query.lastError().text(); return; } else{ msgBox.information(this,"Information","Customer Deleted."); this->getAllCustomerData(); } } } }
bool CreateLog::checkIfRoomNotVacant(QString room_ids) { DbMysql* d = DbMysql::getInstance(); QMessageBox msgBox; if(!d->getConnection().open()) { msgBox.critical(this,"Error","Failed to connect database.1"); return false; } else { QSqlQuery query1( "select * from rooms where room_id in ("+room_ids+") and room_state=1;" ,d->getConnection()); if(!query1.isActive()) { msgBox.critical(this,"Error","Failed to connect database."); } else { if(query1.size() > 0) { return false; } else return true; } } }
void ImageTags::addNewTag() { bool ok; QString title = tr("Add a new tag"); QString newTagName = QInputDialog::getText(this, title, tr("Enter new tag name"), QLineEdit::Normal, "", &ok); if (!ok) { return; } if(newTagName.isEmpty()) { QMessageBox msgBox; msgBox.critical(this, tr("Error"), tr("No name entered")); return; } QSetIterator<QString> knownTagsIt(GData::knownTags); while (knownTagsIt.hasNext()) { QString tag = knownTagsIt.next(); if (newTagName == tag) { QMessageBox msgBox; msgBox.critical(this, tr("Error"), tr("Tag ") + newTagName + tr(" already exists")); return; } } addTag(newTagName, false); GData::knownTags.insert(newTagName); redrawTree(); }
void CreateBooking::addStatusFields () { DbMysql* d = DbMysql::getInstance(); QMessageBox msgBox; if(!d->getConnection().open()) { msgBox.critical(this,"Error","Failed to connect database.1"); } else { QSqlQuery query1( "select * from customer_status;" ,d->getConnection()); if(!query1.isActive()) { msgBox.critical(this,"Error","Failed to connect database."); } else { //ui->roomsList->addItem("---- Select ----",QVariant::fromValue(-1)); while(query1.next()) { ui->customer_status->addItem(query1.value(1).toString(),QVariant::fromValue(query1.value(0).toInt())); } } QSqlQuery query2( "select * from payment_status;" ,d->getConnection()); if(!query2.isActive()) { msgBox.critical(this,"Error","Failed to connect database."); } else { //ui->roomsList->addItem("---- Select ----",QVariant::fromValue(-1)); while(query2.next()) { ui->payment_status->addItem(query2.value(1).toString(),QVariant::fromValue(query2.value(0).toInt())); } } QSqlQuery query3( "select * from booking_status;" ,d->getConnection()); if(!query3.isActive()) { msgBox.critical(this,"Error","Failed to connect database."); } else { //ui->roomsList->addItem("---- Select ----",QVariant::fromValue(-1)); while(query3.next()) { ui->booking_status->addItem(query3.value(1).toString(),QVariant::fromValue(query3.value(0).toInt())); } } } }
void MemoryCardManagerDialog::on_export_save_button_clicked() { int currentRow = ui->savelistWidget->currentRow(); int nItemCount = static_cast<int>(m_pCurrentMemoryCard->GetSaveCount() - 1); if (currentRow >= 0 && currentRow <= nItemCount) { const CSave *save = m_pCurrentMemoryCard->GetSaveByIndex(currentRow); if(save != NULL) { QFileDialog dialog(this); dialog.setAcceptMode(QFileDialog::AcceptSave); dialog.setNameFilter(tr("EMS Memory Adapter Save Dumps (*.psu)")); dialog.setDefaultSuffix("psu"); if (dialog.exec()) { QString fileName = dialog.selectedFiles().first(); try { auto output(Framework::CreateOutputStdStream(fileName.toStdString())); CSaveExporter::ExportPSU(output, save->GetPath()); } catch(const std::exception& Exception) { QString msg("Couldn't export save(s):\n\n%1"); QMessageBox messageBox; messageBox.critical(this,"Error",msg.arg(Exception.what())); messageBox.show(); return; } QString msg("Save exported successfully."); QMessageBox messageBox; messageBox.information(this,"Success",msg); messageBox.show(); return; } else { QString msg("Save export Cancelled."); QMessageBox messageBox; messageBox.warning(this,"Cancelled",msg); messageBox.show(); return; } } else { QString msg("Save not found,\nPlease try again."); QMessageBox messageBox; messageBox.critical(this,"Error",msg); messageBox.show(); } } else { QString msg("Invalid selection,\nPlease try again."); QMessageBox messageBox; messageBox.critical(this,"Error",msg); messageBox.show(); } }
void ImageView::saveImage() { Exiv2::Image::AutoPtr image; bool exifError = false; if (newImage) { saveImageAs(); return; } setFeedback(tr("Saving...")); try { image = Exiv2::ImageFactory::open(currentImageFullPath.toStdString()); image->readMetadata(); } catch (Exiv2::Error &error) { exifError = true; } QImageReader imgReader(currentImageFullPath); if (!displayPixmap.save(currentImageFullPath, imgReader.format().toUpper(), GData::defaultSaveQuality)) { QMessageBox msgBox; msgBox.critical(this, tr("Error"), tr("Failed to save image.")); return; } if (!exifError) { try { image->writeMetadata(); } catch (Exiv2::Error &error) { QMessageBox msgBox; msgBox.critical(this, tr("Error"), tr("Failed to save Exif metadata.")); } } reload(); setFeedback(tr("Image saved.")); }
void SimulatorWindow::on_commandLinkButton_2_clicked() //Run button { // this->Disassembler(); QMessageBox error; if(canRun) { while (ingy->getClk() <= ingy->getClkWAtFinal()) { ui->PCcount->setText(QString::number(ingy->getPC())); this->oldPC = ingy->textIM[ingy->getPC()]; ingy->test(); cout << "RUNNING!!!!"; this->setGraphContent(); ingy->incrementClk(); } this->setRegistersContent(); this->setDataContent(); } else { QString s = "PLEASE CHANGE THE CODE. "; QString s1= " "; error.critical(0,s1,s, "EDIT CODE"); error.show(); } }
void SimulatorWindow::on_commandLinkButton_clicked() // Next button { QMessageBox error; // run 1 step if(canRun) { if(ingy->getClk() <= ingy->getClkWAtFinal()) { ui->PCcount->setText(QString::number(ingy->getPC())); this->oldPC = ingy->textIM[ingy->getPC()]; //finished=S->run1(); ingy->test(); this->setGraphContent(); ingy->incrementClk(); this->setRegistersContent(); this->setDataContent(); } } else { QString s = "PLEASE CHANGE THE CODE. "; QString s1= " "; error.critical(0,s1,s, "EDIT CODE"); error.show(); } }
void MainWindow::shutDown() { if(!isConnected) close(); char sdata[6]; mutex.lock(); socket->write("dwnnow",6); socket->waitForBytesWritten(); socket->waitForReadyRead(); socket->read(sdata,6); if(sdata[0]=='d' && sdata[1]=='w' && sdata[2]=='n' && sdata[3]=='n' && sdata[4]=='o' && sdata[5]=='w') { socket->disconnect(); mutex.unlock(); close(); } else { mutex.unlock(); QMessageBox messageBox; messageBox.critical(0,"Fejl","Bilen kan ikke lukke ned!\n Prøv igen"); messageBox.setFixedSize(500,200); } }
void RoomSettings::addAllRoomEquipments() { DbMysql* d = DbMysql::getInstance(); QMessageBox msgBox; if(!d->getConnection().open()){ msgBox.critical(this,"Error","Failed to connect database."); } else { QSqlQuery query( "select * from room_equipments;" ,d->getConnection()); if( !query.isActive() ) { qDebug()<<"Failed to execute query. insert room."; qDebug()<<query.lastQuery(); qDebug()<<query.lastError().text(); return; } else { ui->equipList->clear(); int index=0; while(query.next()) { QListWidgetItem* item = new QListWidgetItem(); item->setText(query.value(1).toString()); qDebug()<<query.value(1).toString(); item->setData(Qt::UserRole,QVariant::fromValue(query.value(0).toInt())); ui->equipList->insertItem(index++,item); } } } }
/************************************************************************** * Dequeue * ------------------------------------------------------------------------ * Removes the first node from the list **************************************************************************/ Customer CustomerList::Dequeue() { Node<Customer>* temp; Customer tempCustomer; if(isEmpty()) { QMessageBox messageBox; messageBox.critical(0,"Error","**Cannot dequeue empty list**"); messageBox.setFixedSize(500,200); } else { //Assigns temp to head temp = _head; _head = _head->GetNext(); //Decrements the _nodeCount DecrementCount(); //Calls Orphan to set all pointers to NULL temp->Orphan(); tempCustomer = temp->GetData(); delete temp; temp = NULL; } return tempCustomer; }
bool DialogVideoPlayer::loadMovie(QString path) { qDebug() << "loading " << path; QFileInfo check_file(path); // check if file exists and if yes: Is it really a file and no directory? if (!check_file.exists() || !check_file.isFile()) { return false; } mediaPlayer->setMedia(QUrl::fromLocalFile(path)); // Wait to load... while(mediaPlayer->mediaStatus() != QMediaPlayer::LoadedMedia && mediaPlayer->mediaStatus() != QMediaPlayer::InvalidMedia) { qApp->processEvents(); } if (mediaPlayer->mediaStatus() != QMediaPlayer::InvalidMedia) { resizeDisplay(); ui->checkBoxMovie->setEnabled(true); ui->checkBoxMovie->setChecked(true); return true; } else { QMessageBox messageBox; messageBox.critical(0, "Error", "An error has occured when loading this movie!"); messageBox.setFixedSize(500, 200); } return false; }
//################################################################################################ // Show folder selection dialog when user chooses output directory void ExportSingle::Browse(){ QString outputdir=QFileDialog::getExistingDirectory(this, "Select Directory",ui->ExportLocation->text(),QFileDialog::ShowDirsOnly); // only copy the directory to the ExportLocation field if the size is greater than 0. // if the user cancels the QFileDialog, the size WILL be 0 and we don't want this to be blank. if(outputdir.length() != 0){ QFileInfo p(outputdir); if(p.isWritable()){ ui->ExportLocation->clear(); ui->ExportLocation->setText(outputdir); } else{ QMessageBox m; m.critical(this,"RoboJournal","You are not allowed to save files in <b>" + outputdir +"</b>! Please select a different location and try again."); // Browse for another directory outputdir.clear(); Browse(); } } }
void MainWindow::on_cbAnalyse_currentIndexChanged(const QString &arg2) { QMdiSubWindow *subWindow1 = new QMdiSubWindow; subWindow1 = ui->mdiArea->currentSubWindow(); if(subWindow1 != 0){ ImageWindows *imCurrent = (ImageWindows*)subWindow1->widget(); QImage imTransform = imCurrent->getImageCurrent(); ui->lbl_curren_image_selectionner->setText(imCurrent->getImageName()); if (arg2 == "Lecture code barre") { LectureCB *leccb = new LectureCB(ui->mdiArea, imTransform); ui->sa_outil_2->setWidget(leccb); } if (arg2 == "Comptage Objet") { Comptage *compte = new Comptage(ui->mdiArea, imTransform); ui->sa_outil_2->setWidget(compte); } if (arg2 == "Signatures") { Signatures *signature = new Signatures(ui->mdiArea, imTransform); ui->sa_outil_2->setWidget(signature); } }else { QMessageBox messageBox; messageBox.critical(0,"Error","Aucune image n'est ouverte"); messageBox.setFixedSize(500,200); messageBox.show(); } }
// load settings from .cvs file, basically, this is the file names void FileNames::loadSettings() { // regular expression to follow format such that "Text <num> = <filename with num> (optional: _ <char><letters>).txt // this is best practice to be sure the file is not having to be exaclty type in as some way boost::regex expression("(\\s*)(Test)(\\s*)[0-9]*(\\s*)(=)(\\s*)[a-zA-Z]*[0-9]*((_)[a-zA-Z]*)?(.txt)(\\s*)"); // instream to get file contents std::fstream input_file; // open up file input_file.open("file_names.csv", std::ios::in); // if error with file if(input_file.fail()) { // error message QMessageBox messageBox; messageBox.critical(0,"Error","File: file_names.csv missing"); messageBox.setFixedSize(500,200); } // file is fine else { // string to get line from file std::string temp = ""; // loop file getting each line while(std::getline(input_file, temp)) { // hold string match results boost::match_results<std::string::const_iterator> results; // get results based off regualr expression if(boost::regex_match(temp, results, expression)) { // set to use string methods // anything after results[0]is for other purposes temp = results[0]; // remove all white spaces from text temp.erase(std::remove_if(temp.begin(), temp.end(), [](char pos){return std::isspace(pos);}), temp.end()); // seperate string into two substrings, test and filename for test // based off = sign boost::regex filename_re("="); // iterator object based off start of vector, end of vector, and the = // can't recall what the -1 was for boost::sregex_token_iterator iter(temp.begin(), temp.end(), filename_re, -1); // since the strings are now seperated as tokens // this returns the test number e.g. test=1,2,3,...etc std::string test_number = (*iter); // get next address (next test value) iter++; // get test name e.g. HapticTask1_Fatigue.txt, etc std::string test_name = (*iter); // no need to iterate here // pass in the test value and name into a pair // this will be used for later // to get values off hashmap to match file name with // proper file that was loaded into program std::pair<std::string, std::string> file_info (test_number, test_name); // insert new pair (into hashmap) this->names.insert(file_info); } } } }
void MemoryCardManagerDialog::on_import_saves_button_clicked() { QFileDialog dialog(this); dialog.setFileMode(QFileDialog::ExistingFiles); dialog.setNameFilter(tr("All Supported types (*.psu *.sps *.xps *.max);;EMS Memory Adapter Save Dumps (*.psu);;Sharkport/X-Port Save Dumps (*.sps; *.xps);;Action Replay MAX Save Dumps (*.max);;All files (*.*)")); if (dialog.exec()) { QString fileName = dialog.selectedFiles().first(); try { auto input(Framework::CStdStream(fileName.toStdString().c_str(), "r")); CSaveImporter::ImportSave(input, m_pCurrentMemoryCard->GetBasePath(), std::bind(&MemoryCardManagerDialog::OnImportOverwrite, this, std::placeholders::_1)); } catch(const std::exception& Exception) { QString msg("Couldn't import save(s):\n\n%1"); QMessageBox messageBox; messageBox.critical(this,"Error",msg.arg(Exception.what())); messageBox.show(); return; } m_pCurrentMemoryCard->RefreshContents(); populateSaveList(); } }
/** * When the filter button is clicked this function is called which applies the * current date filter to the data displayed. If date is invalid a message box * is produced to inform the client. */ void Summary::on_pushButton_clicked() { int tabindex = ui->tabWidget->currentIndex(); QString currentTabText = ui->tabWidget->tabText(tabindex); ui->lineEdit->setValidator(new QIntValidator(1000, 3000, this)); ui->lineEdit_2->setValidator(new QIntValidator(1000, 3000, this)); int earliest = ui->lineEdit->text().toInt(); int latest = ui->lineEdit_2->text().toInt(); if(earliest > latest) { QMessageBox messageBox; messageBox.critical(0,"Error","Invalid input !"); messageBox.setFixedSize(600,200); } else { qDebug() << ui->tabWidget->tabText(tabindex); if(/*(GrantSummary !=NULL) &&*/ (ui->tabWidget->tabText(tabindex).contains("Grant")) && currentTabText.contains("Grant")) { GrantSummary->getCreateTreeWidget()->clear(); GrantSummary->AddRoot("", "", ""); GrantSummary->fillTreeWidgetForGrant(db, earliest, latest); } if(/*(PublicationSummary != NULL) &&*/ (ui->tabWidget->tabText(tabindex).contains("Publication")) && currentTabText.contains("Publication")) { PublicationSummary->getCreateTreeWidget()->clear(); PublicationSummary->AddRoot("", ""); PublicationSummary->fillTreeWidgetForPublication(db, earliest, latest); } if(/*(PresentationSummary != NULL) && */(ui->tabWidget->tabText(tabindex).contains("Presentation")) && currentTabText.contains("Presentation")) { PresentationSummary->getCreateTreeWidget()->clear(); PresentationSummary->AddRoot("", ""); PresentationSummary->fillTreeWidgetForPresentation(db, earliest, latest); } if(/*(PresentationSummary != NULL) && */(ui->tabWidget->tabText(tabindex).contains("Teaching")) && currentTabText.contains("Teaching")) { TeachingSummary->getCreateTreeWidget()->clear(); int startYear = ui->lineEdit->text().toInt(), endYear = ui->lineEdit_2->text().toInt(), different = endYear-startYear; std::vector<std::vector<std::string>> PME_Name(different, std::vector<std::string>()), UME_Name(different, std::vector<std::string>()), CME_Name(different, std::vector<std::string>()), Other_Name(different, std::vector<std::string>()); std::vector<std::vector<double>> PME_Time(different, std::vector<double>()), UME_Time(different, std::vector<double>()), CME_Time(different, std::vector<double>()), Other_Time(different, std::vector<double>()); db.teachingSummary(PME_Name, UME_Name, CME_Name, Other_Name,PME_Time, UME_Time, CME_Time, Other_Time, startYear, endYear ); double totalPME = TeachingSummary->calcTotal(PME_Name, PME_Time); TeachingSummary->fillTreeWidgetForTeaching("PME", totalPME, PME_Name, PME_Time,startYear); double totalUME = TeachingSummary->calcTotal(UME_Name, UME_Time); TeachingSummary->fillTreeWidgetForTeaching("UME", totalUME, UME_Name, UME_Time,startYear); double totalCME = TeachingSummary->calcTotal(CME_Name, CME_Time); TeachingSummary->fillTreeWidgetForTeaching("CME", totalCME, CME_Name, CME_Time,startYear); double totalOTHER = TeachingSummary->calcTotal(Other_Name, Other_Time); TeachingSummary->fillTreeWidgetForTeaching("OTHER", totalOTHER, Other_Name, Other_Time,startYear); } } graphs(); //ui->tabWidget->setCurrentIndex(tabindex); }
void MainWindow::computationStatusMessage(QString str) { if(str.startsWith("[ERROR]")) { QMessageBox mb; mb.critical(0, "Error", str); return; } ui->statusBar->showMessage(str); }
void MainWindow::connectionLost() { isConnected=false; delete socket; QMessageBox messageBox; messageBox.critical(0,"Fejl","Forbindelsen er tabt!\n Prøv at forbind igen"); messageBox.setFixedSize(500,200); }
void CreateBooking::addCustomersInForm() { DbMysql* d = DbMysql::getInstance(); QMessageBox msgBox; QCompleter* cl = new QCompleter(this); QStandardItemModel *model = new QStandardItemModel(cl); //ui->roomsList->setCurrentText("-----Select-----"); if(!d->getConnection().open()) { msgBox.critical(this,"Error","Failed to connect database.1"); } else { QSqlQuery query1( "select customer_id,customer_name from customers order by customer_id desc;" ,d->getConnection()); if(!query1.isActive()) { msgBox.critical(this,"Error","Failed to connect database."); } else { //ui->roomsList->addItem("---- Select ----",QVariant::fromValue(-1)); while(query1.next()) { QStandardItem *item = new QStandardItem; item->setText(query1.value(1).toString()); item->setData(query1.value(0).toInt(), Qt::UserRole); model->appendRow(item); } } } cl->setCaseSensitivity(Qt::CaseInsensitive); cl->setModel(model); ui->c_customer_name->setCompleter(cl); //ui->c_customer_name connect(cl, SIGNAL(activated(QModelIndex)),this, SLOT(onItemActivated(QModelIndex))); }
void YarrGui::on_prog_button_clicked() { int index = ui->device_comboBox->currentIndex(); if (specVec.size() == 0 || index > specVec.size()) { QMessageBox errorBox; errorBox.critical(0, "Error", "Device not found!"); } else { if (!specVec[index]->isInitialized()) { QMessageBox errorBox; errorBox.critical(0, "Error", "Spec not initiliazed!"); return; } // std::fstream file(ui->progfile_name->text().toStdString().c_str(), std::fstream::in); std::fstream file; if(ui->revABitfRadio->isChecked()){ file.open("../hdl/syn/yarr_quad_fei4_revA.bit", std::fstream::in); }else if(ui->revBBitfRadio->isChecked()){ file.open("../hdl/syn/yarr_quad_fei4_revB.bit", std::fstream::in); }else{ std::cerr << "ERROR - must choose one bitfile (rev A or rev B) - aborting... " << std::endl; return; } if (!file) { QMessageBox errorBox; errorBox.critical(0, "Error", "Problem opening File!"); return; } size_t size = BitFile::getSize(file); // Read file into buffer char *buffer = new char[size]; file.seekg(0, std::ios::beg); file.read(buffer, size); // Program FPGA int wrote = specVec[index]->progFpga(buffer, size); if (wrote != size) { QMessageBox errorBox; errorBox.critical(0, "Error", "FPGA not succesfully programmed!"); } delete buffer; file.close(); } }
void MainWindow::on_crackButton_clicked() { if (!_userList.empty()) { ui->tabWidget->setCurrentIndex(3); upload(ui->targetfile_path->text().toStdString()); std::stringstream run_cmd; if (ui->cracker_box->currentIndex() == 0){ // bruteforce run_cmd << " ./bin/mack_the_knife " << " -C Brute_Cracker " << " --cracker.device " << ui->device_box->currentText().toStdString() << " --cracker.target-file " << ui->targetfile_path->text().toStdString() << " --cracker.algorithm " << " MD5_Algorithm " << " --cracker.length " << ui->brute_length_box->value() << " --cracker.keytable " << ui->brute_keytable_edit->text().toStdString() ; } else if (ui->cracker_box->currentIndex() == 1){ // dictionary run_cmd << " ./bin/mack_the_knife " << " -C Dictionary_Cracker " << " --cracker.device " << ui->device_box->currentText().toStdString() << " --cracker.target-file " << ui->targetfile_path->text().toStdString() << " --cracker.algorithm " << " MD5_Algorithm " << " --cracker.dictionary " << ui->dict_dict_edit->text().toStdString() << " --cracker.digits " << ui->dict_digits_box->value() << " --cracker.hostmem " << ui->dict_hostmem_box->value() << " --cracker.varycase "; if (ui->dict_varycase_checkbox->isTristate()) run_cmd << "false"; else run_cmd << "true"; } else if (ui->cracker_box->currentIndex() == 2){ // rainbowtable run_cmd << " ./bin/mack_the_knife " << " -C Rainbow_Cuda_Cracker " << " --cracker.device " << ui->device_box->currentText().toStdString() << " --cracker.target-file " << ui->targetfile_path->text().toStdString() << " --cracker.algorithm " << " MD5_Algorithm " << " --cracker.length " << ui->rainbow_target_length_box->value() << " --cracker.keytable " << ui->rainbow_keytable_edit->text().toStdString() << " --cracker.chainlength " << ui->rainbow_chain_length_box->value() << " --cracker.rainbowtable " << ui->rainbow_table_edit->text().toStdString(); } run_mack(run_cmd.str()); } else { ui->tabWidget->setCurrentIndex(0); QMessageBox messageBox; messageBox.critical(0,"Error","Es liegen keine Nutzerkonten vor.\nBitte legen sie ein Nutzerkonto an."); messageBox.setFixedSize(500,200); } }
void LoginWin::on_loginButton_clicked() { Client *par = client; try{ if (!par->sendLogin(ui->userEntry->text(), ui->passEntry->text())) { //TODO Make dialog QMessageBox messageBox; messageBox.critical(0,"ERROR", "Invalid Login Credentials"); messageBox.setFixedSize(500,200); ui->passEntry->setText(""); }else{ }}catch(socketexception ex){ QMessageBox messageBox; messageBox.critical(0,"ERROR", "Server not responding"); messageBox.setFixedSize(500,200); } }
void MainWindow::errorWindow(QString errorText) { if ( !MainWindow::instanceExists() ) { return; } QMessageBox messageBox; messageBox.critical(0,"Error",errorText); messageBox.setFixedSize(500,200); }
void YarrGui::on_progfile_button_clicked() { QString filename = QFileDialog::getOpenFileName(this, tr("Select bit-file"), "./", tr("Bit File(*.bit)")); std::fstream file(filename.toStdString().c_str(), std::fstream::in); if (!file && BitFile::checkFile(file)) { QMessageBox errorBox; errorBox.critical(0, "Error", "Selected bit file looks bad!"); ui->progfile_name->setText(""); return; } ui->progfile_name->setText(filename); }
// save everything void MainWindow::saveParameters() { // obtain radio properties obtainOptionsSelectedMainWindow(); // check if other menus have been included yet if( ispOpened == false ) { ispMenu = new isp( fileName ); appendOptions( ispMenu->getISPParameters() ); delete ispMenu; } if( parameters.size() == 0 ) { QMessageBox messageBox; messageBox.critical(0,"Error","Unnecessary save. All options are default!"); messageBox.setFixedSize(500,200); } else // write to file { // check # of configuration std::stringstream pFileName; int degree = 1; pFileName << "configuration" << degree << ".xml"; while( fileExists( pFileName.str() ) ) { degree++; pFileName.str(""); pFileName << "configuration" << degree << ".xml"; } fileName = pFileName.str(); // save to file std::ofstream myfile; myfile.open( fileName.c_str() ); for( unsigned int i = 0; i < parameters.size(); i++ ) { myfile << parameters.at(i).toString() << "\n"; } myfile.close(); // save options saveMainWindowUIOptions( fileName.substr(0,fileName.length()-3) + "ini" ); // inform user QMessageBox messageBox; std::string message = "Configurations have been saved to " + fileName; messageBox.information( 0, "Saved", message.c_str() ); } }
void AddFriendDialog::slotOkClicked(){ QString u = ui->usernameLineEdit->text(); if(u.isEmpty()){ QMessageBox *a = new QMessageBox(); a->critical(0,"Error","Username cannot be empty"); a->setFixedSize(500,200); }else{ close(); emit okClicked(u); } }
void MainWindow::controller() { XboxController_ = new XboxController(1); if(!XboxController_->connect()) { QMessageBox messageBox; messageBox.critical(0,"Fejl","Controlleren er ikke tilsluttet"); messageBox.setFixedSize(500,200); delete XboxController_; return; } controllerSocket = new QTcpSocket; connect(controllerSocket,SIGNAL(connected()),this,SLOT(controllerIsConnected()),Qt::AutoConnection); connect(controllerSocket,SIGNAL(disconnected()),this,SLOT(controllerLostConnection()),Qt::AutoConnection); controllerSocket->connectToHost(IP,1235); if(!controllerSocket->waitForConnected(1000)) { QMessageBox messageBox; messageBox.critical(0,"Fejl","Controlleren kunne ikke oprette forbindelse til bilen"); messageBox.setFixedSize(500,200); delete controllerSocket; delete XboxController_; } else { int error = pthread_create(&controllerThread, NULL, this->controllerStreamHelper ,this); if(error !=0) { qDebug()<<"Error on pthread_create controller"<<endl; return; } } }