all repos — mgba @ cc214e0f44b51498bf2fc6db21909b1bbf12d733

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	void removeAt(const QModelIndex& index);
34
35	void beginAppendRow(const QModelIndex& index);
36	void endAppendRow();
37
38	void loadFile(const QString& path);
39	void saveFile(const QString& path);
40
41	void addSet(GBACheatSet* set);
42
43public slots:
44	void invalidated();
45
46private:
47	GBACheatDevice* m_device;
48};
49
50}
51
52#endif