all repos — mgba @ e17e4fd19003209ff9db1f0ac1394e463c7b4a47

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