diff --git a/fceux.pro b/fceux.pro index 615bf636..ab80964c 100644 --- a/fceux.pro +++ b/fceux.pro @@ -292,9 +292,11 @@ SOURCES += src/drivers/common/nes_ntsc.c HEADERS += src/drivers/Qt/GameApp.h HEADERS += src/drivers/Qt/GameViewer.h +HEADERS += src/drivers/Qt/GamePadConf.h SOURCES += src/drivers/Qt/main.cpp SOURCES += src/drivers/Qt/GameApp.cpp SOURCES += src/drivers/Qt/GameViewer.cpp +SOURCES += src/drivers/Qt/GamePadConf.cpp SOURCES += src/drivers/Qt/fceuWrapper.cpp SOURCES += src/drivers/Qt/config.cpp SOURCES += src/drivers/Qt/input.cpp diff --git a/src/drivers/Qt/GameApp.cpp b/src/drivers/Qt/GameApp.cpp index e2b40b9e..25d2e07a 100644 --- a/src/drivers/Qt/GameApp.cpp +++ b/src/drivers/Qt/GameApp.cpp @@ -3,6 +3,7 @@ #include #include "GameApp.h" +#include "GamePadConf.h" #include "fceuWrapper.h" #include "keyscan.h" @@ -54,9 +55,14 @@ void gameWin_t::keyReleaseEvent(QKeyEvent *event) void gameWin_t::createMainMenu(void) { + // This is needed for menu bar to show up on MacOS menuBar()->setNativeMenuBar(false); + + //----------------------------------------------------------------------- + // File fileMenu = menuBar()->addMenu(tr("&File")); + // File -> Open ROM openROM = new QAction(tr("&Open ROM"), this); openROM->setShortcuts(QKeySequence::Open); openROM->setStatusTip(tr("Open ROM File")); @@ -64,12 +70,37 @@ void gameWin_t::createMainMenu(void) fileMenu->addAction(openROM); + // File -> Close ROM + closeROM = new QAction(tr("&Close ROM"), this); + closeROM->setShortcut( QKeySequence(tr("Ctrl+C"))); + closeROM->setStatusTip(tr("Close Loaded ROM")); + connect(closeROM, SIGNAL(triggered()), this, SLOT(closeROMCB(void)) ); + + fileMenu->addAction(closeROM); + + fileMenu->addSeparator(); + + // File -> Quit quitAct = new QAction(tr("&Quit"), this); quitAct->setStatusTip(tr("Quit the Application")); connect(quitAct, SIGNAL(triggered()), qApp, SLOT(quit())); fileMenu->addAction(quitAct); + //----------------------------------------------------------------------- + // Options + optMenu = menuBar()->addMenu(tr("&Options")); + + // Options -> GamePad Config + gamePadConfig = new QAction(tr("&GamePad Config"), this); + //gamePadConfig->setShortcut( QKeySequence(tr("Ctrl+C"))); + gamePadConfig->setStatusTip(tr("GamePad Configure")); + connect(gamePadConfig, SIGNAL(triggered()), this, SLOT(openGamePadConfWin(void)) ); + + optMenu->addAction(gamePadConfig); + + //----------------------------------------------------------------------- + // Help helpMenu = menuBar()->addMenu(tr("&Help")); aboutAct = new QAction(tr("&About"), this); @@ -83,7 +114,7 @@ void gameWin_t::openROMFile(void) { int ret; QString filename; - QFileDialog dialog(this); + QFileDialog dialog(this, "Open ROM File"); dialog.setFileMode(QFileDialog::ExistingFile); @@ -126,6 +157,18 @@ void gameWin_t::openROMFile(void) return; } + +void gameWin_t::closeROMCB(void) +{ + CloseGame(); +} + +void gameWin_t::openGamePadConfWin(void) +{ + printf("Open GamePad Config Window\n"); + GamePadConfDialog_t gpConf(this); +} + void gameWin_t::aboutQPlot(void) { printf("About QPlot\n"); diff --git a/src/drivers/Qt/GameApp.h b/src/drivers/Qt/GameApp.h index 3ec3d6f9..5dafcfff 100644 --- a/src/drivers/Qt/GameApp.h +++ b/src/drivers/Qt/GameApp.h @@ -30,10 +30,13 @@ class gameWin_t : public QMainWindow // QMenu *fileMenu; + QMenu *optMenu; QMenu *helpMenu; QAction *openROM; + QAction *closeROM; QAction *quitAct; + QAction *gamePadConfig; QAction *aboutAct; QTimer *gameTimer; @@ -47,7 +50,9 @@ class gameWin_t : public QMainWindow private slots: void openROMFile(void); + void closeROMCB(void); void aboutQPlot(void); + void openGamePadConfWin(void); void runGameFrame(void); }; diff --git a/src/drivers/Qt/GamePadConf.cpp b/src/drivers/Qt/GamePadConf.cpp new file mode 100644 index 00000000..c056e137 --- /dev/null +++ b/src/drivers/Qt/GamePadConf.cpp @@ -0,0 +1,40 @@ +// GamePadConf.cpp +// +#include "GamePadConf.h" + +//---------------------------------------------------- +GamePadConfDialog_t::GamePadConfDialog_t(QWidget *parent) + : QDialog( parent ) +{ + QHBoxLayout *hbox1, *hbox2; + QCheckBox *efs_chkbox; + + hbox1 = new QHBoxLayout(); + + QLabel *label = new QLabel(tr("Port:")); + portSel = new QComboBox(); + hbox1->addWidget( label ); + hbox1->addWidget( portSel ); + + hbox2 = new QHBoxLayout(); + efs_chkbox = new QCheckBox("Enable Four Score"); + hbox2->addWidget( efs_chkbox ); + + QVBoxLayout *mainLayout = new QVBoxLayout(); + + mainLayout->addLayout( hbox1 ); + mainLayout->addWidget( efs_chkbox ); + //mainLayout->addLayout( hbox2 ); + + setLayout( mainLayout ); + + show(); + exec(); +} + +//---------------------------------------------------- +GamePadConfDialog_t::~GamePadConfDialog_t(void) +{ + +} +//---------------------------------------------------- diff --git a/src/drivers/Qt/GamePadConf.h b/src/drivers/Qt/GamePadConf.h new file mode 100644 index 00000000..62962b3d --- /dev/null +++ b/src/drivers/Qt/GamePadConf.h @@ -0,0 +1,28 @@ +// GamePadConf.h +// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +class GamePadConfDialog_t : public QDialog +{ + public: + GamePadConfDialog_t(QWidget *parent = 0); + ~GamePadConfDialog_t(void); + + protected: + QComboBox *portSel; + + + + private slots: + +};