#include <ExternalResource.h>
Inherits QObject.
Public Member Functions | |
Q_ENUM (Bucket) QUrl getQUrl(Bucket bucket | |
QString | getBase (Bucket bucket) |
bool | setBase (Bucket bucket, const QString &url) |
Flexible management for external resources
With the death of the original High Fidelity and the transition of the project to a community-managed one, it became necessary to deal with that the various assets that used to be located under the highfidelity.com domain, and there won't be a fixed place for them afterwards. Data hosted by community members may not remain forever, reorganization may be necessary, people may want to run mirrors, and some might want to run without external Internet access at all.
This class makes it possible to deal with this in a more flexible manner: rather than hard-coding URLs all over the codebase, now it's possible to easily change where all those things are downloaded from.
The term 'bucket' refers to the buckets used on Amazon S3, but there's no requirement for S3 or anything similar to be used. The term should just be taken as referring to the name of a data set.
QString ExternalResource::getBase | ( | Bucket | bucket | ) |
Returns the base path for a bucket
bucket | Bucket whose path to return |
ExternalResource::Q_ENUM | ( | Bucket | ) |
Returns the location of a resource as a QUrl
Returns the location of the resource path
in bucket bucket
bucket | The bucket in which the resource is found |
relative_path | The path of the resource within the bucket |
bool ExternalResource::setBase | ( | Bucket | bucket, |
const QString & | url | ||
) |
Sets the base path for a bucket
The url
parameter will be validated, and the action will not be performed if the URL isn't a valid one, or if the bucket wasn't valid.
bucket | Bucket whose path to set |
url | Base URL for the bucket. |