Start: Cleanup and minor bugfixes

Start: Remove QML include
Start: Eliminate errors on unreadable images
Start: Ensure command succeeded
Start: Correct startup WB
Also re-enable the migrator, which was not the culprit.
Gui: Roll back unneeded NoneWorkbench changes
This commit is contained in:
Chris Hennes
2024-04-19 23:30:10 -05:00
parent 5d7fec1e98
commit e0debb03ca
8 changed files with 61 additions and 16 deletions

View File

@@ -69,10 +69,12 @@ void FileCardDelegate::paint(QPainter* painter,
auto pixmap = gsl::owner<QPixmap*>(new QPixmap());
if (!image.isEmpty()) {
pixmap->loadFromData(image);
auto scaled = pixmap->scaled(QSize(thumbnailSize, thumbnailSize),
Qt::AspectRatioMode::KeepAspectRatio,
Qt::TransformationMode::SmoothTransformation);
thumbnail->setPixmap(scaled);
if (!pixmap->isNull()) {
auto scaled = pixmap->scaled(QSize(thumbnailSize, thumbnailSize),
Qt::AspectRatioMode::KeepAspectRatio,
Qt::TransformationMode::SmoothTransformation);
thumbnail->setPixmap(scaled);
}
}
else {
thumbnail->setPixmap(generateThumbnail(path));
@@ -141,7 +143,9 @@ QPixmap FileCardDelegate::generateThumbnail(const QString& path) const
// It is an image: it can be its own thumbnail
QImageReader reader(path);
auto image = reader.read();
return pixmapToSizedQImage(image, thumbnailSize);
if (!image.isNull()) {
return pixmapToSizedQImage(image, thumbnailSize);
}
}
QIcon icon = QFileIconProvider().icon(QFileInfo(path));
if (!icon.isNull()) {