all repos — mgba @ 9dc49df0bca23925cfcc8193a1770463fd9916cf

mGBA Game Boy Advance Emulator

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

 1/* Copyright (c) 2013-2014 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_LOAD_SAVE_STATE
 7#define QGBA_LOAD_SAVE_STATE
 8
 9#include <QWidget>
10
11#include "ui_LoadSaveState.h"
12
13namespace QGBA {
14
15class GameController;
16class InputController;
17class SavestateButton;
18
19enum class LoadSave {
20	LOAD,
21	SAVE
22};
23
24class LoadSaveState : public QWidget {
25Q_OBJECT
26
27public:
28	const static int NUM_SLOTS = 9;
29
30	LoadSaveState(GameController* controller, QWidget* parent = nullptr);
31
32	void setInputController(InputController* controller);
33	void setMode(LoadSave mode);
34
35signals:
36	void closed();
37
38protected:
39	virtual bool eventFilter(QObject*, QEvent*) override;
40	virtual void closeEvent(QCloseEvent*) override;
41	virtual void showEvent(QShowEvent*) override;
42	virtual void paintEvent(QPaintEvent*) override;
43
44private:
45	void loadState(int slot);
46	void triggerState(int slot);
47
48	Ui::LoadSaveState m_ui;
49	GameController* m_controller;
50	InputController* m_inputController;
51	SavestateButton* m_slots[NUM_SLOTS];
52	LoadSave m_mode;
53
54	int m_currentFocus;
55	QPixmap m_currentImage;
56};
57
58}
59
60#endif