From c21041e26e9341ff500725fcbea2a6fffc21b873 Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Sat, 3 Oct 2020 11:46:14 -0400 Subject: [PATCH] Setup initial menu options and window open for Qt GUI PPU Viewer. --- src/CMakeLists.txt | 1 + src/drivers/Qt/ConsoleWindow.cpp | 16 ++++++++ src/drivers/Qt/ConsoleWindow.h | 2 + src/drivers/Qt/ppuViewer.cpp | 63 ++++++++++++++++++++++++++++++++ src/drivers/Qt/ppuViewer.h | 43 ++++++++++++++++++++++ 5 files changed, 125 insertions(+) create mode 100644 src/drivers/Qt/ppuViewer.cpp create mode 100644 src/drivers/Qt/ppuViewer.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 41036c60..fcf5be14 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -441,6 +441,7 @@ set(SRC_DRIVERS_SDL ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/TraceLogger.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/AboutWindow.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/fceuWrapper.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/ppuViewer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/config.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/input.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/nes_shm.cpp diff --git a/src/drivers/Qt/ConsoleWindow.cpp b/src/drivers/Qt/ConsoleWindow.cpp index d4f7e723..490566c4 100644 --- a/src/drivers/Qt/ConsoleWindow.cpp +++ b/src/drivers/Qt/ConsoleWindow.cpp @@ -33,6 +33,7 @@ #include "Qt/ConsoleVideoConf.h" #include "Qt/AboutWindow.h" #include "Qt/fceuWrapper.h" +#include "Qt/ppuViewer.h" #include "Qt/keyscan.h" #include "Qt/nes_shm.h" @@ -501,6 +502,14 @@ void consoleWin_t::createMainMenu(void) debugMenu->addAction(hexEditAct); + // Debug -> PPU Viewer + ppuViewAct = new QAction(tr("PPU Viewer..."), this); + //ppuViewAct->setShortcut( QKeySequence(tr("Shift+F7"))); + ppuViewAct->setStatusTip(tr("Open PPU Viewer")); + connect(ppuViewAct, SIGNAL(triggered()), this, SLOT(openPPUViewer(void)) ); + + debugMenu->addAction(ppuViewAct); + // Debug -> Trace Logger traceLogAct = new QAction(tr("Trace Logger..."), this); //traceLogAct->setShortcut( QKeySequence(tr("Shift+F7"))); @@ -1021,6 +1030,13 @@ void consoleWin_t::openHexEditor(void) hexEditWin->show(); } +void consoleWin_t::openPPUViewer(void) +{ + //printf("Open GUI PPU Viewer Window\n"); + + openPPUViewWindow(this); +} + void consoleWin_t::openCodeDataLogger(void) { CodeDataLoggerDialog_t *cdlWin; diff --git a/src/drivers/Qt/ConsoleWindow.h b/src/drivers/Qt/ConsoleWindow.h index a8d74264..7699b3ed 100644 --- a/src/drivers/Qt/ConsoleWindow.h +++ b/src/drivers/Qt/ConsoleWindow.h @@ -93,6 +93,7 @@ class consoleWin_t : public QMainWindow QAction *codeDataLogAct; QAction *traceLogAct; QAction *hexEditAct; + QAction *ppuViewAct; QAction *openMovAct; QAction *stopMovAct; QAction *recMovAct; @@ -162,6 +163,7 @@ class consoleWin_t : public QMainWindow void fdsSwitchDisk(void); void fdsEjectDisk(void); void fdsLoadBiosFile(void); + void openPPUViewer(void); void openCheats(void); void openMovie(void); void stopMovie(void); diff --git a/src/drivers/Qt/ppuViewer.cpp b/src/drivers/Qt/ppuViewer.cpp new file mode 100644 index 00000000..b1e75bb6 --- /dev/null +++ b/src/drivers/Qt/ppuViewer.cpp @@ -0,0 +1,63 @@ +// ppuViewer.cpp +// +#include + +#include +#include +#include + +#include "Qt/ppuViewer.h" +#include "Qt/main.h" +#include "Qt/dface.h" +#include "Qt/input.h" +#include "Qt/config.h" +#include "Qt/fceuWrapper.h" + +static ppuViewerDialog_t *ppuViewWindow = NULL; +//---------------------------------------------------- +int openPPUViewWindow( QWidget *parent ) +{ + if ( ppuViewWindow != NULL ) + { + return -1; + } + ppuViewWindow = new ppuViewerDialog_t(parent); + + ppuViewWindow->show(); + + return 0; +} +//---------------------------------------------------- +ppuViewerDialog_t::ppuViewerDialog_t(QWidget *parent) + : QDialog( parent ) +{ + ppuViewWindow = this; + + setWindowTitle( tr("PPU Viewer") ); + + //setLayout( mainLayout ); +} + +//---------------------------------------------------- +ppuViewerDialog_t::~ppuViewerDialog_t(void) +{ + ppuViewWindow = NULL; + + printf("PPU Viewer Window Deleted\n"); +} +//---------------------------------------------------- +void ppuViewerDialog_t::closeEvent(QCloseEvent *event) +{ + printf("PPU Viewer Close Window Event\n"); + done(0); + deleteLater(); + event->accept(); +} +//---------------------------------------------------- +void ppuViewerDialog_t::closeWindow(void) +{ + printf("Close Window\n"); + done(0); + deleteLater(); +} +//---------------------------------------------------- diff --git a/src/drivers/Qt/ppuViewer.h b/src/drivers/Qt/ppuViewer.h new file mode 100644 index 00000000..f8734424 --- /dev/null +++ b/src/drivers/Qt/ppuViewer.h @@ -0,0 +1,43 @@ +// ppuViewer.h +// + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Qt/main.h" + +class ppuViewerDialog_t : public QDialog +{ + Q_OBJECT + + public: + ppuViewerDialog_t(QWidget *parent = 0); + ~ppuViewerDialog_t(void); + + protected: + //QTimer *inputTimer; + + void closeEvent(QCloseEvent *bar); + private: + + public slots: + void closeWindow(void); + private slots: + //void updatePeriodic(void); + +}; + +int openPPUViewWindow( QWidget *parent ); +