all repos — mgba @ 297551a5be1858061a84e2482bfd3b83a39f94b0

mGBA Game Boy Advance Emulator

src/platform/qt/CheatsModel.h (view raw)

 1/* Copyright (c) 2013-2015 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef QGBA_CHEATS_MODEL
 7#define QGBA_CHEATS_MODEL
 8
 9#include <QAbstractItemModel>
10
11struct GBACheatDevice;
12struct GBACheatSet;
13
14namespace QGBA {
15
16class CheatsModel : public QAbstractItemModel {
17Q_OBJECT
18
19public:
20	CheatsModel(GBACheatDevice* m_device, QObject* parent = nullptr);
21
22	virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
23	virtual bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
24
25	virtual QModelIndex index(int row, int column, const QModelIndex& parent) const override;
26	virtual QModelIndex parent(const QModelIndex& index) const override;
27
28	virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override;
29	virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
30	virtual Qt::ItemFlags flags(const QModelIndex &index) const override;
31
32	GBACheatSet* itemAt(const QModelIndex& index);
33
34	void loadFile(const QString& path);
35	void addSet(GBACheatSet* set);
36
37private:
38	GBACheatDevice* m_device;
39};
40
41}
42
43#endif