all repos — mgba @ 475c7790c5ddd94127eaa0f4b6b569e7beae2f79

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;
19
20class BattleChipView : public QDialog {
21Q_OBJECT
22
23public:
24	BattleChipView(std::shared_ptr<CoreController> controller, QWidget* parent = nullptr);
25	~BattleChipView();
26
27public slots:
28	void setFlavor(int);
29	void insertChip(bool);
30	void reinsert();
31
32private slots:
33	void advanceFrameCounter();
34	void addChip();
35	void addChipId(int);
36	void removeChip();
37
38	void saveDeck();
39	void loadDeck();
40
41private:
42	static const int UNINSERTED_TIME = 10;
43
44	void loadChipNames(int);
45
46	Ui::BattleChipView m_ui;
47
48	QMap<int, int> m_chipIndexToId;
49	QMap<int, QString> m_chipIdToName;
50	std::shared_ptr<CoreController> m_controller;
51	int m_flavor;
52
53	int m_frameCounter = -1;
54	bool m_next = false;
55};
56
57}