Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep aspect ratio for thumbnails #6855

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/gui/shellextensionsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void ShellExtensionsServer::processCustomStateRequest(QLocalSocket *socket, cons
}
_customStateSocketConnections.remove(socket->socketDescriptor());
}

const auto folder = FolderMan::instance()->folder(folderAlias);
SyncJournalFileRecord record;
if (!folder || !folder->journalDb()->getFileRecord(filePathRelative, &record) || !record.isValid()) {
Expand Down Expand Up @@ -219,7 +219,7 @@ void ShellExtensionsServer::processCustomStateRequest(QLocalSocket *socket, cons
_runningLsColJobsForPaths.removeOne(lsColJobPath);
emit directoryListingIterationFinished(folderAlias);
});

_runningLsColJobsForPaths.push_back(lsColJobPath);
lsColJob->start();
}
Expand Down Expand Up @@ -251,6 +251,7 @@ void ShellExtensionsServer::processThumbnailRequest(QLocalSocket *socket, const
queryItems.addQueryItem(QStringLiteral("fileId"), record._fileId);
queryItems.addQueryItem(QStringLiteral("x"), QString::number(thumbnailRequestInfo.size.width()));
queryItems.addQueryItem(QStringLiteral("y"), QString::number(thumbnailRequestInfo.size.height()));
queryItems.addQueryItem(QStringLiteral("a"), QStringLiteral("true")); // Keep aspect ratio
const QUrl jobUrl = Utility::concatUrlPath(folder->accountState()->account()->url(), getFetchThumbnailPath(), queryItems);
const auto job = new SimpleNetworkJob(folder->accountState()->account());
job->startRequest(QByteArrayLiteral("GET"), jobUrl);
Expand All @@ -260,7 +261,7 @@ void ShellExtensionsServer::processThumbnailRequest(QLocalSocket *socket, const
sendEmptyDataAndCloseSession(socket);
return;
}

auto messageReplyWithThumbnail = QVariantMap {
{VfsShellExtensions::Protocol::ThumnailProviderDataKey, reply->readAll().toBase64()}
};
Expand Down Expand Up @@ -319,7 +320,7 @@ void ShellExtensionsServer::parseCustomStateRequest(QLocalSocket *socket, const
sendEmptyDataAndCloseSession(socket);
return;
}

const auto customStateRequestInfo = CustomStateRequestInfo {
itemFilePath,
foundFolderAlias
Expand Down
Loading