QT gamepad window in work.
This commit is contained in:
parent
f1153bfc6b
commit
ee02883ac7
|
@ -292,9 +292,11 @@ SOURCES += src/drivers/common/nes_ntsc.c
|
||||||
|
|
||||||
HEADERS += src/drivers/Qt/GameApp.h
|
HEADERS += src/drivers/Qt/GameApp.h
|
||||||
HEADERS += src/drivers/Qt/GameViewer.h
|
HEADERS += src/drivers/Qt/GameViewer.h
|
||||||
|
HEADERS += src/drivers/Qt/GamePadConf.h
|
||||||
SOURCES += src/drivers/Qt/main.cpp
|
SOURCES += src/drivers/Qt/main.cpp
|
||||||
SOURCES += src/drivers/Qt/GameApp.cpp
|
SOURCES += src/drivers/Qt/GameApp.cpp
|
||||||
SOURCES += src/drivers/Qt/GameViewer.cpp
|
SOURCES += src/drivers/Qt/GameViewer.cpp
|
||||||
|
SOURCES += src/drivers/Qt/GamePadConf.cpp
|
||||||
SOURCES += src/drivers/Qt/fceuWrapper.cpp
|
SOURCES += src/drivers/Qt/fceuWrapper.cpp
|
||||||
SOURCES += src/drivers/Qt/config.cpp
|
SOURCES += src/drivers/Qt/config.cpp
|
||||||
SOURCES += src/drivers/Qt/input.cpp
|
SOURCES += src/drivers/Qt/input.cpp
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
#include "GameApp.h"
|
#include "GameApp.h"
|
||||||
|
#include "GamePadConf.h"
|
||||||
#include "fceuWrapper.h"
|
#include "fceuWrapper.h"
|
||||||
#include "keyscan.h"
|
#include "keyscan.h"
|
||||||
|
|
||||||
|
@ -54,9 +55,14 @@ void gameWin_t::keyReleaseEvent(QKeyEvent *event)
|
||||||
|
|
||||||
void gameWin_t::createMainMenu(void)
|
void gameWin_t::createMainMenu(void)
|
||||||
{
|
{
|
||||||
|
// This is needed for menu bar to show up on MacOS
|
||||||
menuBar()->setNativeMenuBar(false);
|
menuBar()->setNativeMenuBar(false);
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// File
|
||||||
fileMenu = menuBar()->addMenu(tr("&File"));
|
fileMenu = menuBar()->addMenu(tr("&File"));
|
||||||
|
|
||||||
|
// File -> Open ROM
|
||||||
openROM = new QAction(tr("&Open ROM"), this);
|
openROM = new QAction(tr("&Open ROM"), this);
|
||||||
openROM->setShortcuts(QKeySequence::Open);
|
openROM->setShortcuts(QKeySequence::Open);
|
||||||
openROM->setStatusTip(tr("Open ROM File"));
|
openROM->setStatusTip(tr("Open ROM File"));
|
||||||
|
@ -64,12 +70,37 @@ void gameWin_t::createMainMenu(void)
|
||||||
|
|
||||||
fileMenu->addAction(openROM);
|
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 = new QAction(tr("&Quit"), this);
|
||||||
quitAct->setStatusTip(tr("Quit the Application"));
|
quitAct->setStatusTip(tr("Quit the Application"));
|
||||||
connect(quitAct, SIGNAL(triggered()), qApp, SLOT(quit()));
|
connect(quitAct, SIGNAL(triggered()), qApp, SLOT(quit()));
|
||||||
|
|
||||||
fileMenu->addAction(quitAct);
|
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"));
|
helpMenu = menuBar()->addMenu(tr("&Help"));
|
||||||
|
|
||||||
aboutAct = new QAction(tr("&About"), this);
|
aboutAct = new QAction(tr("&About"), this);
|
||||||
|
@ -83,7 +114,7 @@ void gameWin_t::openROMFile(void)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
QString filename;
|
QString filename;
|
||||||
QFileDialog dialog(this);
|
QFileDialog dialog(this, "Open ROM File");
|
||||||
|
|
||||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||||
|
|
||||||
|
@ -126,6 +157,18 @@ void gameWin_t::openROMFile(void)
|
||||||
|
|
||||||
return;
|
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)
|
void gameWin_t::aboutQPlot(void)
|
||||||
{
|
{
|
||||||
printf("About QPlot\n");
|
printf("About QPlot\n");
|
||||||
|
|
|
@ -30,10 +30,13 @@ class gameWin_t : public QMainWindow
|
||||||
//
|
//
|
||||||
|
|
||||||
QMenu *fileMenu;
|
QMenu *fileMenu;
|
||||||
|
QMenu *optMenu;
|
||||||
QMenu *helpMenu;
|
QMenu *helpMenu;
|
||||||
|
|
||||||
QAction *openROM;
|
QAction *openROM;
|
||||||
|
QAction *closeROM;
|
||||||
QAction *quitAct;
|
QAction *quitAct;
|
||||||
|
QAction *gamePadConfig;
|
||||||
QAction *aboutAct;
|
QAction *aboutAct;
|
||||||
|
|
||||||
QTimer *gameTimer;
|
QTimer *gameTimer;
|
||||||
|
@ -47,7 +50,9 @@ class gameWin_t : public QMainWindow
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void openROMFile(void);
|
void openROMFile(void);
|
||||||
|
void closeROMCB(void);
|
||||||
void aboutQPlot(void);
|
void aboutQPlot(void);
|
||||||
|
void openGamePadConfWin(void);
|
||||||
void runGameFrame(void);
|
void runGameFrame(void);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -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)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
//----------------------------------------------------
|
|
@ -0,0 +1,28 @@
|
||||||
|
// GamePadConf.h
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
|
class GamePadConfDialog_t : public QDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GamePadConfDialog_t(QWidget *parent = 0);
|
||||||
|
~GamePadConfDialog_t(void);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QComboBox *portSel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
};
|
Loading…
Reference in New Issue