From 2c98ddddf1eeb20fe90c3e9759ac77ec96dcbc97 Mon Sep 17 00:00:00 2001 From: Shamus Hammons Date: Tue, 19 Jan 2010 15:59:25 +0000 Subject: [PATCH] Beginnings of UI goodness... ;-) --- src/gui/mainwin.cpp | 21 ++++++++++++++++++++- src/gui/mainwin.h | 3 +++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/gui/mainwin.cpp b/src/gui/mainwin.cpp index dba74e7..e083446 100644 --- a/src/gui/mainwin.cpp +++ b/src/gui/mainwin.cpp @@ -31,7 +31,7 @@ //#include "charwindow.h" //#include "ttedit.h" -MainWin::MainWin() +MainWin::MainWin(): running(true) { // The way BSNES controls things is by setting a timer with a zero // timeout, sleeping if not emulating anything. Seems there has to be a @@ -41,12 +41,23 @@ MainWin::MainWin() // methods, can we do something similar or should we just use the built-in // QOpenGL? + // We're going to try to use the built-in OpenGL support and see how it goes. + // We'll make the VJ core modular so that it doesn't matter what GUI is in + // use, we can drop it in anywhere and use it as-is. + // ((TTEdit *)qApp)->charWnd = new CharWindow(this); videoWidget = new GLWidget(this); setCentralWidget(videoWidget); setWindowIcon(QIcon(":/res/vj.xpm")); setWindowTitle("Virtual Jaguar v2.0.0"); + QMenu * menu = menuBar()->addMenu(tr("&File")); + QToolBar * toolbar = addToolBar(tr("x1")); + /*QAction */ action = new QAction(tr("Toggle"), this); + action->setStatusTip(tr("Toggle running state")); + action->setCheckable(true); + toolbar->addAction(action); + connect(action, SIGNAL(triggered()), this, SLOT(ToggleRunState())); #if 0 // createActions(); newAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this); @@ -124,6 +135,9 @@ void MainWin::Open(void) void MainWin::Timer(void) { + if (!running) + return; + // Random hash & trash // We try to simulate an untuned tank circuit here... :-) for(int x=0; xrasterWidth; x++) @@ -138,6 +152,11 @@ void MainWin::Timer(void) videoWidget->updateGL(); } +void MainWin::ToggleRunState(void) +{ + running = !running; +} + void MainWin::ReadSettings(void) { QSettings settings("Underground Software", "Virtual Jaguar"); diff --git a/src/gui/mainwin.h b/src/gui/mainwin.h index 831b56b..5f170db 100644 --- a/src/gui/mainwin.h +++ b/src/gui/mainwin.h @@ -31,6 +31,7 @@ class MainWin: public QMainWindow private slots: void Open(void); void Timer(void); + void ToggleRunState(void); private: void ReadSettings(void); @@ -39,8 +40,10 @@ class MainWin: public QMainWindow // public: GLWidget * videoWidget; QTimer * timer; + bool running; // EditWindow * editWnd; // CharWindow * charWnd; + QAction * action; }; #endif // __MAINWIN_H__ -- 2.37.2