]> Shamusworld >> Repos - virtualjaguar/commitdiff
Added auto-pause when going into/out of the file selector.
authorShamus Hammons <jlhamm@acm.org>
Wed, 20 Jul 2011 19:52:10 +0000 (19:52 +0000)
committerShamus Hammons <jlhamm@acm.org>
Wed, 20 Jul 2011 19:52:10 +0000 (19:52 +0000)
src/gui/filepicker.cpp
src/gui/filepicker.h
src/gui/mainwin.cpp
src/gui/mainwin.h

index a1694def2d6813cd19d915e07a235e4ae360e495..f6b546d931a4ea1c0bb0b224bfe8b846a934e5e5 100644 (file)
@@ -209,7 +209,10 @@ New sizes: 373x172 (label), 420x340 (cart)
 void FilePickerWindow::keyPressEvent(QKeyEvent * e)
 {
        if (e->key() == Qt::Key_Escape)
+       {
                hide();
+               emit(FilePickerHiding());
+       }
        else if (e->key() == Qt::Key_Return)
                LoadButtonPressed();
 }
index 8003aa8fc2b3d4690c95734e3f03afe9caad2af4..e2f379f62cd84929893600e4f8dd03056c3abc99 100644 (file)
@@ -31,6 +31,7 @@ class FilePickerWindow: public QWidget
 
        signals:
                void RequestLoad(QString);
+               void FilePickerHiding(void);
 
        protected:
                void keyPressEvent(QKeyEvent *);
index 07f82d90eb6af32e572216b7b4b546249ffcfabb..3cebc8ac1541904a707e847f91a01e71fe6cb934 100644 (file)
@@ -79,7 +79,8 @@
 // use, we can drop it in anywhere and use it as-is.
 
 MainWin::MainWin(): running(false), powerButtonOn(false), showUntunedTankCircuit(true),
-       cartridgeLoaded(false), CDActive(false)//, alpineLoadSuccessful(false)
+       cartridgeLoaded(false), CDActive(false),//, alpineLoadSuccessful(false),
+       pauseForFileSelector(false)
 {
        videoWidget = new GLWidget(this);
        setCentralWidget(videoWidget);
@@ -178,6 +179,7 @@ MainWin::MainWin(): running(false), powerButtonOn(false), showUntunedTankCircuit
 
        // Misc. connections...
        connect(filePickWin, SIGNAL(RequestLoad(QString)), this, SLOT(LoadSoftware(QString)));
+       connect(filePickWin, SIGNAL(FilePickerHiding()), this, SLOT(Unpause()));
 
        // Create menus & toolbars
 
@@ -534,12 +536,29 @@ void MainWin::ShowAboutWin(void)
 
 void MainWin::InsertCart(void)
 {
+       if (running)
+       {
+               ToggleRunState();
+               pauseForFileSelector = true;
+       }
+
        filePickWin->show();
 }
 
+void MainWin::Unpause(void)
+{
+       // Here we unpause the emulator if it was paused when we went into the file selector
+       if (pauseForFileSelector)
+       {
+               pauseForFileSelector = false;
+               ToggleRunState();
+       }
+}
+
 void MainWin::LoadSoftware(QString file)
 {
-       running = false;                                                        //  Prevent bad things(TM) from happening...
+       running = false;                                                        // Prevent bad things(TM) from happening...
+       pauseForFileSelector = false;                           // Reset the file selector pause flag
        SET32(jaguarMainRAM, 0, 0x00200000);            // Set top of stack...
        cartridgeLoaded = (JaguarLoadFile(file.toAscii().data()) ? true : false);
 
index fa1e97626ac86f2f780b6de4116e10399302f420..e53515af86316729dd414cc448ac9ba2d1e30b7c 100644 (file)
@@ -43,6 +43,7 @@ class MainWin: public QMainWindow
                void ToggleBlur(void);
                void ShowAboutWin(void);
                void InsertCart(void);
+               void Unpause(void);
                void LoadSoftware(QString);
                void ToggleCDUsage(void);
 
@@ -65,6 +66,7 @@ class MainWin: public QMainWindow
                bool allowUnknownSoftware;
                bool CDActive;
 //             bool alpineLoadSuccessful;
+               bool pauseForFileSelector;
 
                QMenu * fileMenu;
                QMenu * helpMenu;