mirror of https://github.com/CGAL/cgal
Lab: Use Results to Avoid Warning (#9156)
## Summary of Changes Check that `open()` worked to avoid warnings [here](https://cgal.geometryfactory.com/CGAL/testsuite/CGAL-6.2-Ic-50/Lab_Demo/TestReport_cgaltest_ArchLinux-clang-CXX20-Release.gz). ## Release Management * Affected package(s): Lab * License and copyright ownership: unchanged
This commit is contained in:
commit
def6c38d76
|
|
@ -1795,8 +1795,8 @@ bool MainWindow::loadScript(QFileInfo info)
|
||||||
QString program;
|
QString program;
|
||||||
QString filename = info.absoluteFilePath();
|
QString filename = info.absoluteFilePath();
|
||||||
QFile script_file(filename);
|
QFile script_file(filename);
|
||||||
script_file.open(QIODevice::ReadOnly);
|
bool success = script_file.open(QIODevice::ReadOnly);
|
||||||
if(!script_file.isReadable()) {
|
if((! success) || (!script_file.isReadable())) {
|
||||||
throw std::ios_base::failure(script_file.errorString().toStdString());
|
throw std::ios_base::failure(script_file.errorString().toStdString());
|
||||||
}
|
}
|
||||||
program = script_file.readAll();
|
program = script_file.readAll();
|
||||||
|
|
@ -2747,9 +2747,9 @@ void MainWindow::exportStatistics()
|
||||||
if(filename.isEmpty())
|
if(filename.isEmpty())
|
||||||
return;
|
return;
|
||||||
QFile output(filename);
|
QFile output(filename);
|
||||||
output.open(QIODevice::WriteOnly | QIODevice::Text);
|
bool success = output.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||||
|
|
||||||
if(!output.isOpen()){
|
if((! success) || (!output.isOpen())){
|
||||||
qDebug() << "- Error, unable to open" << "outputFilename" << "for output";
|
qDebug() << "- Error, unable to open" << "outputFilename" << "for output";
|
||||||
}
|
}
|
||||||
QTextStream outStream(&output);
|
QTextStream outStream(&output);
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ bool Camera_positions_list::save(QString filename) {
|
||||||
if(m_model->rowCount() <1)
|
if(m_model->rowCount() <1)
|
||||||
return false;
|
return false;
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
file.open(QIODevice::WriteOnly);
|
if(file.open(QIODevice::WriteOnly)){
|
||||||
QTextStream out(&file);
|
QTextStream out(&file);
|
||||||
for(int i = 0; i < m_model->rowCount(); ++i)
|
for(int i = 0; i < m_model->rowCount(); ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -105,6 +105,8 @@ bool Camera_positions_list::save(QString filename) {
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera_positions_list::on_saveButton_pressed()
|
void Camera_positions_list::on_saveButton_pressed()
|
||||||
|
|
@ -129,8 +131,10 @@ void Camera_positions_list::on_openButton_pressed()
|
||||||
|
|
||||||
void Camera_positions_list::load(QString filename) {
|
void Camera_positions_list::load(QString filename) {
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
|
|
||||||
|
if(file.open(QIODevice::ReadOnly)){
|
||||||
std::clog << "Loading camera positions " << qPrintable(filename) << std::endl;
|
std::clog << "Loading camera positions " << qPrintable(filename) << std::endl;
|
||||||
file.open(QIODevice::ReadOnly);
|
|
||||||
QTextStream input(&file);
|
QTextStream input(&file);
|
||||||
while(!input.atEnd()) {
|
while(!input.atEnd()) {
|
||||||
QString text = input.readLine(1000);
|
QString text = input.readLine(1000);
|
||||||
|
|
@ -143,6 +147,9 @@ void Camera_positions_list::load(QString filename) {
|
||||||
Three::activeViewer()->dumpFrame(frame));
|
Three::activeViewer()->dumpFrame(frame));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
std::clog << "Loading camera positions " << qPrintable(filename) << " failed" << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera_positions_list::on_frontButton_pressed()
|
void Camera_positions_list::on_frontButton_pressed()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue