]> Shamusworld >> Repos - virtualjaguar/blobdiff - src/gui/mainwin.cpp
2.0.2 release.
[virtualjaguar] / src / gui / mainwin.cpp
index 37f9f242b2573061166b513d7f2a4fe7eb8291f6..3cf2ec5a6d1ff183b9eaeebc19cc64b12b32f8d6 100644 (file)
@@ -103,14 +103,24 @@ MainWin::MainWin(): running(true), powerButtonOn(false), showUntunedTankCircuit(
        quitAppAct->setStatusTip(tr("Quit Virtual Jaguar"));
        connect(quitAppAct, SIGNAL(triggered()), this, SLOT(close()));
 
-       powerAct = new QAction(QIcon(":/res/power.png"), tr("&Power"), this);
+       powerGreen.addFile(":/res/power-off.png", QSize(), QIcon::Normal, QIcon::Off);
+       powerGreen.addFile(":/res/power-on-green.png", QSize(), QIcon::Normal, QIcon::On);
+       powerRed.addFile(":/res/power-off.png", QSize(), QIcon::Normal, QIcon::Off);
+       powerRed.addFile(":/res/power-on-red.png", QSize(), QIcon::Normal, QIcon::On);
+
+//     powerAct = new QAction(QIcon(":/res/power.png"), tr("&Power"), this);
+       powerAct = new QAction(powerGreen, tr("&Power"), this);
        powerAct->setStatusTip(tr("Powers Jaguar on/off"));
        powerAct->setCheckable(true);
        powerAct->setChecked(false);
 //     powerAct->setDisabled(true);
        connect(powerAct, SIGNAL(triggered()), this, SLOT(TogglePowerState()));
 
-       pauseAct = new QAction(QIcon(":/res/pause.png"), tr("Pause"), this);
+       QIcon pauseIcon;
+       pauseIcon.addFile(":/res/pause-off", QSize(), QIcon::Normal, QIcon::Off);
+       pauseIcon.addFile(":/res/pause-on", QSize(), QIcon::Normal, QIcon::On);
+//     pauseAct = new QAction(QIcon(":/res/pause.png"), tr("Pause"), this);
+       pauseAct = new QAction(pauseIcon, tr("Pause"), this);
        pauseAct->setStatusTip(tr("Toggles the running state"));
        pauseAct->setCheckable(true);
        pauseAct->setDisabled(true);
@@ -175,6 +185,10 @@ MainWin::MainWin(): running(true), powerButtonOn(false), showUntunedTankCircuit(
        useCDAct->setCheckable(true);
        connect(useCDAct, SIGNAL(triggered()), this, SLOT(ToggleCDUsage()));
 
+       frameAdvanceAct = new QAction(QIcon(":/res/generic.png"), tr("&Frame Advance"), this);
+       frameAdvanceAct->setShortcut(QKeySequence(tr("F7")));
+       connect(frameAdvanceAct, SIGNAL(triggered()), this, SLOT(FrameAdvance()));
+
        // Misc. connections...
        connect(filePickWin, SIGNAL(RequestLoad(QString)), this, SLOT(LoadSoftware(QString)));
        connect(filePickWin, SIGNAL(FilePickerHiding()), this, SLOT(Unpause()));
@@ -184,6 +198,7 @@ MainWin::MainWin(): running(true), powerButtonOn(false), showUntunedTankCircuit(
        fileMenu = menuBar()->addMenu(tr("&Jaguar"));
        fileMenu->addAction(powerAct);
        fileMenu->addAction(pauseAct);
+       fileMenu->addAction(frameAdvanceAct);
        fileMenu->addAction(filePickAct);
        fileMenu->addAction(useCDAct);
        fileMenu->addAction(configAct);
@@ -221,6 +236,7 @@ MainWin::MainWin(): running(true), powerButtonOn(false), showUntunedTankCircuit(
 //     running = powerAct->isChecked();
        ntscAct->setChecked(vjs.hardwareTypeNTSC);
        palAct->setChecked(!vjs.hardwareTypeNTSC);
+       powerAct->setIcon(vjs.hardwareTypeNTSC ? powerRed : powerGreen);
 
        // Do this in case original size isn't correct (mostly for the first-run case)
        ResizeMainWindow();
@@ -528,6 +544,7 @@ void MainWin::SetZoom300(void)
 
 void MainWin::SetNTSC(void)
 {
+       powerAct->setIcon(powerRed);
        timer->setInterval(16);
        vjs.hardwareTypeNTSC = true;
        ResizeMainWindow();
@@ -535,6 +552,7 @@ void MainWin::SetNTSC(void)
 
 void MainWin::SetPAL(void)
 {
+       powerAct->setIcon(powerGreen);
        timer->setInterval(20);
        vjs.hardwareTypeNTSC = false;
        ResizeMainWindow();
@@ -574,7 +592,10 @@ void MainWin::Unpause(void)
        if (pauseForFileSelector)
        {
                pauseForFileSelector = false;
-               ToggleRunState();
+
+               // Some nutter might have unpaused while in the file selector, so check for that
+               if (!running)
+                       ToggleRunState();
        }
 }
 
@@ -627,6 +648,14 @@ void MainWin::ToggleCDUsage(void)
 #endif
 }
 
+void MainWin::FrameAdvance(void)
+{
+//printf("Frame Advance...\n");
+       // Execute 1 frame, then exit (only useful in Pause mode)
+       JaguarExecuteNew();
+       videoWidget->updateGL();
+}
+
 void MainWin::ResizeMainWindow(void)
 {
        videoWidget->setFixedSize(zoomLevel * 320, zoomLevel * (vjs.hardwareTypeNTSC ? 240 : 256));