Top100
Your Personal Movie List (C++17 CLI + library)
Loading...
Searching...
No Matches
Top100ListModel Class Reference
Inheritance diagram for Top100ListModel:
[legend]
Collaboration diagram for Top100ListModel:
[legend]

Public Types

enum  Roles {
  TitleRole = Qt::UserRole + 1 , YearRole , RankRole , PosterUrlRole ,
  PlotFullRole , ImdbIdRole , DirectorRole , ActorsRole ,
  GenresRole , RuntimeMinutesRole
}
 

Signals

void requestSelectRow (int row)
 
void postingFinished (const QString &service, int row, bool success)
 
void sortOrderChanged (int sortOrder)
 
void reloadCompleted ()
 

Public Member Functions

 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)
 

Properties

int sortOrder
 

Member Enumeration Documentation

◆ Roles

Model data roles available to views and QML.

Constructor & Destructor Documentation

◆ Top100ListModel()

Top100ListModel::Top100ListModel ( QObject *  parent = nullptr)
inlineexplicit

Construct and immediately load the current Top100 dataset.

Here is the call graph for this function:

Member Function Documentation

◆ 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.

Here is the call graph for this function:

◆ deleteByImdbId()

Q_INVOKABLE bool Top100ListModel::deleteByImdbId ( const QString &  imdbId)
inline

Delete a movie by imdbID; refreshes list.

Here is the call graph for this function:

◆ deleteByTitle()

Q_INVOKABLE bool Top100ListModel::deleteByTitle ( const QString &  title)
inline

Delete a movie by title (first match); refreshes list.

Here is the call graph for this function:

◆ 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.

Here is the caller graph for this function:

◆ 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.

Here is the call graph for this function:

◆ postingFinished

void Top100ListModel::postingFinished ( const QString &  service,
int  row,
bool  success 
)
signal

Emitted when an async post finishes.

Here is the caller graph for this function:

◆ postToBlueSky()

Q_INVOKABLE bool Top100ListModel::postToBlueSky ( int  row)
inline

Post the selected movie to BlueSky synchronously.

Here is the call graph for this function:

◆ postToBlueSkyAsync()

Q_INVOKABLE void Top100ListModel::postToBlueSkyAsync ( int  row)
inline

Post to BlueSky asynchronously; emits postingFinished when done.

Here is the call graph for this function:

◆ postToMastodon()

Q_INVOKABLE bool Top100ListModel::postToMastodon ( int  row)
inline

Post the selected movie to Mastodon synchronously.

Here is the call graph for this function:

◆ postToMastodonAsync()

Q_INVOKABLE void Top100ListModel::postToMastodonAsync ( int  row)
inline

Post to Mastodon asynchronously; emits postingFinished when done.

Here is the call graph for this function:

◆ recordPairwiseResult()

bool Top100ListModel::recordPairwiseResult ( int  leftRow,
int  rightRow,
int  winner 
)

Record a pairwise ranking result between two rows in the current model view.

Parameters
leftRowIndex of the left movie in the current model (0..rowCount-1)
rightRowIndex of the right movie in the current model
winnerWhich 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.

Here is the call graph for this function:

◆ reload()

Q_INVOKABLE void Top100ListModel::reload ( )
inline

Reload movies from config-specified data file. Emits model reset.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reloadCompleted

void Top100ListModel::reloadCompleted ( )
signal

Emitted after model reload finishes (for selection preservation).

Here is the caller graph for this function:

◆ requestSelectRow

void Top100ListModel::requestSelectRow ( int  row)
signal

Emitted after reload to request view re-select a row by index.

Here is the caller graph for this function:

◆ searchOmdb()

Q_INVOKABLE QVariantList Top100ListModel::searchOmdb ( const QString &  query)
inline

Search OMDb for a query and return a list of { title, year, imdbID } objects.

Here is the call graph for this function:

◆ setSortOrder()

Q_INVOKABLE void Top100ListModel::setSortOrder ( int  order)
inline

Set sort order (0..4) corresponding to SortOrder enum; triggers reload().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sortOrderChanged

void Top100ListModel::sortOrderChanged ( int  sortOrder)
signal

Emitted when sort order changes (value matches SortOrder enum).

Here is the caller graph for this function:

◆ updateFromOmdbByImdbId()

Q_INVOKABLE bool Top100ListModel::updateFromOmdbByImdbId ( const QString &  imdbId)
inline

Update an existing movie by IMDb ID from OMDb and refresh.

Here is the call graph for this function:

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