mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-21 19:35:49 +08:00
refactor: remove ensureConnection method and update MediaPreviewDialog for image loading
This commit is contained in:
+15
-19
@@ -174,26 +174,22 @@ void MediaPreviewDialog::loadMedia()
|
||||
|
||||
void MediaPreviewDialog::loadImage()
|
||||
{
|
||||
// TODO
|
||||
// // Load image asynchronously
|
||||
// auto future = QtConcurrent::run([this]() {
|
||||
// return PhotoModel::loadThumbnailFromDevice(m_device, m_filePath,
|
||||
// QSize(4096, 4096), "");
|
||||
// });
|
||||
auto future = QtConcurrent::run(
|
||||
[this]() { return PhotoModel::loadImage(m_device, m_filePath, ""); });
|
||||
|
||||
// auto *watcher = new QFutureWatcher<QPixmap>(this);
|
||||
// connect(watcher, &QFutureWatcher<QPixmap>::finished, this,
|
||||
// [this, watcher]() {
|
||||
// QPixmap pixmap = watcher->result();
|
||||
// if (!pixmap.isNull()) {
|
||||
// m_originalPixmap = pixmap;
|
||||
// onImageLoaded();
|
||||
// } else {
|
||||
// onImageLoadFailed();
|
||||
// }
|
||||
// watcher->deleteLater();
|
||||
// });
|
||||
// watcher->setFuture(future);
|
||||
auto *watcher = new QFutureWatcher<QPixmap>(this);
|
||||
connect(watcher, &QFutureWatcher<QPixmap>::finished, this,
|
||||
[this, watcher]() {
|
||||
QPixmap pixmap = watcher->result();
|
||||
if (!pixmap.isNull()) {
|
||||
m_originalPixmap = pixmap;
|
||||
onImageLoaded();
|
||||
} else {
|
||||
onImageLoadFailed();
|
||||
}
|
||||
watcher->deleteLater();
|
||||
});
|
||||
watcher->setFuture(future);
|
||||
}
|
||||
|
||||
void MediaPreviewDialog::loadVideo()
|
||||
|
||||
Reference in New Issue
Block a user