// Driver fn... void DoListStuff() { list *MyList = 0; InsertIntoListTail(&MyList, 100); InsertIntoListTail(&MyList, 12); InsertIntoListTail(&MyList, 42); InsertIntoListTail(&MyList, 1123); InsertIntoListTail(&MyList, 1213); if (FindData(MyList, 75)) foundIt(); if (FindData(MyList, 42)) foundIt(); if (FindData(MyList, 700)) foundIt(); }
void MainWindow::on_pushButton_Drawing_clicked() { QString fileNumber; fileNumber = ui->lineEdit_FindPart->text(); int partNumber = fileNumber.toInt(); int directoryMin = (partNumber /1000)* (1000) + 1;// rounding number int directoryMax = directoryMin + 999; if(fileNumber == "0") { QMessageBox::information(this, "Enter a valid number", "Enter a number other than 0"); } else if(fileNumber == "") { QMessageBox::information(this, "Empty", "Enter a number"); } else if (partNumber <= 10000)// if part number is between 1 and 10000 use the static directory AND ADD DASH (-) { searchingFiles(); //static directory QString directoryRange = "B-0001-B10000"; // assigned to a variable to be able to check the status bool linkToDrawing = QDesktopServices::openUrl(QUrl("file:///N:/SolidWorksDrawing/B---/" + directoryRange + "/B-" + fileNumber + ".slddrw") ); if(linkToDrawing !=true) { notFoundLessThan(); QMessageBox::information(this, "Not Found", "The drawing you are looking for was not found in this directory"); } else { foundItLessThan(); } } else { searchingFiles(); //converting ints to strings and concatinating them QString directoryRange = "B"+ QString::number(directoryMin)+ "-" + "B" + QString::number(directoryMax); bool linkToDrawing = QDesktopServices::openUrl(QUrl("file:///N:/SolidWorksDrawing/B---/" + directoryRange + "/b" + fileNumber + ".slddrw") ); if(linkToDrawing !=true) { notFound(); QMessageBox::information(this, "Not Found", "The drawing you are looking for was not found in this directory"); } else { foundIt(); } } }
void MainWindow::on_pushButton_Pdf_clicked() { QString fileNumber; fileNumber = ui->lineEdit_FindPart->text(); int partNumber = fileNumber.toInt(); if(fileNumber == "" ) { QMessageBox::information(this, "Empty", "Enter a number"); } else if(fileNumber == "0" ) { QMessageBox::information(this, "Enter a valid number", "Enter a number other than 0"); } else if (partNumber <= 10000) // IF PART LESS THAN 10000, ADD DASH (-) { searchingFiles(); // assigned to a variable to be able to check the status bool linkToPdf = QDesktopServices::openUrl(QUrl("file:///P:/S_Works-Dwgs/B---/B-" + fileNumber + ".pdf") ); if(linkToPdf!= true) { notFoundLessThan(); QMessageBox::information(this, "Not Found", "The PDF you are looking for was not found in this directory"); } else { foundItLessThan(); } } else { searchingFiles(); // assigned to a variable to be able to check the status bool linkToPdf = QDesktopServices::openUrl(QUrl("file:///P:/S_Works-Dwgs/B---/B" + fileNumber + ".pdf") ); if(linkToPdf!= true) { notFound(); QMessageBox::information(this, "Not Found", "The PDF you are looking for was not found in this directory"); } else { foundIt(); } } }