Adding GUI framework for cheat window.
This commit is contained in:
parent
3c2a93d7c4
commit
c76d70582a
|
@ -391,6 +391,7 @@ set(SRC_DRIVERS_SDL
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/PaletteConf.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/PaletteConf.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/GuiConf.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/GuiConf.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/LuaControl.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/LuaControl.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/CheatsConf.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleUtilities.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleUtilities.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleVideoConf.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleVideoConf.cpp
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleSoundConf.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ConsoleSoundConf.cpp
|
||||||
|
|
|
@ -0,0 +1,171 @@
|
||||||
|
// HotKeyConf.cpp
|
||||||
|
//
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include <SDL.h>
|
||||||
|
#include <QHeaderView>
|
||||||
|
|
||||||
|
#include "Qt/main.h"
|
||||||
|
#include "Qt/dface.h"
|
||||||
|
#include "Qt/input.h"
|
||||||
|
#include "Qt/config.h"
|
||||||
|
#include "Qt/keyscan.h"
|
||||||
|
#include "Qt/fceuWrapper.h"
|
||||||
|
#include "Qt/CheatsConf.h"
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
GuiCheatsDialog_t::GuiCheatsDialog_t(QWidget *parent)
|
||||||
|
: QDialog( parent )
|
||||||
|
{
|
||||||
|
QHBoxLayout *mainLayout, *hbox;
|
||||||
|
QVBoxLayout *vbox;
|
||||||
|
QTreeWidgetItem *item;
|
||||||
|
QLabel *lbl;
|
||||||
|
|
||||||
|
setWindowTitle("Cheat Search");
|
||||||
|
|
||||||
|
//resize( 512, 512 );
|
||||||
|
|
||||||
|
mainLayout = new QHBoxLayout();
|
||||||
|
|
||||||
|
actCheatFrame = new QGroupBox( tr("Active Cheats") );
|
||||||
|
|
||||||
|
vbox = new QVBoxLayout();
|
||||||
|
|
||||||
|
mainLayout->addWidget( actCheatFrame );
|
||||||
|
|
||||||
|
tree = new QTreeWidget();
|
||||||
|
|
||||||
|
tree->setColumnCount(2);
|
||||||
|
|
||||||
|
item = new QTreeWidgetItem();
|
||||||
|
item->setText( 0, QString::fromStdString( "Code" ) );
|
||||||
|
item->setText( 1, QString::fromStdString( "Name" ) );
|
||||||
|
item->setTextAlignment( 0, Qt::AlignLeft);
|
||||||
|
item->setTextAlignment( 1, Qt::AlignLeft);
|
||||||
|
|
||||||
|
tree->setHeaderItem( item );
|
||||||
|
|
||||||
|
tree->header()->setSectionResizeMode( QHeaderView::ResizeToContents );
|
||||||
|
|
||||||
|
//for (int i=0; i<HK_MAX; i++)
|
||||||
|
//{
|
||||||
|
// std::string optionName = prefix + getHotkeyString(i);
|
||||||
|
|
||||||
|
// g_config->getOption (optionName.c_str (), &keycode);
|
||||||
|
|
||||||
|
// item = new QTreeWidgetItem();
|
||||||
|
|
||||||
|
// item->setText( 0, QString::fromStdString( optionName ) );
|
||||||
|
// item->setText( 1, QString::fromStdString( SDL_GetKeyName (keycode) ) );
|
||||||
|
|
||||||
|
// item->setTextAlignment( 0, Qt::AlignLeft);
|
||||||
|
// item->setTextAlignment( 1, Qt::AlignCenter);
|
||||||
|
|
||||||
|
// tree->addTopLevelItem( item );
|
||||||
|
//}
|
||||||
|
//
|
||||||
|
|
||||||
|
vbox->addWidget( tree );
|
||||||
|
|
||||||
|
hbox = new QHBoxLayout();
|
||||||
|
|
||||||
|
lbl = new QLabel( tr("Name:") );
|
||||||
|
cheatNameEntry = new QLineEdit();
|
||||||
|
|
||||||
|
hbox->addWidget( lbl );
|
||||||
|
hbox->addWidget( cheatNameEntry );
|
||||||
|
|
||||||
|
vbox->addLayout( hbox );
|
||||||
|
|
||||||
|
hbox = new QHBoxLayout();
|
||||||
|
|
||||||
|
lbl = new QLabel( tr("Address:") );
|
||||||
|
cheatAddrEntry = new QLineEdit();
|
||||||
|
|
||||||
|
hbox->addWidget( lbl );
|
||||||
|
hbox->addWidget( cheatAddrEntry );
|
||||||
|
|
||||||
|
lbl = new QLabel( tr("Value:") );
|
||||||
|
cheatValEntry = new QLineEdit();
|
||||||
|
|
||||||
|
hbox->addWidget( lbl );
|
||||||
|
hbox->addWidget( cheatValEntry );
|
||||||
|
|
||||||
|
lbl = new QLabel( tr("Compare:") );
|
||||||
|
cheatCmpEntry = new QLineEdit();
|
||||||
|
|
||||||
|
hbox->addWidget( lbl );
|
||||||
|
hbox->addWidget( cheatCmpEntry );
|
||||||
|
|
||||||
|
vbox->addLayout( hbox );
|
||||||
|
|
||||||
|
hbox = new QHBoxLayout();
|
||||||
|
|
||||||
|
addCheatBtn = new QPushButton( tr("Add") );
|
||||||
|
delCheatBtn = new QPushButton( tr("Delete") );
|
||||||
|
modCheatBtn = new QPushButton( tr("Update") );
|
||||||
|
|
||||||
|
hbox->addWidget( addCheatBtn );
|
||||||
|
hbox->addWidget( delCheatBtn );
|
||||||
|
hbox->addWidget( modCheatBtn );
|
||||||
|
|
||||||
|
vbox->addLayout( hbox );
|
||||||
|
|
||||||
|
hbox = new QHBoxLayout();
|
||||||
|
|
||||||
|
importCheatFileBtn = new QPushButton( tr("Import") );
|
||||||
|
exportCheatFileBtn = new QPushButton( tr("Export") );
|
||||||
|
|
||||||
|
hbox->addWidget( importCheatFileBtn );
|
||||||
|
hbox->addWidget( exportCheatFileBtn );
|
||||||
|
|
||||||
|
vbox->addLayout( hbox );
|
||||||
|
|
||||||
|
actCheatFrame->setLayout( vbox );
|
||||||
|
|
||||||
|
cheatSearchFrame = new QGroupBox( tr("Cheat Search") );
|
||||||
|
cheatResultFrame = new QGroupBox( tr("Possibilities") );
|
||||||
|
|
||||||
|
hbox = new QHBoxLayout();
|
||||||
|
|
||||||
|
vbox = new QVBoxLayout();
|
||||||
|
|
||||||
|
hbox->addLayout( vbox );
|
||||||
|
hbox->addWidget( cheatResultFrame );
|
||||||
|
|
||||||
|
cheatSearchFrame->setLayout( hbox );
|
||||||
|
|
||||||
|
srchResetBtn = new QPushButton( tr("Reset") );
|
||||||
|
knownValBtn = new QPushButton( tr("Known Value:") );
|
||||||
|
|
||||||
|
vbox->addWidget( srchResetBtn );
|
||||||
|
vbox->addWidget( knownValBtn );
|
||||||
|
|
||||||
|
hbox = new QHBoxLayout();
|
||||||
|
vbox->addLayout( hbox );
|
||||||
|
|
||||||
|
lbl = new QLabel( tr("0x") );
|
||||||
|
knownValEntry = new QLineEdit();
|
||||||
|
hbox->addWidget( lbl );
|
||||||
|
hbox->addWidget( knownValEntry );
|
||||||
|
|
||||||
|
mainLayout->addWidget( cheatSearchFrame );
|
||||||
|
|
||||||
|
setLayout( mainLayout );
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
GuiCheatsDialog_t::~GuiCheatsDialog_t(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void GuiCheatsDialog_t::closeWindow(void)
|
||||||
|
{
|
||||||
|
//printf("Close Window\n");
|
||||||
|
done(0);
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
|
@ -0,0 +1,55 @@
|
||||||
|
// GamePadConf.h
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QComboBox>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QFrame>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QGroupBox>
|
||||||
|
#include <QTreeView>
|
||||||
|
#include <QTreeWidget>
|
||||||
|
|
||||||
|
#include "Qt/main.h"
|
||||||
|
|
||||||
|
class GuiCheatsDialog_t : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
GuiCheatsDialog_t(QWidget *parent = 0);
|
||||||
|
~GuiCheatsDialog_t(void);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
QGroupBox *actCheatFrame;
|
||||||
|
QGroupBox *cheatSearchFrame;
|
||||||
|
QGroupBox *cheatResultFrame;
|
||||||
|
QPushButton *addCheatBtn;
|
||||||
|
QPushButton *delCheatBtn;
|
||||||
|
QPushButton *modCheatBtn;
|
||||||
|
QPushButton *importCheatFileBtn;
|
||||||
|
QPushButton *exportCheatFileBtn;
|
||||||
|
QPushButton *srchResetBtn;
|
||||||
|
QPushButton *knownValBtn;
|
||||||
|
QTreeWidget *tree;
|
||||||
|
QLineEdit *cheatNameEntry;
|
||||||
|
QLineEdit *cheatAddrEntry;
|
||||||
|
QLineEdit *cheatValEntry;
|
||||||
|
QLineEdit *cheatCmpEntry;
|
||||||
|
QLineEdit *knownValEntry;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void closeWindow(void);
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
};
|
|
@ -23,6 +23,7 @@
|
||||||
#include "Qt/PaletteConf.h"
|
#include "Qt/PaletteConf.h"
|
||||||
#include "Qt/GuiConf.h"
|
#include "Qt/GuiConf.h"
|
||||||
#include "Qt/LuaControl.h"
|
#include "Qt/LuaControl.h"
|
||||||
|
#include "Qt/CheatsConf.h"
|
||||||
#include "Qt/ConsoleUtilities.h"
|
#include "Qt/ConsoleUtilities.h"
|
||||||
#include "Qt/ConsoleSoundConf.h"
|
#include "Qt/ConsoleSoundConf.h"
|
||||||
#include "Qt/ConsoleVideoConf.h"
|
#include "Qt/ConsoleVideoConf.h"
|
||||||
|
@ -471,6 +472,18 @@ void consoleWin_t::createMainMenu(void)
|
||||||
|
|
||||||
subMenu->addAction(fdsLoadBiosAct);
|
subMenu->addAction(fdsLoadBiosAct);
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// Tools
|
||||||
|
toolsMenu = menuBar()->addMenu(tr("Tools"));
|
||||||
|
|
||||||
|
// Tools -> Cheats
|
||||||
|
cheatsAct = new QAction(tr("Cheats..."), this);
|
||||||
|
//cheatsAct->setShortcut( QKeySequence(tr("Shift+F7")));
|
||||||
|
cheatsAct->setStatusTip(tr("Open Cheat Window"));
|
||||||
|
connect(cheatsAct, SIGNAL(triggered()), this, SLOT(openCheats(void)) );
|
||||||
|
|
||||||
|
toolsMenu->addAction(cheatsAct);
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
// Movie
|
// Movie
|
||||||
movieMenu = menuBar()->addMenu(tr("Movie"));
|
movieMenu = menuBar()->addMenu(tr("Movie"));
|
||||||
|
@ -981,6 +994,22 @@ void consoleWin_t::openGuiConfWin(void)
|
||||||
//printf("GUI Config Window Destroyed\n");
|
//printf("GUI Config Window Destroyed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void consoleWin_t::openCheats(void)
|
||||||
|
{
|
||||||
|
GuiCheatsDialog_t *cheatWin;
|
||||||
|
|
||||||
|
//printf("Open GUI Cheat Window\n");
|
||||||
|
|
||||||
|
cheatWin = new GuiCheatsDialog_t(this);
|
||||||
|
|
||||||
|
cheatWin->show();
|
||||||
|
cheatWin->exec();
|
||||||
|
|
||||||
|
delete cheatWin;
|
||||||
|
|
||||||
|
//printf("GUI Cheat Window Destroyed\n");
|
||||||
|
}
|
||||||
|
|
||||||
void consoleWin_t::toggleAutoResume(void)
|
void consoleWin_t::toggleAutoResume(void)
|
||||||
{
|
{
|
||||||
//printf("Auto Resume: %i\n", autoResume->isChecked() );
|
//printf("Auto Resume: %i\n", autoResume->isChecked() );
|
||||||
|
|
|
@ -52,6 +52,7 @@ class consoleWin_t : public QMainWindow
|
||||||
QMenu *fileMenu;
|
QMenu *fileMenu;
|
||||||
QMenu *optMenu;
|
QMenu *optMenu;
|
||||||
QMenu *emuMenu;
|
QMenu *emuMenu;
|
||||||
|
QMenu *toolsMenu;
|
||||||
QMenu *movieMenu;
|
QMenu *movieMenu;
|
||||||
QMenu *helpMenu;
|
QMenu *helpMenu;
|
||||||
|
|
||||||
|
@ -86,6 +87,7 @@ class consoleWin_t : public QMainWindow
|
||||||
QAction *fdsSwitchAct;
|
QAction *fdsSwitchAct;
|
||||||
QAction *fdsEjectAct;
|
QAction *fdsEjectAct;
|
||||||
QAction *fdsLoadBiosAct;
|
QAction *fdsLoadBiosAct;
|
||||||
|
QAction *cheatsAct;
|
||||||
QAction *openMovAct;
|
QAction *openMovAct;
|
||||||
QAction *stopMovAct;
|
QAction *stopMovAct;
|
||||||
QAction *recMovAct;
|
QAction *recMovAct;
|
||||||
|
@ -152,6 +154,7 @@ class consoleWin_t : public QMainWindow
|
||||||
void fdsSwitchDisk(void);
|
void fdsSwitchDisk(void);
|
||||||
void fdsEjectDisk(void);
|
void fdsEjectDisk(void);
|
||||||
void fdsLoadBiosFile(void);
|
void fdsLoadBiosFile(void);
|
||||||
|
void openCheats(void);
|
||||||
void openMovie(void);
|
void openMovie(void);
|
||||||
void stopMovie(void);
|
void stopMovie(void);
|
||||||
void recordMovie(void);
|
void recordMovie(void);
|
||||||
|
|
Loading…
Reference in New Issue