ORE Studio 0.0.4
Loading...
Searching...
No Matches
Signals | Public Member Functions | List of all members
ClientAccountModel Class Referencefinal

Model for displaying accounts fetched from the server via client. More...

#include <ClientAccountModel.hpp>

Inherits QAbstractTableModel.

Collaboration diagram for ClientAccountModel:
Collaboration graph

Signals

void dataLoaded ()
 Emitted when data has been successfully loaded.
 
void loadError (const QString &error_message)
 Emitted when an error occurs during data loading.
 

Public Member Functions

 ClientAccountModel (ClientManager *clientManager, QObject *parent=nullptr)
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
void refresh (bool replace=true)
 Refresh account data from server asynchronously.
 
bool canFetchMore (const QModelIndex &parent=QModelIndex()) const override
 Check if more data can be fetched from the server.
 
void fetchMore (const QModelIndex &parent=QModelIndex()) override
 Fetch the next page of data from the server.
 
const AccountWithLoginInfogetAccountWithLoginInfo (int row) const
 Get account with login info at the specified row.
 
const accounts::domain::accountgetAccount (int row) const
 Get account at the specified row (for backward compatibility).
 
std::vector< AccountWithLoginInfogetAccountsWithLoginInfo () const
 Get all accounts with their login info.
 
std::uint32_t page_size () const
 Get the page size used for pagination.
 
void set_page_size (std::uint32_t size)
 Set the page size for pagination.
 
std::uint32_t total_available_count () const
 Get the total number of records available on the server.
 

Detailed Description

Model for displaying accounts fetched from the server via client.

This model extends QAbstractTableModel and fetches account data asynchronously using the ores.comms client instead of direct database access.

Member Function Documentation

◆ refresh()

void refresh ( bool  replace = true)

Refresh account data from server asynchronously.

This method initiates an async request to fetch accounts. The model will emit dataChanged() when the fetch completes. When replace is true, existing data is cleared before loading. When false, new data is appended (for pagination).

Parameters
replaceIf true, replace existing data; if false, append.

◆ canFetchMore()

bool canFetchMore ( const QModelIndex &  parent = QModelIndex()) const
override

Check if more data can be fetched from the server.

Returns
true if there are more records available on the server

◆ fetchMore()

void fetchMore ( const QModelIndex &  parent = QModelIndex())
override

Fetch the next page of data from the server.

This is called automatically by Qt views when scrolling approaches the end of currently loaded data.

◆ getAccountWithLoginInfo()

const AccountWithLoginInfo * getAccountWithLoginInfo ( int  row) const

Get account with login info at the specified row.

Parameters
rowThe row index.
Returns
The account with login info, or nullptr if row is invalid.

◆ getAccount()

const accounts::domain::account * getAccount ( int  row) const

Get account at the specified row (for backward compatibility).

Parameters
rowThe row index.
Returns
The account object, or nullptr if row is invalid.

◆ getAccountsWithLoginInfo()

std::vector< AccountWithLoginInfo > getAccountsWithLoginInfo ( ) const

Get all accounts with their login info.

Returns
A vector containing all current accounts with login info.

◆ page_size()

std::uint32_t page_size ( ) const

Get the page size used for pagination.

Returns
The number of records fetched per page.

◆ set_page_size()

void set_page_size ( std::uint32_t  size)

Set the page size for pagination.

Parameters
sizeThe number of records to fetch per page (1-1000).

◆ total_available_count()

std::uint32_t total_available_count ( ) const

Get the total number of records available on the server.

Returns
Total available record count.