]> Shamusworld >> Repos - virtualjaguar/commitdiff
Added some icons, reconnected settings, added start of GUI control over
authorShamus Hammons <jlhamm@acm.org>
Thu, 21 Jan 2010 04:20:21 +0000 (04:20 +0000)
committerShamus Hammons <jlhamm@acm.org>
Thu, 21 Jan 2010 04:20:21 +0000 (04:20 +0000)
some settings

12 files changed:
res/generic.png [new file with mode: 0644]
res/power.png [new file with mode: 0644]
res/zoom100.png [new file with mode: 0644]
res/zoom200.png [new file with mode: 0644]
res/zoom300.png [new file with mode: 0644]
src/gui/glwidget.cpp
src/gui/mainwin.cpp
src/gui/mainwin.h
src/gui/vj.pro
src/gui/vj.qrc
src/settings.cpp
src/settings.h

diff --git a/res/generic.png b/res/generic.png
new file mode 100644 (file)
index 0000000..2b9c7fd
Binary files /dev/null and b/res/generic.png differ
diff --git a/res/power.png b/res/power.png
new file mode 100644 (file)
index 0000000..903b60d
Binary files /dev/null and b/res/power.png differ
diff --git a/res/zoom100.png b/res/zoom100.png
new file mode 100644 (file)
index 0000000..1c34227
Binary files /dev/null and b/res/zoom100.png differ
diff --git a/res/zoom200.png b/res/zoom200.png
new file mode 100644 (file)
index 0000000..20821da
Binary files /dev/null and b/res/zoom200.png differ
diff --git a/res/zoom300.png b/res/zoom300.png
new file mode 100644 (file)
index 0000000..3567764
Binary files /dev/null and b/res/zoom300.png differ
index 109c1c9b1ec235b2e6cc9098e391691f6dae972f..d4a65ec59568986c4555ad9cbe767bbbba9692ef 100644 (file)
@@ -53,10 +53,8 @@ void GLWidget::paintGL()
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
 
-       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (smoothGLOutput ? GL_LINEAR : GL_NEAREST));
-       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (smoothGLOutput ? GL_LINEAR : GL_NEAREST));
-//     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST /*GL_LINEAR*/);
-//     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST /*GL_LINEAR*/);
+       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (vjs.glFilter ? GL_LINEAR : GL_NEAREST));
+       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (vjs.glFilter ? GL_LINEAR : GL_NEAREST));
 //     glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, rasterWidth, rasterHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, buffer);
        glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, rasterWidth, rasterHeight, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, buffer);
 
index e083446b34ffbfeb67c0ed54eafc13a3f6bd1e46..deef6b4a7f5995cc91ed6014020c8f3090851729 100644 (file)
@@ -8,6 +8,7 @@
 // Who  When        What
 // ---  ----------  -------------------------------------------------------------
 // JLH  12/23/2009  Created this file
+// JLH  12/20/2010  Added settings, menus & toolbars
 //
 
 // FIXED:
 //#define DEBUGFOO                     // Various tool debugging...
 //#define DEBUGTP                              // Toolpalette debugging...
 
-//#include <QtGui>
 #include "mainwin.h"
 
+//#include <QtGui>
 //#include <QtOpenGL>
 #include "glwidget.h"
-//#include "editwindow.h"
-//#include "charwindow.h"
-//#include "ttedit.h"
+#include "settings.h"
 
-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
-       // better way.
+// 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
+// better way.
 
-       // It has a novel approach to plugging-in/using different video/audio/input
-       // methods, can we do something similar or should we just use the built-in
-       // QOpenGL?
+// It has a novel approach to plugging-in/using different video/audio/input
+// 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.
+// 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);
+MainWin::MainWin()
+{
        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);
+       // Create actions
+
+       quitAppAct = new QAction(tr("E&xit"), this);
+       quitAppAct->setShortcuts(QKeySequence::Quit);
+       quitAppAct->setStatusTip(tr("Quit Virtual Jaguar"));
+       connect(quitAppAct, SIGNAL(triggered()), this, SLOT(close()));
+
+       action = new QAction(QIcon(":/res/power.png"), tr("&Power"), this);
        action->setStatusTip(tr("Toggle running state"));
        action->setCheckable(true);
-       toolbar->addAction(action);
        connect(action, SIGNAL(triggered()), this, SLOT(ToggleRunState()));
+
+       zoomActs = new QActionGroup(this);
+
+       x1Act = new QAction(QIcon(":/res/zoom100.png"), tr("Zoom 100%"), zoomActs);
+       x1Act->setStatusTip(tr("Set window zoom to 100%"));
+       x1Act->setCheckable(true);
+//     connect(x1Act, SIGNAL(triggered()), this, SLOT(???()));
+
+       x2Act = new QAction(QIcon(":/res/zoom200.png"), tr("Zoom 200%"), zoomActs);
+       x2Act->setStatusTip(tr("Set window zoom to 200%"));
+       x2Act->setCheckable(true);
+//     connect(x2Act, SIGNAL(triggered()), this, SLOT(???()));
+
+       x3Act = new QAction(QIcon(":/res/zoom300.png"), tr("Zoom 300%"), zoomActs);
+       x3Act->setStatusTip(tr("Set window zoom to 300%"));
+       x3Act->setCheckable(true);
+//     connect(x3Act, SIGNAL(triggered()), this, SLOT(???()));
+
+       blurAct = new QAction(QIcon(":/res/generic.png"), tr("Blur"), this);
+       blurAct->setStatusTip(tr("Sets OpenGL rendering to GL_NEAREST"));
+       blurAct->setCheckable(true);
+       connect(blurAct, SIGNAL(triggered()), this, SLOT(ToggleBlur()));
+
+       // Create menus & toolbars
+
+       QMenu * fileMenu = menuBar()->addMenu(tr("&File"));
+       fileMenu->addAction(action);
+       fileMenu->addAction(quitAppAct);
+
+       QToolBar * toolbar = addToolBar(tr("Stuff"));
+       toolbar->addAction(action);
+       toolbar->addAction(x1Act);
+       toolbar->addAction(x2Act);
+       toolbar->addAction(x3Act);
+       toolbar->addAction(blurAct);
 #if 0
 //     createActions();
        newAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this);
@@ -110,13 +147,13 @@ MainWin::MainWin(): running(true)
        statusBar()->showMessage(tr("Ready"));
 
        ReadSettings();
-
-//     connect(textEdit->document(), SIGNAL(contentsChanged()),
-//                     this, SLOT(documentWasModified()));
-
-//     setCurrentFile("");
        setUnifiedTitleAndToolBarOnMac(true);
 
+       // Set toolbar button based on setting read in (sync the UI)...
+       blurAct->setChecked(vjs.glFilter);
+       x1Act->setChecked(true);
+       running = action->isChecked();
+
        // Set up timer based loop for animation...
        timer = new QTimer(this);
        connect(timer, SIGNAL(timeout()), this, SLOT(Timer()));
@@ -140,9 +177,9 @@ void MainWin::Timer(void)
 
        // Random hash & trash
        // We try to simulate an untuned tank circuit here... :-)
-       for(int x=0; x<videoWidget->rasterWidth; x++)
+       for(uint32_t x=0; x<videoWidget->rasterWidth; x++)
        {
-               for(int y=0; y<videoWidget->rasterHeight; y++)
+               for(uint32_t y=0; y<videoWidget->rasterHeight; y++)
                {
                        videoWidget->buffer[(y * videoWidget->textureWidth) + x] = (rand() & 0xFF) << 8 | (rand() & 0xFF) << 16 | (rand() & 0xFF) << 24;// | (rand() & 0xFF);//0x000000FF;
 //                     buffer[(y * textureWidth) + x] = x*y;
@@ -155,6 +192,32 @@ void MainWin::Timer(void)
 void MainWin::ToggleRunState(void)
 {
        running = !running;
+
+       if (!running)
+       {
+               for(uint32_t x=0; x<videoWidget->rasterWidth; x++)
+                       for(uint32_t y=0; y<videoWidget->rasterHeight; y++)
+                               videoWidget->buffer[(y * videoWidget->textureWidth) + x] = 0x00000000;
+
+               videoWidget->updateGL();
+       }
+}
+
+void MainWin::SetZoom100(void)
+{
+}
+
+void MainWin::SetZoom200(void)
+{
+}
+
+void MainWin::SetZoom300(void)
+{
+}
+
+void MainWin::ToggleBlur(void)
+{
+       vjs.glFilter = !vjs.glFilter;
 }
 
 void MainWin::ReadSettings(void)
@@ -164,11 +227,18 @@ void MainWin::ReadSettings(void)
        QSize size = settings.value("size", QSize(400, 400)).toSize();
        resize(size);
        move(pos);
-//videoWidget->updateGL();
-//     pos = settings.value("charWndPos", QPoint(0, 0)).toPoint();
-//     size = settings.value("charWndSize", QSize(200, 200)).toSize();
-//     ((TTEdit *)qApp)->charWnd->resize(size);
-//     ((TTEdit *)qApp)->charWnd->move(pos);
+
+       vjs.useJoystick      = settings.value("useJoystick", false).toBool();
+       vjs.joyport          = settings.value("joyport", 0).toInt();
+       vjs.hardwareTypeNTSC = settings.value("hardwareTypeNTSC", true).toBool();
+       vjs.frameSkip        = settings.value("frameSkip", 0).toInt();
+       vjs.useJaguarBIOS    = settings.value("useJaguarBIOS", false).toBool();
+       vjs.DSPEnabled       = settings.value("DSPEnabled", false).toBool();
+       vjs.usePipelinedDSP  = settings.value("usePipelinedDSP", false).toBool();
+       vjs.fullscreen       = settings.value("fullscreen", false).toBool();
+       vjs.useOpenGL        = settings.value("useOpenGL", true).toBool();
+       vjs.glFilter         = settings.value("glFilterType", 0).toInt();
+       vjs.renderType       = settings.value("renderType", 0).toInt();
 }
 
 void MainWin::WriteSettings(void)
@@ -176,7 +246,17 @@ void MainWin::WriteSettings(void)
        QSettings settings("Underground Software", "Virtual Jaguar");
        settings.setValue("pos", pos());
        settings.setValue("size", size());
-//     settings.setValue("charWndPos", ((TTEdit *)qApp)->charWnd->pos());
-//     settings.setValue("charWndSize", ((TTEdit *)qApp)->charWnd->size());
+
+       settings.setValue("useJoystick", vjs.useJoystick);
+       settings.setValue("joyport", vjs.joyport);
+       settings.setValue("hardwareTypeNTSC", vjs.hardwareTypeNTSC);
+       settings.setValue("frameSkip", vjs.frameSkip);
+       settings.setValue("useJaguarBIOS", vjs.useJaguarBIOS);
+       settings.setValue("DSPEnabled", vjs.DSPEnabled);
+       settings.setValue("usePipelinedDSP", vjs.usePipelinedDSP);
+       settings.setValue("fullscreen", vjs.fullscreen);
+       settings.setValue("useOpenGL", vjs.useOpenGL);
+       settings.setValue("glFilterType", vjs.glFilter);
+       settings.setValue("renderType", vjs.renderType);
 }
 
index 5f170dbdec2609dfbe8a74fadf5d82d2412f0177..781ac29fcd6ea6e2f43e724e23927374e0f1b882 100644 (file)
@@ -32,6 +32,10 @@ class MainWin: public QMainWindow
                void Open(void);
                void Timer(void);
                void ToggleRunState(void);
+               void SetZoom100(void);
+               void SetZoom200(void);
+               void SetZoom300(void);
+               void ToggleBlur(void);
 
        private:
                void ReadSettings(void);
@@ -43,7 +47,14 @@ class MainWin: public QMainWindow
                bool running;
 //             EditWindow * editWnd;
 //             CharWindow * charWnd;
+               QActionGroup * zoomActs;
+
                QAction * action;
+               QAction * quitAppAct;
+               QAction * x1Act;
+               QAction * x2Act;
+               QAction * x3Act;
+               QAction * blurAct;
 };
 
 #endif // __MAINWIN_H__
index a14781c4dd78ad8c2503a030abb1df05d4e5364f..106f79b0af2186a5aaebe008a03937ac6cbca117 100644 (file)
@@ -20,3 +20,5 @@ OBJECTS_DIR = ../../obj
 MOC_DIR = ../../obj
 RCC_DIR = ../../obj
 UI_DIR = ../../obj
+#Nope, don't do dookey
+#INCLUDES_DIR = ..
index 65b1eab15dc19ea68b32c1c0d0678eaaf19f5458..159f89017637c496258dc92b0bbaf5fa79261db6 100644 (file)
@@ -1,5 +1,10 @@
 <!DOCTYPE RCC><RCC version="1.0">
 <qresource>
        <file>../../res/vj.xpm</file>
+       <file>../../res/power.png</file>
+       <file>../../res/zoom100.png</file>
+       <file>../../res/zoom200.png</file>
+       <file>../../res/zoom300.png</file>
+       <file>../../res/generic.png</file>
 </qresource>
 </RCC>
index b273cf6b58d9d99b732cbf3b7f30e48b2af0ff74..0ddf07002d2663bb9db34e3f1f3da04d58bcc5ac 100644 (file)
@@ -19,9 +19,6 @@
 #include "sdlemu_config.h"
 #include "log.h"
 
-// Temporary vars...
-bool smoothGLOutput = false;
-
 using namespace std;
 
 // Global variables
index f998b8b6040118bea76dd082be691dfa746b1472..acc8c91e280b1f1c149c875e6329687a209cf4cf 100644 (file)
@@ -57,7 +57,4 @@ void SaveVJSettings(void);
 
 extern VJSettings vjs;
 
-// Temporary vars...
-extern bool smoothGLOutput;
-
 #endif // __SETTINGS_H__