aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2023-02-08 10:22:12 -0500
committerGravatar Chris Xiong <chirs241097@gmail.com> 2023-02-08 10:22:12 -0500
commitcf144e36098eb624a0b62c48c37f6f3f73d5be06 (patch)
tree90d3261139d99140532fbd89edc64b7d2bd6bd8c
parentac42ab0d74e4827c21423a25cf0639dbd6a42559 (diff)
downloaddeduper-cf144e36098eb624a0b62c48c37f6f3f73d5be06.tar.xz
Open in file browser fixed for Windows (patch by @BLumia).
-rw-r--r--qdeduper/imageitem.cpp2
-rw-r--r--qdeduper/utilities.cpp5
2 files changed, 5 insertions, 2 deletions
diff --git a/qdeduper/imageitem.cpp b/qdeduper/imageitem.cpp
index b037df4..a0e9788 100644
--- a/qdeduper/imageitem.cpp
+++ b/qdeduper/imageitem.cpp
@@ -148,7 +148,7 @@ QSize ImageItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QMod
vpsz.setWidth(vpsz.width() - vw);
vpsz.setHeight(vpsz.height() - hh);
QPixmap pm = index.data(Qt::ItemDataRole::DecorationRole).value<QPixmap>();
- QSize onscsz = pm.size() / pm.devicePixelRatioF();
+ QSize onscsz = pm.isNull() ? QSize(0, 0) : pm.size() / pm.devicePixelRatioF();
int imh = onscsz.height();
if (onscsz.width() > vpsz.width() - 2 * MARGIN - 2 * BORDER)
imh = (vpsz.width() - 2 * MARGIN - 2 * BORDER) / (double)onscsz.width() * onscsz.height();
diff --git a/qdeduper/utilities.cpp b/qdeduper/utilities.cpp
index aef471d..29e986b 100644
--- a/qdeduper/utilities.cpp
+++ b/qdeduper/utilities.cpp
@@ -10,6 +10,9 @@
#include <QDBusConnection>
#include <QDBusMessage>
#endif
+#ifdef _WIN32
+#include <QDir>
+#endif
namespace utilities
{
@@ -40,7 +43,7 @@ fs::path qstring_to_path(const QString &s)
void open_containing_folder(const fs::path &path)
{
#ifdef _WIN32
- QProcess::startDetached("explorer", QStringList() << "/select," << fspath_to_qstring(path));
+ QProcess::startDetached("explorer", QStringList() << "/select," << QDir::toNativeSeparators(fspath_to_qstring(path)));
#else
#ifdef HAS_QTDBUS
auto conn = QDBusConnection::sessionBus();