feat: load gallery for wsl$ location
This commit is contained in:
parent
7245a4e212
commit
e2fb1813f1
|
@ -35,10 +35,6 @@ void GraphicsView::showFileFromUrl(const QUrl &url, bool doRequestGallery)
|
||||||
// TODO: remove this workaround when M$ change the "wsl$" hostname.
|
// TODO: remove this workaround when M$ change the "wsl$" hostname.
|
||||||
if (Q_UNLIKELY(url.scheme() == QStringLiteral("qtbug-86277"))) {
|
if (Q_UNLIKELY(url.scheme() == QStringLiteral("qtbug-86277"))) {
|
||||||
filePath = url.path();
|
filePath = url.path();
|
||||||
// Qt's QUrl won't work with such hostname anyway so the urls will
|
|
||||||
// still be the wrong one when requesting gallery. So we just don't
|
|
||||||
// request gallery here...
|
|
||||||
doRequestGallery = false;
|
|
||||||
}
|
}
|
||||||
#endif // Q_OS_WIN
|
#endif // Q_OS_WIN
|
||||||
|
|
||||||
|
|
|
@ -238,9 +238,20 @@ void MainWindow::loadGalleryBySingleLocalFile(const QString &path)
|
||||||
clearGallery();
|
clearGallery();
|
||||||
|
|
||||||
for (int i = 0; i < entryList.count(); i++) {
|
for (int i = 0; i < entryList.count(); i++) {
|
||||||
const QString & oneEntry = entryList.at(i);
|
const QString & fileName = entryList.at(i);
|
||||||
m_files.append(QUrl::fromLocalFile(dir.absoluteFilePath(oneEntry)));
|
const QString & oneEntry = dir.absoluteFilePath(fileName);
|
||||||
if (oneEntry == currentFileName) {
|
QUrl url = QUrl::fromLocalFile(oneEntry);
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
// TODO: remove this workaround when M$ change the "wsl$" hostname.
|
||||||
|
// Qt will convert path "\\wsl$\" to "//wsl$/"...
|
||||||
|
if (Q_UNLIKELY(oneEntry.startsWith(R"(//wsl$/)"))) {
|
||||||
|
url.clear();
|
||||||
|
url.setScheme(QStringLiteral("qtbug-86277"));
|
||||||
|
url.setPath(oneEntry);
|
||||||
|
}
|
||||||
|
#endif // Q_OS_WIN
|
||||||
|
m_files.append(url);
|
||||||
|
if (fileName == currentFileName) {
|
||||||
m_currentFileIndex = i;
|
m_currentFileIndex = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user