all repos — mgba @ b45f30c58a321e980113c78415379bd335823c54

mGBA Game Boy Advance Emulator

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

 1/* Copyright (c) 2013-2019 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#pragma once
 7
 8#include <QDialog>
 9
10#include <memory>
11
12#include <mgba/core/interface.h>
13
14#include "ui_BattleChipView.h"
15
16namespace QGBA {
17
18class CoreController;
19class Window;
20
21class BattleChipView : public QDialog {
22Q_OBJECT
23
24public:
25	BattleChipView(std::shared_ptr<CoreController> controller, Window* window, QWidget* parent = nullptr);
26	~BattleChipView();
27
28public slots:
29	void setFlavor(int);
30	void insertChip(bool);
31	void reinsert();
32
33private slots:
34	void advanceFrameCounter();
35	void addChip();
36	void addChipId(int);
37	void removeChip();
38
39	void saveDeck();
40	void loadDeck();
41
42private:
43	static const int UNINSERTED_TIME = 10;
44
45	void loadChipNames(int);
46
47	Ui::BattleChipView m_ui;
48
49	QMap<int, int> m_chipIndexToId;
50	QMap<int, QString> m_chipIdToName;
51	std::shared_ptr<CoreController> m_controller;
52	int m_flavor;
53
54	int m_frameCounter = -1;
55	bool m_next = false;
56
57	Window* m_window;
58};
59
60}