Making sure that all Tools windows have their geometry saved and recalled for Qt GUI.

This commit is contained in:
mjbudd77 2021-08-14 06:36:46 -04:00
parent 20d69ffa9f
commit 8b59b85be8
5 changed files with 30 additions and 4 deletions

View File

@ -456,6 +456,8 @@ GuiCheatsDialog_t::GuiCheatsDialog_t(QWidget *parent)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
GuiCheatsDialog_t::~GuiCheatsDialog_t(void) GuiCheatsDialog_t::~GuiCheatsDialog_t(void)
{ {
QSettings settings;
if (EmulationPaused && wasPausedByCheats) if (EmulationPaused && wasPausedByCheats)
{ {
EmulationPaused = 0; EmulationPaused = 0;
@ -463,6 +465,8 @@ GuiCheatsDialog_t::~GuiCheatsDialog_t(void)
} }
wasPausedByCheats = false; wasPausedByCheats = false;
settings.setValue("cheatsWindow/geometry", saveGeometry());
win = NULL; win = NULL;
//printf("Destroy Cheat Window Event\n"); //printf("Destroy Cheat Window Event\n");
} }

View File

@ -27,6 +27,7 @@
#include <SDL.h> #include <SDL.h>
#include <QHeaderView> #include <QHeaderView>
#include <QCloseEvent> #include <QCloseEvent>
#include <QSettings>
#include "Qt/main.h" #include "Qt/main.h"
#include "Qt/dface.h" #include "Qt/dface.h"
@ -46,6 +47,7 @@ FrameTimingDialog_t::FrameTimingDialog_t(QWidget *parent)
QTreeWidgetItem *item; QTreeWidgetItem *item;
QPushButton *resetBtn, *closeButton; QPushButton *resetBtn, *closeButton;
struct frameTimingStat_t stats; struct frameTimingStat_t stats;
QSettings settings;
getFrameTimingStats(&stats); getFrameTimingStats(&stats);
@ -165,17 +167,23 @@ FrameTimingDialog_t::FrameTimingDialog_t(QWidget *parent)
connect(updateTimer, &QTimer::timeout, this, &FrameTimingDialog_t::updatePeriodic); connect(updateTimer, &QTimer::timeout, this, &FrameTimingDialog_t::updatePeriodic);
updateTimer->start(200); // 5hz updateTimer->start(200); // 5hz
restoreGeometry(settings.value("frameTimingWindow/geometry").toByteArray());
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
FrameTimingDialog_t::~FrameTimingDialog_t(void) FrameTimingDialog_t::~FrameTimingDialog_t(void)
{ {
printf("Destroy Frame Timing Window\n"); QSettings settings;
//printf("Destroy Frame Timing Window\n");
updateTimer->stop(); updateTimer->stop();
settings.setValue("frameTimingWindow/geometry", saveGeometry());
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void FrameTimingDialog_t::closeEvent(QCloseEvent *event) void FrameTimingDialog_t::closeEvent(QCloseEvent *event)
{ {
printf("Frame Timing Close Window Event\n"); //printf("Frame Timing Close Window Event\n");
done(0); done(0);
deleteLater(); deleteLater();
event->accept(); event->accept();

View File

@ -185,12 +185,15 @@ PaletteEditorDialog_t::PaletteEditorDialog_t(QWidget *parent)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
PaletteEditorDialog_t::~PaletteEditorDialog_t(void) PaletteEditorDialog_t::~PaletteEditorDialog_t(void)
{ {
QSettings settings;
//printf("Destroy Palette Editor Config Window\n"); //printf("Destroy Palette Editor Config Window\n");
updateTimer->stop(); updateTimer->stop();
undoColorHistory.clear(); undoColorHistory.clear();
redoColorHistory.clear(); redoColorHistory.clear();
settings.setValue("paletteEditor/geometry", saveGeometry());
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void PaletteEditorDialog_t::closeEvent(QCloseEvent *event) void PaletteEditorDialog_t::closeEvent(QCloseEvent *event)

View File

@ -40,6 +40,7 @@
#include <QFileDialog> #include <QFileDialog>
#include <QValidator> #include <QValidator>
#include <QPainter> #include <QPainter>
#include <QSettings>
#include "../../types.h" #include "../../types.h"
#include "../../fceu.h" #include "../../fceu.h"
@ -210,6 +211,7 @@ RamSearchDialog_t::RamSearchDialog_t(QWidget *parent)
QMenu *fileMenu; QMenu *fileMenu;
QAction *act; QAction *act;
int useNativeMenuBar; int useNativeMenuBar;
QSettings settings;
setWindowTitle("RAM Search"); setWindowTitle("RAM Search");
@ -483,12 +485,16 @@ RamSearchDialog_t::RamSearchDialog_t(QWidget *parent)
connect(updateTimer, &QTimer::timeout, this, &RamSearchDialog_t::periodicUpdate); connect(updateTimer, &QTimer::timeout, this, &RamSearchDialog_t::periodicUpdate);
updateTimer->start(8); // ~120hz updateTimer->start(8); // ~120hz
restoreGeometry(settings.value("ramSearchWindow/geometry").toByteArray());
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
RamSearchDialog_t::~RamSearchDialog_t(void) RamSearchDialog_t::~RamSearchDialog_t(void)
{ {
QSettings settings;
updateTimer->stop(); updateTimer->stop();
printf("Destroy RAM Search Window\n"); //printf("Destroy RAM Search Window\n");
ramSearchWin = NULL; ramSearchWin = NULL;
actvSrchList.clear(); actvSrchList.clear();
@ -499,6 +505,7 @@ RamSearchDialog_t::~RamSearchDialog_t(void)
{ {
memLoc[addr].hist.clear(); memLoc[addr].hist.clear();
} }
settings.setValue("ramSearchWindow/geometry", saveGeometry());
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void RamSearchDialog_t::closeEvent(QCloseEvent *event) void RamSearchDialog_t::closeEvent(QCloseEvent *event)

View File

@ -311,13 +311,17 @@ RamWatchDialog_t::RamWatchDialog_t(QWidget *parent)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
RamWatchDialog_t::~RamWatchDialog_t(void) RamWatchDialog_t::~RamWatchDialog_t(void)
{ {
QSettings settings;
updateTimer->stop(); updateTimer->stop();
if ( ramWatchMainWin == this ) if ( ramWatchMainWin == this )
{ {
ramWatchMainWin = NULL; ramWatchMainWin = NULL;
} }
printf("Destroy RAM Watch Config Window\n"); settings.setValue("ramWatch/geometry", saveGeometry());
//printf("Destroy RAM Watch Config Window\n");
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void RamWatchDialog_t::closeEvent(QCloseEvent *event) void RamWatchDialog_t::closeEvent(QCloseEvent *event)