|
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
|
The Pokedex grid model – seen/owned state, with cycling sort orders. More...
#include <pokedexmodel.h>
Public Types | |
| enum | PokemonStarterRoles { IndRole = Qt::UserRole + 1 , NameRole , StateRole } |
| Columns (mapped in roleNames()). More... | |
| enum | PokemonSortSelect { SortBegin , SortDex , SortName , SortInternal , SortEnd } |
| The available sort orders (cycled by dexSortCycle()). More... | |
Public Member Functions | |
| PokedexModel (PlayerPokedex *pokedex, Router *router) | |
| virtual int | rowCount (const QModelIndex &parent) const override |
| Row count. | |
| virtual QVariant | data (const QModelIndex &index, int role) const override |
| Row+role value. | |
| virtual QHash< int, QByteArray > | roleNames () const override |
| Role -> QML name. | |
| void | dataChanged (int ind) |
Notify that dex entry ind changed. | |
| void | dexSortCycle () |
| Advance to the next sort order. | |
| void | dexSort () |
| Apply the current sort. | |
| void | dexSortName () |
| Sort alphabetically. | |
| void | dexSortNum () |
| Sort by dex number. | |
| void | dexSortInternal () |
| Sort by internal id. | |
| void | pageClosing () |
| Hook for when the dex page closes. | |
| int | dexToListIndex (int ind) |
Row index for species ind under the current sort. | |
Public Attributes | |
| int | dexSortSelect = SortDex |
| QVector< PokedexEntryData * > | dexListCache |
| Cached, currently-sorted rows. | |
| PlayerPokedex * | pokedex = nullptr |
| The save's dex. | |
| Router * | router = nullptr |
| For page open/close hooks. | |
The Pokedex grid model – seen/owned state, with cycling sort orders.
Wraps the save's PlayerPokedex for the dex screen. Each row carries a tri-state StateRole (none/seen/owned). dexSortSelect cycles through dex/name/ internal order via dexSortCycle(). Holds the router to react to page open/ close. Exposed as brg.pokedexModel.
Definition at line 43 of file pokedexmodel.h.
The available sort orders (cycled by dexSortCycle()).
| Enumerator | |
|---|---|
| SortBegin | |
| SortDex | |
| SortName | |
| SortInternal | |
| SortEnd | |
Definition at line 61 of file pokedexmodel.h.
Columns (mapped in roleNames()).
| Enumerator | |
|---|---|
| IndRole | |
| NameRole | |
| StateRole | |
Definition at line 54 of file pokedexmodel.h.
| PokedexModel::PokedexModel | ( | PlayerPokedex * | pokedex, |
| Router * | router ) |
Definition at line 35 of file pokedexmodel.cpp.
References dataChanged(), PlayerPokedex::dexItemChanged(), dexListCache, dexSort(), PokemonDB::inst(), pageClosing(), pokedex, and router.
|
overridevirtual |
Row+role value.
Definition at line 72 of file pokedexmodel.cpp.
References dexListCache, PokemonDB::getIndAt(), IndRole, PokemonDB::inst(), NameRole, pokedex, pokemonDexCount, and StateRole.
| void PokedexModel::dataChanged | ( | int | ind | ) |
Notify that dex entry ind changed.
Definition at line 114 of file pokedexmodel.cpp.
References dexToListIndex().
Referenced by PokedexModel().
| void PokedexModel::dexSort | ( | ) |
Apply the current sort.
Definition at line 133 of file pokedexmodel.cpp.
References dexSortInternal(), dexSortName(), dexSortNum(), dexSortSelect, SortDex, SortInternal, and SortName.
Referenced by pageClosing(), and PokedexModel().
| void PokedexModel::dexSortCycle | ( | ) |
Advance to the next sort order.
Definition at line 124 of file pokedexmodel.cpp.
References dexSortSelect, SortBegin, and SortEnd.
| void PokedexModel::dexSortInternal | ( | ) |
Sort by internal id.
Definition at line 185 of file pokedexmodel.cpp.
References dexListCache.
Referenced by dexSort().
| void PokedexModel::dexSortName | ( | ) |
Sort alphabetically.
Definition at line 158 of file pokedexmodel.cpp.
References dexListCache.
Referenced by dexSort().
| void PokedexModel::dexSortNum | ( | ) |
Sort by dex number.
Definition at line 175 of file pokedexmodel.cpp.
References dexListCache.
Referenced by dexSort().
| int PokedexModel::dexToListIndex | ( | int | ind | ) |
Row index for species ind under the current sort.
Definition at line 204 of file pokedexmodel.cpp.
References dexListCache.
Referenced by dataChanged().
| void PokedexModel::pageClosing | ( | ) |
Hook for when the dex page closes.
Definition at line 195 of file pokedexmodel.cpp.
References dexSort(), dexSortSelect, and SortDex.
Referenced by PokedexModel().
|
overridevirtual |
Role -> QML name.
Definition at line 103 of file pokedexmodel.cpp.
|
overridevirtual |
| QVector<PokedexEntryData*> PokedexModel::dexListCache |
Cached, currently-sorted rows.
Definition at line 88 of file pokedexmodel.h.
Referenced by data(), dexSortInternal(), dexSortName(), dexSortNum(), dexToListIndex(), and PokedexModel().
| int PokedexModel::dexSortSelect = SortDex |
Definition at line 87 of file pokedexmodel.h.
Referenced by dexSort(), dexSortCycle(), and pageClosing().
| PlayerPokedex* PokedexModel::pokedex = nullptr |
The save's dex.
Definition at line 89 of file pokedexmodel.h.
Referenced by data(), and PokedexModel().
| Router* PokedexModel::router = nullptr |
For page open/close hooks.
Definition at line 90 of file pokedexmodel.h.
Referenced by PokedexModel().