Overte C++ Documentation
ExternalResource Class Reference

#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)
 

Detailed Description

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.

Member Function Documentation

◆ getBase()

QString ExternalResource::getBase ( Bucket  bucket)

Returns the base path for a bucket

Parameters
bucketBucket whose path to return

◆ Q_ENUM()

ExternalResource::Q_ENUM ( Bucket  )

Returns the location of a resource as a QUrl

Returns the location of the resource path in bucket bucket

Note
The resulting path will be sanitized by condensing multiple instances of '/' to one. This is done for easier usage with Amazon S3 and compatible systems.
It will also convert all paths into relative ones respect to the bucket.
Warning
This function should only be given paths with a domain name. If given a complete path, it will emit a warning into the log and return the unmodified path it was given.
Parameters
bucketThe bucket in which the resource is found
relative_pathThe path of the resource within the bucket
Returns
The resulting URL as a QUrl

◆ setBase()

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.

Parameters
bucketBucket whose path to set
urlBase URL for the bucket.
Returns
Whether the base was set.

The documentation for this class was generated from the following files: