19#include <QAbstractListModel>
55 Q_PROPERTY(
int curBox MEMBER
curBox NOTIFY curBoxChanged)
58 void hasCheckedChanged();
59 void hasCheckedChangedCached();
93 virtual int rowCount(
const QModelIndex& parent)
const override;
94 virtual QVariant
data(
const QModelIndex& index,
int role)
const override;
95 virtual QHash<int, QByteArray>
roleNames()
const override;
96 bool setData(
const QModelIndex &index,
const QVariant &value,
97 int role = Qt::EditRole)
override;
102 void onMove(
int from,
int to);
128 Q_INVOKABLE
void dragReorder(
int fromIndex,
int toIndex,
bool group);
132 Q_INVOKABLE
void dragTransfer(
int fromIndex,
int toIndex,
bool group);
136 Q_INVOKABLE
void deleteMon(
int index,
bool group);
152 void switchBox(
int newBox,
bool force =
false);
The player's active party – a specialized PokemonStorageBox.
A single Pokemon record – the most property-rich object in the tree.
A party Pokemon: a PokemonBox plus the five pre-generated battle stats.
Holds contents of a single Pokemon storage box.
PokemonParty * getPartyMon(int index)
Typed party mon at index (for the details screen).
void checkStateDirty()
Mark the checked-state cache stale.
QVariant getPlaceHolderData(int role) const
The empty-slot placeholder row data.
virtual QVariant data(const QModelIndex &index, int role) const override
Row+role value.
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Edit a row (e.g. checkbox).
Storage * storage
The PC storage.
void dragReorder(int fromIndex, int toIndex, bool group)
Reorder within this box: move fromIndex (or the checked set) to toIndex.
BagItemRoles
Columns (mapped in roleNames()).
@ HpMaxRole
Computed max HP (hpStat).
@ HpRole
Current HP (for the storage-grid health bar).
@ StatusRole
Raw status byte (0 none; 1-7 sleep; 8 poison; 16 burn; 32 freeze; 64 paralyze).
PokemonStorageBox * getBox(int box) const
The box object for index box.
void checkedDelete()
Delete checked mons.
void onMove(int from, int to)
React to a move.
PokemonStorageModel(Router *router, Storage *storage, PlayerPokemon *party)
Router * router
For page hooks.
static constexpr const char * isCheckedKey
QML attached-property name for the per-row checkbox.
virtual int rowCount(const QModelIndex &parent) const override
Row count of the current box.
void deleteMon(int index, bool group)
Delete the mon at index, or – when group – the whole checked set (the per-cell hover/checked delete b...
void checkedMoveToBottom()
Move checked mons to the bottom.
PokemonStorageModel * otherModel
The paired sibling model (for transfers).
void onInsert()
React to an insert.
virtual QHash< int, QByteArray > roleNames() const override
Role -> QML name.
bool hasCheckedCached()
Cached form (backs the property).
QVector< PokemonBox * > getChecked()
The currently-checked mons.
void onReset()
React to a reset.
void checkedMoveDown()
Move checked mons down one.
void clearCheckedState()
Uncheck everything.
bool checkedStateDirty
Whether the checked-state cache needs refresh.
BoxSelect
Sentinel box index for the party.
PokemonBox * getBoxMon(int index)
Typed box mon at index (for the details screen).
void checkedTransfer()
Transfer checked mons to the paired box.
void pageClosing()
Hook for when the page closes.
void onRemove(int ind)
React to a removal.
void clearCheckedStateGone()
Clear checked state for removed rows.
void checkedToggleAll()
Toggle all checkboxes.
void switchBox(int newBox, bool force=false)
Show box newBox.
void checkedMoveUp()
Move checked mons up one.
bool hasChecked()
Are any rows checked (live)?
void onBeforeRelocate(PokemonBox *item)
Cleanup hook before a mon relocates away.
PlayerPokemon * party
The party.
PokemonStorageBox * getCurBox() const
The currently-shown box object.
void checkedMoveToTop()
Move checked mons to the top.
void dragTransfer(int fromIndex, int toIndex, bool group)
Move fromIndex (or the checked set) from this box into the paired pane's box, inserting at toIndex th...
Screen navigation for the UI – the QML StackView's controller.
The PC: the item storage box and all 12 Pokemon boxes.