@@ -467,40 +467,40 @@ void AscentViewer::changeToPhoto(int photoIndex, bool saveDescriptionFirst)
467
467
468
468
if (currentPhotoIndex < 0 || photos.isEmpty ()) {
469
469
imageLabel->clearImage ();
470
- return ;
471
- }
472
-
473
- QString filepath = photos.at (currentPhotoIndex).filepath ;
474
- QImageReader reader (filepath);
475
- reader.setAutoTransform (true );
476
- const QImage newImage = reader.read ();
477
- if (newImage.isNull ()) {
478
- qDebug () << " Error reading" << filepath << reader.errorString ();
479
- imageLabel->clearImage ();
480
-
481
- QString title = tr (" File error" );
482
- QString message = tr (" Photo could not be loaded:" )
483
- + " \n " + filepath
484
- + " \n\n " + tr (" Do you want to remove it from this ascent?" );
485
- QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel;
486
- QMessageBox::StandardButton result = QMessageBox::warning (this , title, message, buttons);
487
-
488
- if (result == QMessageBox::Yes) {
489
- removeCurrentPhoto (); // calls changeToPhoto() back, recursing until valid image is found or all photos removed
490
- }
491
470
}
492
471
else {
493
- image = newImage;
494
- if (image.colorSpace ().isValid ()) image.convertToColorSpace (QColorSpace::SRgb);
495
- imageLabel->setImage (image);
472
+ QString filepath = photos.at (currentPhotoIndex).filepath ;
473
+ QImageReader reader = QImageReader (filepath);
474
+ reader.setAutoTransform (true );
475
+ const QImage newImage = reader.read ();
476
+ if (newImage.isNull ()) {
477
+ qDebug () << " Error reading" << filepath << reader.errorString ();
478
+ imageLabel->clearImage ();
479
+
480
+ QString title = tr (" File error" );
481
+ QString message = tr (" Photo could not be loaded:" )
482
+ + " \n " + filepath
483
+ + " \n\n " + tr (" Do you want to remove it from this ascent?" );
484
+ QMessageBox::StandardButtons buttons = QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel;
485
+ QMessageBox::StandardButton result = QMessageBox::warning (this , title, message, buttons);
486
+
487
+ if (result == QMessageBox::Yes) {
488
+ removeCurrentPhoto (); // calls changeToPhoto() back, recursing until valid image is found or all photos removed
489
+ }
490
+ }
491
+ else {
492
+ image = newImage;
493
+ if (image.colorSpace ().isValid ()) image.convertToColorSpace (QColorSpace::SRgb);
494
+ imageLabel->setImage (image);
495
+ }
496
+
497
+ photoDescriptionLabel ->setText (photos.at (currentPhotoIndex).description );
498
+ photoDescriptionLineEdit->setText (photos.at (currentPhotoIndex).description );
499
+ photoDescriptionLabel ->setVisible (!photoDescriptionEditable);
500
+ photoDescriptionLineEdit->setVisible (photoDescriptionEditable);
501
+ imageLabel ->setToolTip (filepath);
496
502
}
497
503
498
- photoDescriptionLabel ->setText (photos.at (currentPhotoIndex).description );
499
- photoDescriptionLineEdit->setText (photos.at (currentPhotoIndex).description );
500
- photoDescriptionLabel ->setVisible (!photoDescriptionEditable);
501
- photoDescriptionLineEdit->setVisible (photoDescriptionEditable);
502
- imageLabel ->setToolTip (filepath);
503
-
504
504
updatePhotoIndexLabel ();
505
505
updatePhotoButtonsEnabled ();
506
506
}
0 commit comments