2023-01-15 04:10:58 +00:00
|
|
|
#pragma once
|
|
|
|
#ifndef ENCOUNTERTABLEMODEL_H
|
|
|
|
#define ENCOUNTERTABLEMODEL_H
|
|
|
|
|
|
|
|
#include "wildmoninfo.h"
|
|
|
|
|
|
|
|
#include <QAbstractTableModel>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Editor;
|
|
|
|
|
|
|
|
class EncounterTableModel : public QAbstractTableModel {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
EncounterTableModel(WildMonInfo monInfo, EncounterFields allFields, int fieldIndex, 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) const override;
|
|
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
|
|
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum ColumnType {
|
|
|
|
Slot, Group, Species, MinLevel, MaxLevel, EncounterChance, SlotRatio, EncounterRate, Count
|
|
|
|
};
|
|
|
|
|
2024-08-21 21:52:43 +01:00
|
|
|
WildMonInfo encounterData() const { return this->monInfo; }
|
|
|
|
EncounterField encounterField() const { return this->encounterFields.at(this->fieldIndex); }
|
|
|
|
QList<double> percentages() const { return this->slotPercentages; }
|
2023-01-15 04:10:58 +00:00
|
|
|
void resize(int rows, int cols);
|
|
|
|
|
|
|
|
private:
|
|
|
|
WildMonInfo monInfo;
|
|
|
|
EncounterFields encounterFields;
|
|
|
|
int fieldIndex;
|
|
|
|
|
|
|
|
int numRows = 0;
|
|
|
|
int numCols = 0;
|
|
|
|
|
2023-01-15 04:17:23 +00:00
|
|
|
QVector<int> slotRatios;
|
2023-01-15 04:10:58 +00:00
|
|
|
QList<QString> groupNames;
|
|
|
|
QList<double> slotPercentages;
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void edited();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ENCOUNTERTABLEMODEL_H
|