]> Shamusworld >> Repos - virtualjaguar/commitdiff
Beginnings of UI goodness... ;-)
authorShamus Hammons <jlhamm@acm.org>
Tue, 19 Jan 2010 15:59:25 +0000 (15:59 +0000)
committerShamus Hammons <jlhamm@acm.org>
Tue, 19 Jan 2010 15:59:25 +0000 (15:59 +0000)
src/gui/mainwin.cpp
src/gui/mainwin.h

index dba74e7bad8f946a59ad2b17ff7df4f3a366763e..e083446b34ffbfeb67c0ed54eafc13a3f6bd1e46 100644 (file)
@@ -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; x<videoWidget->rasterWidth; 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");
index 831b56bed704f33b119bd8cc094899b9b71743d0..5f170dbdec2609dfbe8a74fadf5d82d2412f0177 100644 (file)
@@ -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__