diff --git a/src/exifreader.cpp b/src/exifreader.cpp index deaf876..ed8aa37 100644 --- a/src/exifreader.cpp +++ b/src/exifreader.cpp @@ -184,20 +184,20 @@ ExifData ExifReader::read(const QByteArray &path) QString latStr = findTag(exif, "Exif.GPSInfo.GPSLatitude"); QString latRef = findTag(exif, "Exif.GPSInfo.GPSLatitudeRef"); if (!latStr.isEmpty() && !latRef.isEmpty()) { - data.latitude = latStr + u" " + latRef; + data.latitude = latStr + " " + latRef; } QString lonStr = findTag(exif, "Exif.GPSInfo.GPSLongitude"); QString lonRef = findTag(exif, "Exif.GPSInfo.GPSLongitudeRef"); if (!lonStr.isEmpty() && !lonRef.isEmpty()) { - data.longitude = lonStr + u" " + lonRef; + data.longitude = lonStr + " " + lonRef; } if (!data.latitude.isEmpty() && !data.longitude.isEmpty()) { double lat = parseGpsCoordinate(exif, "Exif.GPSInfo.GPSLatitude"); - if (latRef == u"S") lat = -lat; + if (latRef == "S") lat = -lat; double lon = parseGpsCoordinate(exif, "Exif.GPSInfo.GPSLongitude"); - if (lonRef == u"W") lon = -lon; + if (lonRef == "W") lon = -lon; data.osmLink = QString::fromLatin1("https://www.openstreetmap.org/?mlat=%1&mlon=%2#map=16/%1/%2") .arg(lat, 0, 'f', 6).arg(lon, 0, 'f', 6); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1d3f3cf..2816da8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -680,9 +680,19 @@ void MainWindow::executeContextMenu(const QPoint &globalPos, const QByteArray &p QAction *copyFilenameAction = menu.addAction(tr("Copy filename")); QAction *copyFullPathAction = menu.addAction(tr("Copy full path")); menu.addSeparator(); - QAction *rotateLeftAction = menu.addAction(tr("Rotate Left")); - QAction *rotateRightAction = menu.addAction(tr("Rotate Right")); - menu.addSeparator(); + + QFileInfo info(QFile::decodeName(path)); + QString suffix = info.suffix().toLower(); + bool isJpg = (suffix == "jpg" || suffix == "jpeg"); + + QAction *rotateLeftAction = nullptr; + QAction *rotateRightAction = nullptr; + if (isJpg) { + rotateLeftAction = menu.addAction(tr("Rotate Left")); + rotateRightAction = menu.addAction(tr("Rotate Right")); + menu.addSeparator(); + } + QAction *editDescriptionAction = menu.addAction(tr("Edit description")); QAction *moveToTrashAction = menu.addAction(tr("Move to trash")); moveToTrashAction->setShortcut( @@ -693,9 +703,9 @@ void MainWindow::executeContextMenu(const QPoint &globalPos, const QByteArray &p QGuiApplication::clipboard()->setText(filenameFromPath(path)); } else if (chosen == copyFullPathAction) { QGuiApplication::clipboard()->setText(displayPath(path)); - } else if (chosen == rotateLeftAction) { + } else if (rotateLeftAction && chosen == rotateLeftAction) { rotateImage(index, false); - } else if (chosen == rotateRightAction) { + } else if (rotateRightAction && chosen == rotateRightAction) { rotateImage(index, true); } else if (chosen == editDescriptionAction) { onEditCaption();