Manages and provides access to the data displayed in the mod list.
More...
#include <modlistmodel.h>
|
| ModListModel (ModListProxyModel *proxy, QObject *parent=nullptr) |
| Constructor.
|
|
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
| Returns the horizontal header section names.
|
|
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
| Returns the number of rows to display.
|
|
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
| Returns the number of columns to display.
|
|
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
| Used to access the data stored in this model.
|
|
Qt::ItemFlags | flags (const QModelIndex &index) const override |
| Returns the flags for the given index. Adds editing flags for editable columns.
|
|
void | setModInfo (const std::vector< ModInfo > &mods) |
| Updates all data stored in this model with the given data.
|
|
const std::map< int, int > & | getGroupMap () const |
| Returns a map with mod ids as keys and the group they belong to as values.
|
|
const std::vector< ModInfo > & | getModInfo () const |
| Returns all mods stored in this model.
|
|
bool | isEditable () const |
| Returns true iff this models data is editable in a view.
|
|
void | setIsEditable (bool is_editable) |
| Enables or disables the ability to edit this models data in a view.
|
|
|
static constexpr int | action_col = 0 |
| Index of the action column.
|
|
static constexpr int | name_col = 1 |
| Index of the mod name column.
|
|
static constexpr int | version_col = 2 |
| Index of the mod version column.
|
|
static constexpr int | id_col = 3 |
| Index of the mod id column.
|
|
static constexpr int | time_col = 4 |
| Index of the installation time column.
|
|
static constexpr int | size_col = 5 |
| Index of the mod size column.
|
|
static constexpr int | deployers_col = 6 |
| Index of the deployers column.
|
|
static constexpr int | tags_col = 7 |
| Index of the tags column.
|
|
static constexpr int | version_list_role = 256 |
| Role representing the version of a mod.
|
|
static constexpr int | mod_id_role = 257 |
| Role representing the id of a mod.
|
|
static constexpr int | active_index_role = 258 |
| Role representing the active member of the group a mod belongs to.
|
|
static constexpr int | group_members_role = 259 |
| Role representing the members of the group a mod belongs to.
|
|
static constexpr int | mod_group_role = 260 |
| Role representing the id of the group a mod belongs to.
|
|
static constexpr int | mod_name_role = 263 |
| Role representing the name of a mod.
|
|
static constexpr int | deployer_ids_role = 265 |
| Role representing the ids of all deployers managing the given mod.
|
|
static constexpr int | sort_role = 266 |
| Role used for sorting data.
|
|
static constexpr int | icon_role = 267 |
| Role representing the icon of the current cell.
|
|
static constexpr int | statuses_role = 268 |
| Role representing a mods status for every deployer.
|
|
static constexpr int | manual_tags_role = 269 |
| Role representing the set of manual tags added to a mod.
|
|
static constexpr int | auto_tags_role = 270 |
| Role representing the set of auto tags added to a mod.
|
|
static constexpr int | local_source_role = 271 |
| Role representing the path to the local source archive or directory used for installation.
|
|
static constexpr int | remote_source_role = 272 |
| Role representing the URL from which the mod was downloaded.
|
|
static constexpr int | has_update_role = 273 |
| Role representing whether or not there is an update available for a mod.
|
|
static constexpr int | mod_size_role = 274 |
| Role representing the mod size on disk.
|
|
static constexpr int | mod_version_role = 275 |
| Role representing the version of a mod.
|
|
|
bool | modHasUpdate (int row) const |
| Checks if the mod at the given mod has an update.
|
|
|
ModListProxyModel * | proxy_model_ |
| The proxy model used to sort and filter this model.
|
|
std::vector< ModInfo > | active_mods_ |
| All mods which are either not part of a group or the groups active member.
|
|
std::vector< ModInfo > | mods_ |
| All mods.
|
|
std::map< int, int > | group_map_ |
| Maps mod ids to the group they belong to.
|
|
std::map< int, std::vector< int > > | groups_ |
| For every group: A vector of mod ids in that group.
|
|
std::map< int, QStringList > | group_versions_ |
| For every group: A QStringList of group version strings.
|
|
std::map< int, int > | active_group_members_ |
| Maps groups to their active members.
|
|
std::map< int, std::vector< bool > > | deployer_statuses_ |
| The mods activation status for every deployer it belongs to.
|
|
bool | is_editable_ = true |
| Stores whether the model can be edited in a view.
|
|
std::map< int, std::vector< std::string > > | manual_tag_map_ |
| Maps mod ids to a vector of manual tags associated with that mod.
|
|
std::map< int, std::vector< std::string > > | auto_tag_map_ |
| Maps mod ids to a vector of auto tags associated with that mod.
|
|
std::map< int, QString > | mod_size_strings_ |
| Maps mod ids to a string representing their size on disk.
|
|
Manages and provides access to the data displayed in the mod list.
◆ ModListModel()
Constructor.
- Parameters
-
proxy | The proxy model used to sort and filter data from this model. |
parent | The QTableView used to display the data in this mode. |
◆ columnCount()
int ModListModel::columnCount |
( |
const QModelIndex & | parent = QModelIndex() | ) |
const |
|
override |
Returns the number of columns to display.
- Parameters
-
- Returns
- The number of columns.
◆ data()
QVariant ModListModel::data |
( |
const QModelIndex & | index, |
|
|
int | role = Qt::DisplayRole ) const |
|
override |
Used to access the data stored in this model.
Returns data depending on the given role and index. Qt standard roles are used to provide data displayed in views. Custom roles defined in this file provide access to the raw data.
- Parameters
-
index | Hold row and column for which to return data. Column data is ignored. |
role | Describes type of data to return. |
- Returns
- The requested data.
◆ flags()
Qt::ItemFlags ModListModel::flags |
( |
const QModelIndex & | index | ) |
const |
|
override |
Returns the flags for the given index. Adds editing flags for editable columns.
- Parameters
-
- Returns
- The flags.
◆ getGroupMap()
const std::map< int, int > & ModListModel::getGroupMap |
( |
| ) |
const |
Returns a map with mod ids as keys and the group they belong to as values.
- Returns
- The map.
◆ getModInfo()
const std::vector< ModInfo > & ModListModel::getModInfo |
( |
| ) |
const |
Returns all mods stored in this model.
- Returns
- A vector of all mods.
◆ headerData()
QVariant ModListModel::headerData |
( |
int | section, |
|
|
Qt::Orientation | orientation, |
|
|
int | role = Qt::DisplayRole ) const |
|
override |
Returns the horizontal header section names.
- Parameters
-
section | Target section. |
orientation | Header orientation. |
role | Data role. |
- Returns
- Name of the section.
◆ modHasUpdate()
bool ModListModel::modHasUpdate |
( |
int | row | ) |
const |
|
private |
Checks if the mod at the given mod has an update.
- Parameters
-
- Returns
- True of the mod has an update.
◆ rowCount()
int ModListModel::rowCount |
( |
const QModelIndex & | parent = QModelIndex() | ) |
const |
|
override |
Returns the number of rows to display.
- Parameters
-
- Returns
- The number of rows.
◆ setIsEditable()
void ModListModel::setIsEditable |
( |
bool | is_editable | ) |
|
Enables or disables the ability to edit this models data in a view.
- Parameters
-
is_editable | Model data will be editable if this is true. |
◆ setModInfo()
void ModListModel::setModInfo |
( |
const std::vector< ModInfo > & | mods | ) |
|
Updates all data stored in this model with the given data.
- Parameters
-
mods | Data for all mods managed by this model. |
The documentation for this class was generated from the following files: