ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
ClientCountryModel Class Referencefinal

Model for displaying countries fetched from the server. More...

#include <ClientCountryModel.hpp>

Inheritance diagram for ClientCountryModel:
Inheritance graph
Collaboration diagram for ClientCountryModel:
Collaboration graph

Public Types

enum  Column {
  Alpha2Code , Alpha3Code , Name , NumericCode ,
  OfficialName , Version , ModifiedBy , RecordedAt ,
  ColumnCount
}
 Enumeration of table columns for type-safe column access.
 

Public Member Functions

 ClientCountryModel (ClientManager *clientManager, ImageCache *imageCache, 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 country data from server asynchronously.
 
void load_page (std::uint32_t offset, std::uint32_t limit)
 Load a specific page of country data.
 
const refdata::domain::countrygetCountry (int row) const
 Get country at the specified row.
 
std::vector< refdata::domain::countrygetCountries () const
 Get all countries.
 
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.
 

Static Public Member Functions

static std::vector< column_style > const & columnStyles ()
 Returns a static vector of column styles (built once per process).
 
static QVector< int > defaultHiddenColumns ()
 Returns a static QVector of hidden column indices (built once per process).
 

Static Public Attributes

static constexpr std::size_t kColumnCount = std::size_t(ColumnCount)
 Column metadata: header text, style, visibility, and width.
 
static constexpr std::array< ColumnMetadata, kColumnCountkColumns
 
static const QSize kDefaultWindowSize = {900, 600}
 Default window size for the country list window.
 
static constexpr std::string_view kSettingsGroup = "CountryListWindow"
 Settings group name for persisting window and column state.
 

Additional Inherited Members

- Signals inherited from AbstractClientModel
void dataLoaded ()
 
void loadError (const QString &error_message, const QString &details={})
 

Detailed Description

Model for displaying countries fetched from the server.

This model extends QAbstractTableModel and fetches country data asynchronously using the ores.comms client.

Member Function Documentation

◆ refresh()

void refresh ( bool  replace = true)

Refresh country data from server asynchronously.

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

◆ load_page()

void load_page ( std::uint32_t  offset,
std::uint32_t  limit 
)

Load a specific page of country data.

Parameters
offsetNumber of records to skip
limitNumber of records to fetch

◆ getCountry()

const refdata::domain::country * getCountry ( int  row) const

Get country at the specified row.

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

◆ getCountries()

std::vector< refdata::domain::country > getCountries ( ) const

Get all countries.

Returns
A vector containing all current countries.

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

Member Data Documentation

◆ kColumnCount

constexpr std::size_t kColumnCount = std::size_t(ColumnCount)
staticconstexpr

Column metadata: header text, style, visibility, and width.

Order must match the Column enum.