From 4d9ba4c431bc2479fcc8253ed8f08867e70cdb71 Mon Sep 17 00:00:00 2001 From: reionwong Date: Fri, 27 Aug 2021 01:25:53 +0800 Subject: [PATCH] Fix Removable device category --- model/placesmodel.cpp | 1 + qml/SideBar.qml | 4 ++++ thumbnailer/thumbnailprovider.cpp | 3 +++ 3 files changed, 8 insertions(+) diff --git a/model/placesmodel.cpp b/model/placesmodel.cpp index 9c27838..337da74 100644 --- a/model/placesmodel.cpp +++ b/model/placesmodel.cpp @@ -254,6 +254,7 @@ void PlacesModel::onDeviceAdded(const QString &udi) beginInsertRows(QModelIndex(), rowCount(), rowCount()); PlacesItem *deviceItem = new PlacesItem; deviceItem->setUdi(udi); + deviceItem->setCategory(tr("Drives")); m_items.append(deviceItem); endInsertRows(); } diff --git a/qml/SideBar.qml b/qml/SideBar.qml index 590ad84..24001be 100644 --- a/qml/SideBar.qml +++ b/qml/SideBar.qml @@ -29,6 +29,10 @@ ListView { signal clicked(string path) + FishUI.WheelHandler { + target: sideBar + } + PlacesModel { id: placesModel onDeviceSetupDone: sideBar.clicked(filePath) // 设备挂载上后,模拟点击了该设备以打开该页面 diff --git a/thumbnailer/thumbnailprovider.cpp b/thumbnailer/thumbnailprovider.cpp index f77399d..c76bcce 100644 --- a/thumbnailer/thumbnailprovider.cpp +++ b/thumbnailer/thumbnailprovider.cpp @@ -33,6 +33,9 @@ QImage ThumbnailProvider::requestImage(const QString &id, QSize *size, const QSi if (size) *size = requestedSize; + QString f = id; + qDebug() << id << QFile::exists(f.replace("file://", "")); + QString thumbnail = ThumbnailCache::self()->requestThumbnail(id, requestedSize); if (!thumbnail.isEmpty()) {