1 /*  Copyright 2005 Guillaume Duhamel
2 	Copyright 2005-2006, 2013 Theo Berkau
3 	Copyright 2008 Filipe Azevedo <pasnox@gmail.com>
4 
5 	This file is part of Yabause.
6 
7 	Yabause is free software; you can redistribute it and/or modify
8 	it under the terms of the GNU General Public License as published by
9 	the Free Software Foundation; either version 2 of the License, or
10 	(at your option) any later version.
11 
12 	Yabause is distributed in the hope that it will be useful,
13 	but WITHOUT ANY WARRANTY; without even the implied warranty of
14 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 	GNU General Public License for more details.
16 
17 	You should have received a copy of the GNU General Public License
18 	along with Yabause; if not, write to the Free Software
19 	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
20 */
21 #ifndef YABAUSETHREAD_H
22 #define YABAUSETHREAD_H
23 
24 #include <QThread>
25 #include <QSize>
26 #include <QMutexLocker>
27 
28 #include "QtYabause.h"
29 
30 class YabauseThread : public QObject
31 {
32 	Q_OBJECT
33 
34 public:
35 	YabauseThread( QObject* owner = 0 );
36 	virtual ~YabauseThread();
37 
38 	yabauseinit_struct* yabauseConf();
39 	bool emulationRunning();
40 	bool emulationPaused();
init()41 	inline int init() const { return mInit; }
42 
43 protected:
44 	yabauseinit_struct mYabauseConf;
45 	bool showFPS;
46 	QMutex mMutex;
47 	bool mPause;
48 	int mTimerId;
49 	int mInit;
50 
51 	void initEmulation();
52 	void deInitEmulation();
53 	void resetYabauseConf();
54 	void timerEvent( QTimerEvent* );
55 
56 public slots:
57 	bool pauseEmulation( bool pause, bool reset );
58 	bool resetEmulation();
59 	void reloadControllers();
60 	void reloadClock();
61 	void reloadSettings();
62 
63 signals:
64 	void requestSize( const QSize& size );
65 	void requestFullscreen( bool fullscreen );
66 	void requestVolumeChange( int volume );
67 	void error( const QString& error, bool internal = true );
68 	void pause( bool paused );
69 	void reset();
70 	void toggleEmulateMouse( bool enable );
71 	void disableGL();
72 };
73 
74 #endif // YABAUSETHREAD_H
75