Added a menu bar to the Qt code data logger window with basic file load/save and window close functionality.
This commit is contained in:
parent
c962e2bd43
commit
623c2151a7
|
@ -23,6 +23,9 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QMenuBar>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
#include "../../types.h"
|
#include "../../types.h"
|
||||||
#include "../../fceu.h"
|
#include "../../fceu.h"
|
||||||
|
@ -56,6 +59,10 @@ CodeDataLoggerDialog_t::CodeDataLoggerDialog_t(QWidget *parent)
|
||||||
QGridLayout *grid;
|
QGridLayout *grid;
|
||||||
QGroupBox *frame, *subframe;
|
QGroupBox *frame, *subframe;
|
||||||
QPushButton *btn;
|
QPushButton *btn;
|
||||||
|
QMenuBar *menuBar;
|
||||||
|
QMenu *fileMenu;
|
||||||
|
QAction *act;
|
||||||
|
int useNativeMenuBar;
|
||||||
|
|
||||||
updateTimer = new QTimer(this);
|
updateTimer = new QTimer(this);
|
||||||
|
|
||||||
|
@ -63,6 +70,57 @@ CodeDataLoggerDialog_t::CodeDataLoggerDialog_t(QWidget *parent)
|
||||||
|
|
||||||
setWindowTitle(tr("Code Data Logger"));
|
setWindowTitle(tr("Code Data Logger"));
|
||||||
|
|
||||||
|
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 -> Load
|
||||||
|
act = new QAction(tr("&Load"), this);
|
||||||
|
act->setShortcut(QKeySequence::Open);
|
||||||
|
act->setStatusTip(tr("Load From File"));
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(loadCdlFile(void)) );
|
||||||
|
|
||||||
|
fileMenu->addAction(act);
|
||||||
|
|
||||||
|
// File -> Save
|
||||||
|
act = new QAction(tr("&Save"), this);
|
||||||
|
act->setShortcut(QKeySequence::Save);
|
||||||
|
act->setStatusTip(tr("Save To File"));
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(saveCdlFile(void)) );
|
||||||
|
|
||||||
|
fileMenu->addAction(act);
|
||||||
|
|
||||||
|
// File -> Save As
|
||||||
|
act = new QAction(tr("Save &As"), this);
|
||||||
|
act->setShortcut(QKeySequence::SaveAs);
|
||||||
|
act->setStatusTip(tr("Save To File As"));
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(saveCdlFileAs(void)) );
|
||||||
|
|
||||||
|
fileMenu->addAction(act);
|
||||||
|
|
||||||
|
fileMenu->addSeparator();
|
||||||
|
|
||||||
|
// File -> Close
|
||||||
|
act = new QAction(tr("&Close"), this);
|
||||||
|
act->setShortcut(QKeySequence::Close);
|
||||||
|
act->setStatusTip(tr("Close Window"));
|
||||||
|
connect(act, SIGNAL(triggered()), this, SLOT(closeWindow(void)) );
|
||||||
|
|
||||||
|
fileMenu->addAction(act);
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
// Menu End
|
||||||
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
mainLayout = new QVBoxLayout();
|
mainLayout = new QVBoxLayout();
|
||||||
vbox1 = new QVBoxLayout();
|
vbox1 = new QVBoxLayout();
|
||||||
hbox = new QHBoxLayout();
|
hbox = new QHBoxLayout();
|
||||||
|
@ -70,6 +128,8 @@ CodeDataLoggerDialog_t::CodeDataLoggerDialog_t(QWidget *parent)
|
||||||
statLabel = new QLabel(tr(" Logger is Paused: Press Start to Run "));
|
statLabel = new QLabel(tr(" Logger is Paused: Press Start to Run "));
|
||||||
cdlFileLabel = new QLabel(tr("CDL File:"));
|
cdlFileLabel = new QLabel(tr("CDL File:"));
|
||||||
|
|
||||||
|
mainLayout->setMenuBar( menuBar );
|
||||||
|
|
||||||
vbox1->addLayout(grid);
|
vbox1->addLayout(grid);
|
||||||
vbox1->addLayout(hbox);
|
vbox1->addLayout(hbox);
|
||||||
vbox1->addWidget(cdlFileLabel);
|
vbox1->addWidget(cdlFileLabel);
|
||||||
|
@ -336,7 +396,7 @@ void CodeDataLoggerDialog_t::saveCdlFileAs(void)
|
||||||
int ret, useNativeFileDialogVal;
|
int ret, useNativeFileDialogVal;
|
||||||
QString filename;
|
QString filename;
|
||||||
const char *romFile;
|
const char *romFile;
|
||||||
QFileDialog dialog(this, tr("Save CDL To File"));
|
QFileDialog dialog(this, tr("Save CDL File As"));
|
||||||
|
|
||||||
dialog.setFileMode(QFileDialog::AnyFile);
|
dialog.setFileMode(QFileDialog::AnyFile);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue