Jellyfin Qt
QML Library for interacting with the Jellyfin multimedia server
|
An "interface" for a remote data source. More...
#include <loader.h>
Public Types | |
enum | Status { Uninitialised , Loading , Ready , Error } |
Public Slots | |
virtual void | reload () |
Overload this method to reimplement the fetching mechanism to populate the RemoteData with data from the server. | |
Signals | |
void | statusChanged (Jellyfin::ViewModel::LoaderBase::Status newStatus) |
void | apiClientChanged (ApiClient *newApiClient) |
void | errorStringChanged (QString newErrorString) |
void | autoReloadChanged (bool newAutoReload) |
void | dataChanged () |
void | ready () |
Convenience signal for status == RemoteData.Ready. | |
Public Member Functions | |
LoaderBase (QObject *parent=nullptr) | |
LoaderBase (ApiClient *apiClient, QObject *parent=nullptr) | |
Status | status () const |
QString | errorString () const |
virtual QObject * | data () const |
void | setApiClient (ApiClient *newApiClient) |
void | setExtraFields (const QStringList &extraFields) |
Protected Member Functions | |
virtual bool | canReload () const |
Subclasses should implement this to determine if they can load data from the server. | |
void | setStatus (Status newStatus) |
void | setError (QNetworkReply::NetworkError error) |
void | setErrorString (const QString &newErrorString) |
void | reloadIfNeeded () |
void | classBegin () override |
void | componentComplete () override |
bool | isQmlParsing () const |
void | emitDataChanged () |
Protected Attributes | |
ApiClient * | m_apiClient = nullptr |
Properties | |
ApiClient * | apiClient |
Jellyfin::ViewModel::LoaderBase::Status | status |
QString | errorString |
bool | autoReload |
QObject * | data |
An "interface" for a remote data source.
This class is basically a base class for JSON data that can be fetched from over the network. Subclasses should reimplement reload and call setStatus to update the QML part of the code appropiatly.
|
inlineexplicit |
|
inline |
|
signal |
|
signal |
|
protectedvirtual |
Subclasses should implement this to determine if they can load data from the server.
Usage cases include checking if the required properties, such as the item id are set.
Reimplemented in Jellyfin::ViewModel::ItemLoader, and Jellyfin::ViewModel::UserLoader.
|
inlineoverrideprotected |
|
inlineoverrideprotected |
|
inlinevirtual |
|
signal |
|
protected |
|
inline |
|
signal |
|
inlineprotected |
|
signal |
Convenience signal for status == RemoteData.Ready.
|
inlinevirtualslot |
Overload this method to reimplement the fetching mechanism to populate the RemoteData with data from the server.
The default implementation makes a GET request to getDataUrl() and parses the resulting JSON, which should be enough for most cases. Consider overriding getDataUrl() and canRelaod() if possible. Manual overrides need to make sure that they're calling setStatus(Status), setError(QNetworkReply::NetworkError) and setErrorString() to let the QML side know what this thing is up to.
Reimplemented in Jellyfin::ViewModel::Loader< T, R, P >, and Jellyfin::ViewModel::Loader< ViewModel::Item, DTO::BaseItemDto, Jellyfin::Loader::GetItemParams >.
|
inlineprotected |
void Jellyfin::ViewModel::LoaderBase::setApiClient | ( | ApiClient * | newApiClient | ) |
|
protected |
|
protected |
void Jellyfin::ViewModel::LoaderBase::setExtraFields | ( | const QStringList & | extraFields | ) |
|
protected |
|
inline |
|
signal |
|
protected |
|
write |
bool Jellyfin::ViewModel::LoaderBase::autoReload |
|
read |
|
read |
|
read |