RhythmGame 1.4.3
Loading...
Searching...
No Matches
Signals | Public Member Functions | List of all members
resource_managers::Tables Class Referencefinal

Manages the download and storage of tables from given URLs. More...

#include <Tables.h>

Inheritance diagram for resource_managers::Tables:
Inheritance graph
[legend]
Collaboration diagram for resource_managers::Tables:
Collaboration graph
[legend]

Signals

void contentsChanged ()
 
void externalReloadRequested ()
 

Public Member Functions

 Tables (QNetworkAccessManager *networkManager, const QDir &tableLocation, db::SqliteCppDb *db, QObject *parent=nullptr)
 
 ~Tables () override
 
auto rowCount (const QModelIndex &parent) const -> int override
 
auto data (const QModelIndex &index, int role) const -> QVariant override
 
Q_INVOKABLE void removeAt (int index)
 Removes the table at the specified index.
 
Q_INVOKABLE void add (const QUrl &url)
 Adds a new table from the specified URL.
 
Q_INVOKABLE void reload (int index)
 Reloads the table at the specified index.
 
Q_INVOKABLE bool reloadTable (const Table &table)
 
Q_INVOKABLE QVariant resolveTable (const Table &table) const
 
Q_INVOKABLE QVariant resolveLevel (const Table &table, const Level &level) const
 
Q_INVOKABLE void reorder (int from, int to)
 Reorders a table from one index to another.
 
Q_INVOKABLE QVariantList getList ()
 Retrieves a list of all tables as QVariantList.
 
void setExternalTables (QList< Table > tables)
 
Q_INVOKABLE QList< TableInfo > search (const QString &identifier)
 Searches for a chart across downloaded and externally managed tables.
 

Detailed Description

Manages the download and storage of tables from given URLs.

The Tables class handles downloading table data from specified URLs, storing it in a local cache file, and parsing the data for use in QML. It provides methods to add, remove, reload, and reorder tables, as well as search for entries by MD5 or sha256/<hash> identifier.

Constructor & Destructor Documentation

◆ Tables()

resource_managers::Tables::Tables ( QNetworkAccessManager *  networkManager,
const QDir &  tableLocation,
db::SqliteCppDb *  db,
QObject *  parent = nullptr 
)
explicit

◆ ~Tables()

resource_managers::Tables::~Tables ( )
override

Member Function Documentation

◆ add()

void resource_managers::Tables::add ( const QUrl &  url)

Adds a new table from the specified URL.

Parameters
urlThe URL of the table to add.
Note
If the URL is already present, the table will be reloaded and moved to the end of the list.

◆ contentsChanged

void resource_managers::Tables::contentsChanged ( )
signal

◆ data()

auto resource_managers::Tables::data ( const QModelIndex &  index,
int  role 
) const -> QVariant
override

◆ externalReloadRequested

void resource_managers::Tables::externalReloadRequested ( )
signal

◆ getList()

auto resource_managers::Tables::getList ( )

Retrieves a list of all tables as QVariantList.

Returns
A QVariantList containing all tables.
Note
The editable model excludes externally managed collections.

◆ reload()

void resource_managers::Tables::reload ( int  index)

Reloads the table at the specified index.

This will re-download and parse the table data from its URL.

Parameters
indexThe index of the table to reload.

◆ reloadTable()

auto resource_managers::Tables::reloadTable ( const Table &  table)

Reloads a collection through the provider that owns it.

◆ removeAt()

void resource_managers::Tables::removeAt ( int  index)

Removes the table at the specified index.

Parameters
indexThe index of the table to remove.

◆ reorder()

void resource_managers::Tables::reorder ( int  from,
int  to 
)

Reorders a table from one index to another.

Parameters
fromThe current index of the table.
toThe new index to move the table to.

◆ resolveLevel()

auto resource_managers::Tables::resolveLevel ( const Table &  table,
const Level &  level 
) const

◆ resolveTable()

auto resource_managers::Tables::resolveTable ( const Table &  table) const

Resolves a retained table or level against the current catalog.

◆ rowCount()

auto resource_managers::Tables::rowCount ( const QModelIndex &  parent) const -> int
override

◆ search()

auto resource_managers::Tables::search ( const QString &  identifier)

Searches for a chart across downloaded and externally managed tables.

Parameters
identifierA plain MD5 hash or a sha256/<hash> identifier, as returned for missing stages by Course::loadCharts(). Matching is case-insensitive.
Returns
A list of TableInfo objects containing information about the matching entries.

◆ setExternalTables()

void resource_managers::Tables::setExternalTables ( QList< Table >  tables)

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