|
enum | Roles {
TitleRole = Qt::UserRole + 1
, YearRole
, RankRole
, PosterUrlRole
,
PlotFullRole
, ImdbIdRole
, DirectorRole
, ActorsRole
,
GenresRole
, RuntimeMinutesRole
} |
|
|
| Top100ListModel (QObject *parent=nullptr) |
|
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
|
QVariant | data (const QModelIndex &index, int role) const override |
|
QHash< int, QByteArray > | roleNames () const override |
|
Q_INVOKABLE void | reload () |
|
int | sortOrder () const |
|
Q_INVOKABLE void | setSortOrder (int order) |
|
Q_INVOKABLE QVariantMap | get (int row) const |
|
Q_INVOKABLE bool | addMovieByImdbId (const QString &imdbId) |
|
Q_INVOKABLE bool | deleteByImdbId (const QString &imdbId) |
|
Q_INVOKABLE bool | deleteByTitle (const QString &title) |
|
Q_INVOKABLE QVariantList | searchOmdb (const QString &query) |
|
Q_INVOKABLE QVariantMap | omdbGetByIdMap (const QString &imdbId) const |
|
Q_INVOKABLE bool | updateFromOmdbByImdbId (const QString &imdbId) |
|
Q_INVOKABLE int | count () const |
| QML-friendly row count accessor.
|
|
Q_INVOKABLE bool | recordPairwiseResult (int leftRow, int rightRow, int winner) |
| Record a pairwise ranking result between two rows in the current model view.
|
|
Q_INVOKABLE bool | postToBlueSky (int row) |
|
Q_INVOKABLE bool | postToMastodon (int row) |
|
Q_INVOKABLE void | postToBlueSkyAsync (int row) |
|
Q_INVOKABLE void | postToMastodonAsync (int row) |
|
◆ Roles
Model data roles available to views and QML.
◆ Top100ListModel()
Top100ListModel::Top100ListModel |
( |
QObject * |
parent = nullptr | ) |
|
|
inlineexplicit |
Construct and immediately load the current Top100 dataset.
◆ addMovieByImdbId()
Q_INVOKABLE bool Top100ListModel::addMovieByImdbId |
( |
const QString & |
imdbId | ) |
|
|
inline |
Add a movie by imdbID using OMDb lookup; appends to end of list and refreshes.
◆ deleteByImdbId()
Q_INVOKABLE bool Top100ListModel::deleteByImdbId |
( |
const QString & |
imdbId | ) |
|
|
inline |
Delete a movie by imdbID; refreshes list.
◆ deleteByTitle()
Q_INVOKABLE bool Top100ListModel::deleteByTitle |
( |
const QString & |
title | ) |
|
|
inline |
Delete a movie by title (first match); refreshes list.
◆ get()
Q_INVOKABLE QVariantMap Top100ListModel::get |
( |
int |
row | ) |
const |
|
inline |
Convenience accessor for QML/details panes. Returns a QVariantMap with keys: title, year, rank, posterUrl, plotFull. Returns empty map for invalid row.
◆ omdbGetByIdMap()
Q_INVOKABLE QVariantMap Top100ListModel::omdbGetByIdMap |
( |
const QString & |
imdbId | ) |
const |
|
inline |
Fetch full OMDb details by IMDb ID and return a QVariantMap with keys: title, year, posterUrl, plotShort, plotFull. Returns empty map on error.
◆ postingFinished
void Top100ListModel::postingFinished |
( |
const QString & |
service, |
|
|
int |
row, |
|
|
bool |
success |
|
) |
| |
|
signal |
Emitted when an async post finishes.
◆ postToBlueSky()
Q_INVOKABLE bool Top100ListModel::postToBlueSky |
( |
int |
row | ) |
|
|
inline |
Post the selected movie to BlueSky synchronously.
◆ postToBlueSkyAsync()
Q_INVOKABLE void Top100ListModel::postToBlueSkyAsync |
( |
int |
row | ) |
|
|
inline |
Post to BlueSky asynchronously; emits postingFinished when done.
◆ postToMastodon()
Q_INVOKABLE bool Top100ListModel::postToMastodon |
( |
int |
row | ) |
|
|
inline |
Post the selected movie to Mastodon synchronously.
◆ postToMastodonAsync()
Q_INVOKABLE void Top100ListModel::postToMastodonAsync |
( |
int |
row | ) |
|
|
inline |
Post to Mastodon asynchronously; emits postingFinished when done.
◆ recordPairwiseResult()
bool Top100ListModel::recordPairwiseResult |
( |
int |
leftRow, |
|
|
int |
rightRow, |
|
|
int |
winner |
|
) |
| |
Record a pairwise ranking result between two rows in the current model view.
- Parameters
-
leftRow | Index of the left movie in the current model (0..rowCount-1) |
rightRow | Index of the right movie in the current model |
winner | Which movie won: 1 = left wins, 0 = right wins, -1 = pass (no change) |
- Returns
- true if the operation succeeded (or pass), false on invalid input or storage error
Applies an Elo-style update to userScore for the two movies, persists to disk, recomputes ranks, and reloads the model. When winner == -1, no scores are changed and the function returns true.
◆ reload()
Q_INVOKABLE void Top100ListModel::reload |
( |
| ) |
|
|
inline |
Reload movies from config-specified data file. Emits model reset.
◆ reloadCompleted
void Top100ListModel::reloadCompleted |
( |
| ) |
|
|
signal |
Emitted after model reload finishes (for selection preservation).
◆ requestSelectRow
void Top100ListModel::requestSelectRow |
( |
int |
row | ) |
|
|
signal |
Emitted after reload to request view re-select a row by index.
◆ searchOmdb()
Q_INVOKABLE QVariantList Top100ListModel::searchOmdb |
( |
const QString & |
query | ) |
|
|
inline |
Search OMDb for a query and return a list of { title, year, imdbID } objects.
◆ setSortOrder()
Q_INVOKABLE void Top100ListModel::setSortOrder |
( |
int |
order | ) |
|
|
inline |
Set sort order (0..4) corresponding to SortOrder enum; triggers reload().
◆ sortOrderChanged
void Top100ListModel::sortOrderChanged |
( |
int |
sortOrder | ) |
|
|
signal |
Emitted when sort order changes (value matches SortOrder enum).
◆ updateFromOmdbByImdbId()
Q_INVOKABLE bool Top100ListModel::updateFromOmdbByImdbId |
( |
const QString & |
imdbId | ) |
|
|
inline |
Update an existing movie by IMDb ID from OMDb and refresh.
The documentation for this class was generated from the following files: