31 lines
1001 B
C++
31 lines
1001 B
C++
#pragma once
|
|
|
|
#include <QString>
|
|
#include <QUrl>
|
|
|
|
// Single authority for the image-provider URL grammar:
|
|
// image://<scheme>/<entry>[?src=<percent-encoded-source-path>]
|
|
// The optional src query names the container file (archive, document) the
|
|
// entry lives in; when absent, providers fall back to their current file.
|
|
namespace ImageUrl {
|
|
|
|
QString build(const QString &scheme, const QString &entry);
|
|
QString build(const QString &scheme, const QString &entry, const QString &sourcePath);
|
|
|
|
// "?src=<percent-encoded-source-path>" — for appending to an existing URL.
|
|
QString querySuffix(const QString &sourcePath);
|
|
|
|
struct Parsed {
|
|
QString entry;
|
|
QString sourcePath; // empty = use the provider's current file
|
|
};
|
|
|
|
// Parse the id handed to QQuickAsyncImageProvider (scheme already stripped,
|
|
// entry arrives percent-encoded).
|
|
Parsed parseProviderId(const QString &id);
|
|
|
|
// Parse a full image:// URL (IImageLoader::load path).
|
|
Parsed parseImageUrl(const QUrl &url);
|
|
|
|
} // namespace ImageUrl
|