2017-07-02 20:55:56 +01:00
|
|
|
#ifndef QAPPLE_H
|
|
|
|
#define QAPPLE_H
|
|
|
|
|
|
|
|
|
2019-11-30 15:48:48 +00:00
|
|
|
#include <QMainWindow>
|
2017-07-09 16:49:11 +01:00
|
|
|
#include <QElapsedTimer>
|
2019-11-09 21:43:35 +00:00
|
|
|
#include <QAudio>
|
|
|
|
|
2017-10-10 14:26:40 +01:00
|
|
|
#include <memory>
|
2017-07-04 19:25:10 +01:00
|
|
|
|
2019-12-01 18:40:28 +00:00
|
|
|
#include "options.h"
|
|
|
|
|
2019-11-30 15:48:48 +00:00
|
|
|
|
|
|
|
class QMdiSubWindow;
|
2017-07-03 21:00:42 +01:00
|
|
|
class Emulator;
|
2019-11-30 15:48:48 +00:00
|
|
|
class Preferences;
|
2017-07-02 20:55:56 +01:00
|
|
|
|
2019-11-30 15:48:48 +00:00
|
|
|
namespace Ui {
|
|
|
|
class QApple;
|
|
|
|
}
|
|
|
|
|
2019-12-08 20:21:35 +00:00
|
|
|
class QLabel;
|
|
|
|
|
2019-11-30 15:48:48 +00:00
|
|
|
class QApple : public QMainWindow
|
2017-07-02 20:55:56 +01:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2019-11-24 19:30:34 +00:00
|
|
|
explicit QApple(QWidget *parent = nullptr);
|
2019-12-06 20:00:16 +00:00
|
|
|
~QApple();
|
2017-07-02 20:55:56 +01:00
|
|
|
|
2019-12-08 20:21:35 +00:00
|
|
|
void loadStateFile(const QString & stateFile);
|
|
|
|
|
2017-07-15 15:46:18 +01:00
|
|
|
signals:
|
|
|
|
void endEmulator();
|
|
|
|
|
2019-12-08 20:21:35 +00:00
|
|
|
public slots:
|
|
|
|
void startEmulator();
|
|
|
|
|
2017-07-02 20:55:56 +01:00
|
|
|
protected:
|
2017-07-04 14:05:06 +01:00
|
|
|
virtual void closeEvent(QCloseEvent * event);
|
2017-07-02 20:55:56 +01:00
|
|
|
virtual void timerEvent(QTimerEvent *event);
|
|
|
|
|
|
|
|
private slots:
|
2018-02-13 20:02:17 +00:00
|
|
|
|
2017-07-02 20:55:56 +01:00
|
|
|
void on_actionStart_triggered();
|
|
|
|
|
|
|
|
void on_actionPause_triggered();
|
|
|
|
|
2017-07-04 12:14:04 +01:00
|
|
|
void on_actionX1_triggered();
|
|
|
|
|
|
|
|
void on_actionX2_triggered();
|
|
|
|
|
|
|
|
void on_action4_3_triggered();
|
|
|
|
|
2017-07-04 21:17:40 +01:00
|
|
|
void on_actionReboot_triggered();
|
|
|
|
|
2017-07-07 21:04:21 +01:00
|
|
|
void on_actionBenchmark_triggered();
|
|
|
|
|
2017-07-09 16:49:11 +01:00
|
|
|
void on_timer();
|
|
|
|
|
2017-07-15 15:46:18 +01:00
|
|
|
void on_actionMemory_triggered();
|
|
|
|
|
2017-09-19 20:47:15 +01:00
|
|
|
void on_actionOptions_triggered();
|
|
|
|
|
2017-10-15 18:20:25 +01:00
|
|
|
void on_actionSave_state_triggered();
|
|
|
|
|
|
|
|
void on_actionLoad_state_triggered();
|
|
|
|
|
2017-10-15 18:58:40 +01:00
|
|
|
void on_actionAbout_Qt_triggered();
|
|
|
|
|
|
|
|
void on_actionAbout_triggered();
|
|
|
|
|
2017-10-17 21:14:36 +01:00
|
|
|
void on_actionScreenshot_triggered();
|
|
|
|
|
2018-02-13 08:42:47 +00:00
|
|
|
void on_actionSwap_disks_triggered();
|
|
|
|
|
2019-11-09 21:43:35 +00:00
|
|
|
void on_stateChanged(QAudio::State state);
|
|
|
|
|
2019-11-13 21:01:28 +00:00
|
|
|
void on_actionLoad_state_from_triggered();
|
|
|
|
|
2019-11-24 21:06:55 +00:00
|
|
|
void on_actionNext_video_mode_triggered();
|
|
|
|
|
2017-07-02 20:55:56 +01:00
|
|
|
private:
|
2017-07-04 14:05:06 +01:00
|
|
|
|
2018-02-13 20:02:17 +00:00
|
|
|
// helper class to pause the emulator and restart at the end of the block
|
|
|
|
class PauseEmulator
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PauseEmulator(QApple * qapple);
|
|
|
|
|
|
|
|
~PauseEmulator();
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool myWasRunning;
|
|
|
|
QApple * myQApple;
|
|
|
|
};
|
|
|
|
|
2017-07-07 21:04:21 +01:00
|
|
|
void stopTimer();
|
2018-02-09 21:15:38 +00:00
|
|
|
void restartTimeCounters();
|
2019-11-24 19:30:34 +00:00
|
|
|
void reloadOptions();
|
2017-07-04 14:05:06 +01:00
|
|
|
|
2017-09-21 20:31:52 +01:00
|
|
|
int myTimerID;
|
2019-11-30 15:48:48 +00:00
|
|
|
Preferences * myPreferences;
|
2017-09-21 20:31:52 +01:00
|
|
|
|
2019-12-08 20:21:35 +00:00
|
|
|
QLabel * mySaveStateLabel;
|
|
|
|
|
2017-07-09 16:49:11 +01:00
|
|
|
QElapsedTimer myElapsedTimer;
|
2017-07-04 12:14:04 +01:00
|
|
|
QMdiSubWindow * myEmulatorWindow;
|
2017-07-03 21:00:42 +01:00
|
|
|
Emulator * myEmulator;
|
2018-02-09 21:15:38 +00:00
|
|
|
qint64 myCpuTimeReference;
|
2017-07-02 20:55:56 +01:00
|
|
|
|
2019-12-01 18:40:28 +00:00
|
|
|
GlobalOptions myOptions;
|
2019-11-30 15:48:48 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Ui::QApple *ui;
|
2017-07-02 20:55:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // QAPPLE_H
|