Files
DrumMachine/drumpadfilesmodel.h

32 lines
873 B
C
Raw Normal View History

2020-04-25 20:53:49 +02:00
#pragma once
#include <array>
#include <QAbstractTableModel>
2022-12-27 21:19:21 +01:00
#include "drumpadpresets.h"
2020-04-25 20:53:49 +02:00
namespace drumpad_presets { struct Preset; struct File; }
2020-04-25 20:53:49 +02:00
2022-12-27 21:19:21 +01:00
class DrumPadFilesModel : public QAbstractTableModel
2020-04-25 20:53:49 +02:00
{
Q_OBJECT
public:
using QAbstractTableModel::QAbstractTableModel;
2022-12-27 21:19:21 +01:00
~DrumPadFilesModel() override;
2020-04-25 20:53:49 +02:00
2022-12-27 21:19:21 +01:00
const drumpad_presets::File &getFile(const QModelIndex &index) const;
const drumpad_presets::File &getFile(int row) const;
2020-04-25 20:53:49 +02:00
2022-12-27 21:19:21 +01:00
void setPreset(const drumpad_presets::Preset &preset);
2020-04-25 20:53:49 +02:00
int rowCount(const QModelIndex &parent) const override;
int columnCount(const QModelIndex &parent) const override;
QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
private:
2022-12-27 21:19:21 +01:00
std::optional<std::array<drumpad_presets::File, 24>> m_files;
2020-04-25 20:53:49 +02:00
};