Initial add of empty Tas Editor window for Qt GUI.

This commit is contained in:
mjbudd77 2021-10-16 04:43:16 -04:00
parent 9c4b03c327
commit b7ad6cab38
5 changed files with 248 additions and 0 deletions

View File

@ -528,6 +528,7 @@ set(SRC_DRIVERS_SDL
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/avi/avi-utils.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/avi/avi-utils.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/avi/fileio.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/avi/fileio.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/avi/gwavi.cpp ${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/avi/gwavi.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drivers/Qt/TasEditor/TasEditorWindow.cpp
) )
set(SOURCES ${SRC_CORE} ${SRC_DRIVERS_COMMON} ${SRC_DRIVERS_SDL}) set(SOURCES ${SRC_CORE} ${SRC_DRIVERS_COMMON} ${SRC_DRIVERS_SDL})

View File

@ -98,6 +98,7 @@
#include "Qt/RamSearch.h" #include "Qt/RamSearch.h"
#include "Qt/keyscan.h" #include "Qt/keyscan.h"
#include "Qt/nes_shm.h" #include "Qt/nes_shm.h"
#include "Qt/TasEditor/TasEditorWindow.h"
consoleWin_t::consoleWin_t(QWidget *parent) consoleWin_t::consoleWin_t(QWidget *parent)
: QMainWindow( parent ) : QMainWindow( parent )
@ -1604,6 +1605,14 @@ void consoleWin_t::createMainMenu(void)
act->setStatusTip(tr("Open AVI RIFF Viewer Window")); act->setStatusTip(tr("Open AVI RIFF Viewer Window"));
connect(act, SIGNAL(triggered()), this, SLOT(openAviRiffViewer(void)) ); connect(act, SIGNAL(triggered()), this, SLOT(openAviRiffViewer(void)) );
toolsMenu->addAction(act);
// Tools -> TAS Editor
act = new QAction(tr("&TAS Editor ..."), this);
//act->setShortcut( QKeySequence(tr("Shift+F7")));
act->setStatusTip(tr("Open TAS Editor Window"));
connect(act, SIGNAL(triggered()), this, SLOT(openTasEditor(void)) );
toolsMenu->addAction(act); toolsMenu->addAction(act);
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
@ -2808,6 +2817,17 @@ void consoleWin_t::openAviRiffViewer(void)
win->show(); win->show();
} }
void consoleWin_t::openTasEditor(void)
{
TasEditorWindow *win;
//printf("Open TAS Editor Window\n");
win = new TasEditorWindow(this);
win->show();
}
void consoleWin_t::openMovieOptWin(void) void consoleWin_t::openMovieOptWin(void)
{ {
MovieOptionsDialog_t *win; MovieOptionsDialog_t *win;

View File

@ -329,6 +329,7 @@ class consoleWin_t : public QMainWindow
void aboutQt(void); void aboutQt(void);
void openOnlineDocs(void); void openOnlineDocs(void);
void openOfflineDocs(void); void openOfflineDocs(void);
void openTasEditor(void);
void openMsgLogWin(void); void openMsgLogWin(void);
void openInputConfWin(void); void openInputConfWin(void);
void openGameSndConfWin(void); void openGameSndConfWin(void);

View File

@ -0,0 +1,179 @@
/* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2021 mjbudd77
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
// TasEditorWindow.cpp
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <QHeaderView>
#include <QMessageBox>
#include "Qt/config.h"
#include "Qt/fceuWrapper.h"
#include "Qt/TasEditor/TasEditorWindow.h"
//----------------------------------------------------------------------------
TasEditorWindow::TasEditorWindow(QWidget *parent)
: QDialog(parent)
{
QVBoxLayout *mainLayout;
//QHBoxLayout *hbox;
QMenuBar *menuBar;
setWindowTitle("TAS Editor");
resize(512, 512);
mainLayout = new QVBoxLayout();
//mainLayout->addWidget(tree);
menuBar = buildMenuBar();
setLayout(mainLayout);
mainLayout->setMenuBar( menuBar );
}
//----------------------------------------------------------------------------
TasEditorWindow::~TasEditorWindow(void)
{
printf("Destroy Tas Editor Window\n");
}
//----------------------------------------------------------------------------
void TasEditorWindow::closeEvent(QCloseEvent *event)
{
printf("Tas Editor Close Window Event\n");
done(0);
deleteLater();
event->accept();
}
//----------------------------------------------------------------------------
void TasEditorWindow::closeWindow(void)
{
//printf("Close Window\n");
done(0);
deleteLater();
}
//----------------------------------------------------------------------------
QMenuBar *TasEditorWindow::buildMenuBar(void)
{
QMenu *fileMenu;
//QActionGroup *actGroup;
QAction *act;
int useNativeMenuBar=0;
QMenuBar *menuBar = new QMenuBar(this);
// This is needed for menu bar to show up on MacOS
g_config->getOption( "SDL.UseNativeMenuBar", &useNativeMenuBar );
menuBar->setNativeMenuBar( useNativeMenuBar ? true : false );
//-----------------------------------------------------------------------
// Menu Start
//-----------------------------------------------------------------------
// File
fileMenu = menuBar->addMenu(tr("&File"));
// File -> New
act = new QAction(tr("&New"), this);
act->setShortcut(QKeySequence(tr("Ctrl+N")));
act->setStatusTip(tr("Open New Project"));
//act->setIcon( style()->standardIcon( QStyle::SP_FileDialogStart ) );
//connect(act, SIGNAL(triggered()), this, SLOT(openAviFileDialog(void)) );
fileMenu->addAction(act);
// File -> Open
act = new QAction(tr("&Open"), this);
act->setShortcut(QKeySequence(tr("Ctrl+O")));
act->setStatusTip(tr("Open Project"));
//act->setIcon( style()->standardIcon( QStyle::SP_BrowserStop ) );
//connect(act, SIGNAL(triggered()), this, SLOT(closeFile(void)) );
fileMenu->addAction(act);
// File -> Save
act = new QAction(tr("&Save"), this);
act->setShortcut(QKeySequence(tr("Ctrl+S")));
act->setStatusTip(tr("Save Project"));
//act->setIcon( style()->standardIcon( QStyle::SP_BrowserStop ) );
//connect(act, SIGNAL(triggered()), this, SLOT(closeFile(void)) );
fileMenu->addAction(act);
// File -> Save As
act = new QAction(tr("Save &As"), this);
act->setShortcut(QKeySequence(tr("Ctrl+Shift+S")));
act->setStatusTip(tr("Save Project As"));
//act->setIcon( style()->standardIcon( QStyle::SP_BrowserStop ) );
//connect(act, SIGNAL(triggered()), this, SLOT(closeFile(void)) );
fileMenu->addAction(act);
// File -> Save Compact
act = new QAction(tr("Save &Compact"), this);
//act->setShortcut(QKeySequence(tr("Ctrl+Shift+S")));
act->setStatusTip(tr("Save Compact"));
//act->setIcon( style()->standardIcon( QStyle::SP_BrowserStop ) );
//connect(act, SIGNAL(triggered()), this, SLOT(closeFile(void)) );
fileMenu->addAction(act);
// File -> Recent
recentMenu = fileMenu->addMenu( tr("Recent") );
recentMenu->setEnabled(false); // TODO: setup recent projects menu
fileMenu->addSeparator();
// File -> Import Input
act = new QAction(tr("&Import Input"), this);
//act->setShortcut(QKeySequence(tr("Ctrl+Shift+S")));
act->setStatusTip(tr("Import Input"));
//act->setIcon( style()->standardIcon( QStyle::SP_BrowserStop ) );
//connect(act, SIGNAL(triggered()), this, SLOT(closeFile(void)) );
fileMenu->addAction(act);
// File -> Export to fm2
act = new QAction(tr("&Export to fm2"), this);
//act->setShortcut(QKeySequence(tr("Ctrl+Shift+S")));
act->setStatusTip(tr("Export to fm2"));
//act->setIcon( style()->standardIcon( QStyle::SP_BrowserStop ) );
//connect(act, SIGNAL(triggered()), this, SLOT(closeFile(void)) );
fileMenu->addAction(act);
fileMenu->addSeparator();
// File -> Quit
act = new QAction(tr("&Quit Window"), this);
act->setShortcut(QKeySequence::Close);
act->setStatusTip(tr("Close Window"));
act->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton));
connect(act, SIGNAL(triggered()), this, SLOT(closeWindow(void)) );
fileMenu->addAction(act);
return menuBar;
}
//----------------------------------------------------------------------------

View File

@ -0,0 +1,47 @@
// TasEditorWindow.h
//
#pragma once
#include <string>
#include <list>
#include <map>
#include <QWidget>
#include <QDialog>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QComboBox>
#include <QCheckBox>
#include <QPushButton>
#include <QLineEdit>
#include <QLabel>
#include <QFrame>
#include <QGroupBox>
#include <QTreeView>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QCloseEvent>
#include <QMenu>
#include <QMenuBar>
#include <QAction>
class TasEditorWindow : public QDialog
{
Q_OBJECT
public:
TasEditorWindow(QWidget *parent = 0);
~TasEditorWindow(void);
protected:
void closeEvent(QCloseEvent *event);
QMenuBar *buildMenuBar(void);
QMenu *recentMenu;
private:
public slots:
void closeWindow(void);
private slots:
};