Added code to save/restore Qt window geometry for commonly used tools and debug windows.

This commit is contained in:
mjbudd77 2021-06-30 06:50:31 -04:00
parent d57cf3e35c
commit 7b1e171ba7
10 changed files with 121 additions and 30 deletions

View File

@ -29,6 +29,7 @@
#include <QFileDialog> #include <QFileDialog>
#include <QScreen> #include <QScreen>
#include <QGuiApplication> #include <QGuiApplication>
#include <QSettings>
#include "../../types.h" #include "../../types.h"
#include "../../fceu.h" #include "../../fceu.h"
@ -69,6 +70,7 @@ void updateCheatDialog(void)
GuiCheatsDialog_t::GuiCheatsDialog_t(QWidget *parent) GuiCheatsDialog_t::GuiCheatsDialog_t(QWidget *parent)
: QDialog(parent, Qt::Window) : QDialog(parent, Qt::Window)
{ {
QSettings settings;
QHBoxLayout *mainLayout, *hbox, *hbox1; QHBoxLayout *mainLayout, *hbox, *hbox1;
QVBoxLayout *vbox, *vbox1, *vbox2, *vbox3; QVBoxLayout *vbox, *vbox1, *vbox2, *vbox3;
QTreeWidgetItem *item; QTreeWidgetItem *item;
@ -448,6 +450,8 @@ GuiCheatsDialog_t::GuiCheatsDialog_t(QWidget *parent)
connect(exportCheatFileBtn, SIGNAL(clicked(void)), this, SLOT(saveCheatFile(void))); connect(exportCheatFileBtn, SIGNAL(clicked(void)), this, SLOT(saveCheatFile(void)));
showActiveCheatList(true); showActiveCheatList(true);
restoreGeometry(settings.value("cheatsWindow/geometry").toByteArray());
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
GuiCheatsDialog_t::~GuiCheatsDialog_t(void) GuiCheatsDialog_t::~GuiCheatsDialog_t(void)
@ -460,12 +464,14 @@ GuiCheatsDialog_t::~GuiCheatsDialog_t(void)
wasPausedByCheats = false; wasPausedByCheats = false;
win = NULL; win = NULL;
printf("Destroy Cheat Window Event\n"); //printf("Destroy Cheat Window Event\n");
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void GuiCheatsDialog_t::closeEvent(QCloseEvent *event) void GuiCheatsDialog_t::closeEvent(QCloseEvent *event)
{ {
printf("Cheat Close Window Event\n"); QSettings settings;
//printf("Cheat Close Window Event\n");
settings.setValue("cheatsWindow/geometry", saveGeometry());
done(0); done(0);
deleteLater(); deleteLater();
event->accept(); event->accept();
@ -473,7 +479,9 @@ void GuiCheatsDialog_t::closeEvent(QCloseEvent *event)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void GuiCheatsDialog_t::closeWindow(void) void GuiCheatsDialog_t::closeWindow(void)
{ {
QSettings settings;
//printf("Close Window\n"); //printf("Close Window\n");
settings.setValue("cheatsWindow/geometry", saveGeometry());
done(0); done(0);
deleteLater(); deleteLater();
} }

View File

@ -20,6 +20,7 @@
// CodeDataLogger.cpp // CodeDataLogger.cpp
// //
#include <QDir> #include <QDir>
#include <QSettings>
#include <QFileDialog> #include <QFileDialog>
#include <QInputDialog> #include <QInputDialog>
#include <QMessageBox> #include <QMessageBox>
@ -55,6 +56,7 @@ static int getDefaultCDLFile(char *filepath);
CodeDataLoggerDialog_t::CodeDataLoggerDialog_t(QWidget *parent) CodeDataLoggerDialog_t::CodeDataLoggerDialog_t(QWidget *parent)
: QDialog(parent, Qt::Window) : QDialog(parent, Qt::Window)
{ {
QSettings settings;
QVBoxLayout *mainLayout, *vbox1, *vbox; QVBoxLayout *mainLayout, *vbox1, *vbox;
QHBoxLayout *hbox; QHBoxLayout *hbox;
QGridLayout *grid; QGridLayout *grid;
@ -261,18 +263,22 @@ CodeDataLoggerDialog_t::CodeDataLoggerDialog_t(QWidget *parent)
getDefaultCDLFile(nameo); getDefaultCDLFile(nameo);
LoadCDLog(nameo); LoadCDLog(nameo);
} }
restoreGeometry(settings.value("cdLogger/geometry").toByteArray());
} }
//---------------------------------------------------- //----------------------------------------------------
CodeDataLoggerDialog_t::~CodeDataLoggerDialog_t(void) CodeDataLoggerDialog_t::~CodeDataLoggerDialog_t(void)
{ {
updateTimer->stop(); updateTimer->stop();
printf("Code Data Logger Window Deleted\n"); //printf("Code Data Logger Window Deleted\n");
} }
//---------------------------------------------------- //----------------------------------------------------
void CodeDataLoggerDialog_t::closeEvent(QCloseEvent *event) void CodeDataLoggerDialog_t::closeEvent(QCloseEvent *event)
{ {
printf("Code Data Logger Close Window Event\n"); QSettings settings;
//printf("Code Data Logger Close Window Event\n");
settings.setValue("cdLogger/geometry", saveGeometry());
done(0); done(0);
deleteLater(); deleteLater();
event->accept(); event->accept();
@ -280,7 +286,9 @@ void CodeDataLoggerDialog_t::closeEvent(QCloseEvent *event)
//---------------------------------------------------- //----------------------------------------------------
void CodeDataLoggerDialog_t::closeWindow(void) void CodeDataLoggerDialog_t::closeWindow(void)
{ {
printf("Code Data Logger Close Window\n"); QSettings settings;
//printf("Code Data Logger Close Window\n");
settings.setValue("cdLogger/geometry", saveGeometry());
done(0); done(0);
deleteLater(); deleteLater();
} }

View File

@ -39,6 +39,7 @@
#include <QAction> #include <QAction>
#include <QActionGroup> #include <QActionGroup>
#include <QGuiApplication> #include <QGuiApplication>
#include <QSettings>
#include "../../types.h" #include "../../types.h"
#include "../../fceu.h" #include "../../fceu.h"
@ -97,6 +98,7 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
QTreeWidgetItem * item; QTreeWidgetItem * item;
int opt, useNativeMenuBar; int opt, useNativeMenuBar;
fceuDecIntValidtor *validator; fceuDecIntValidtor *validator;
QSettings settings;
font.setFamily("Courier New"); font.setFamily("Courier New");
font.setStyle( QFont::StyleNormal ); font.setStyle( QFont::StyleNormal );
@ -687,13 +689,15 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
loadGameDebugBreakpoints(); loadGameDebugBreakpoints();
} }
} }
restoreGeometry(settings.value("debugger/geometry").toByteArray());
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
ConsoleDebugger::~ConsoleDebugger(void) ConsoleDebugger::~ConsoleDebugger(void)
{ {
std::list <ConsoleDebugger*>::iterator it; std::list <ConsoleDebugger*>::iterator it;
printf("Destroy Debugger Window\n"); //printf("Destroy Debugger Window\n");
periodicTimer->stop(); periodicTimer->stop();
for (it = dbgWinList.begin(); it != dbgWinList.end(); it++) for (it = dbgWinList.begin(); it != dbgWinList.end(); it++)
@ -701,7 +705,7 @@ ConsoleDebugger::~ConsoleDebugger(void)
if ( (*it) == this ) if ( (*it) == this )
{ {
dbgWinList.erase(it); dbgWinList.erase(it);
printf("Removing Debugger Window\n"); //printf("Removing Debugger Window\n");
break; break;
} }
} }
@ -715,16 +719,20 @@ ConsoleDebugger::~ConsoleDebugger(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void ConsoleDebugger::closeEvent(QCloseEvent *event) void ConsoleDebugger::closeEvent(QCloseEvent *event)
{ {
printf("Debugger Close Window Event\n"); QSettings settings;
done(0); //printf("Debugger Close Window Event\n");
settings.setValue("debugger/geometry", saveGeometry());
done(0);
deleteLater(); deleteLater();
event->accept(); event->accept();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void ConsoleDebugger::closeWindow(void) void ConsoleDebugger::closeWindow(void)
{ {
//printf("Close Window\n"); QSettings settings;
done(0); //printf("Close Window\n");
settings.setValue("debugger/geometry", saveGeometry());
done(0);
deleteLater(); deleteLater();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -36,6 +36,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QPushButton> #include <QPushButton>
#include <QActionGroup> #include <QActionGroup>
#include <QSettings>
#include "../../types.h" #include "../../types.h"
#include "../../fceu.h" #include "../../fceu.h"
@ -1085,6 +1086,7 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
QAction *act, *actHlgt, *actHlgtRV, *actColorFG, *actColorBG; QAction *act, *actHlgt, *actHlgtRV, *actColorFG, *actColorBG;
QActionGroup *group; QActionGroup *group;
int useNativeMenuBar; int useNativeMenuBar;
QSettings settings;
QDialog::setWindowTitle( tr("Hex Editor") ); QDialog::setWindowTitle( tr("Hex Editor") );
@ -1429,6 +1431,8 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
FCEUI_CreateCheatMap(); FCEUI_CreateCheatMap();
unloadTableAct->setEnabled( editor->charTable.customMapLoaded ); unloadTableAct->setEnabled( editor->charTable.customMapLoaded );
restoreGeometry(settings.value("hexEditor/geometry").toByteArray());
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
HexEditorDialog_t::~HexEditorDialog_t(void) HexEditorDialog_t::~HexEditorDialog_t(void)
@ -1522,7 +1526,9 @@ void HexEditorDialog_t::populateBookmarkMenu(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void HexEditorDialog_t::closeEvent(QCloseEvent *event) void HexEditorDialog_t::closeEvent(QCloseEvent *event)
{ {
printf("Hex Editor Close Window Event\n"); QSettings settings;
//printf("Hex Editor Close Window Event\n");
settings.setValue("hexEditor/geometry", saveGeometry());
done(0); done(0);
deleteLater(); deleteLater();
event->accept(); event->accept();
@ -1530,7 +1536,9 @@ void HexEditorDialog_t::closeEvent(QCloseEvent *event)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void HexEditorDialog_t::closeWindow(void) void HexEditorDialog_t::closeWindow(void)
{ {
QSettings settings;
//printf("Close Window\n"); //printf("Close Window\n");
settings.setValue("hexEditor/geometry", saveGeometry());
done(0); done(0);
deleteLater(); deleteLater();
} }

View File

@ -30,6 +30,7 @@
#include <QInputDialog> #include <QInputDialog>
#include <QColorDialog> #include <QColorDialog>
#include <QMessageBox> #include <QMessageBox>
#include <QSettings>
#include "../../types.h" #include "../../types.h"
#include "../../fceu.h" #include "../../fceu.h"
@ -132,6 +133,7 @@ static int conv2hex( int i )
ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent) ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent)
: QDialog( parent, Qt::Window ) : QDialog( parent, Qt::Window )
{ {
QSettings settings;
QHBoxLayout *mainLayout; QHBoxLayout *mainLayout;
QVBoxLayout *vbox1, *vbox2, *vbox3; QVBoxLayout *vbox1, *vbox2, *vbox3;
QHBoxLayout *hbox, *hbox1; QHBoxLayout *hbox, *hbox1;
@ -530,6 +532,8 @@ ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent)
updateMirrorText(); updateMirrorText();
refreshMenuSelections(); refreshMenuSelections();
restoreGeometry(settings.value("ntViewer/geometry").toByteArray());
} }
//---------------------------------------------------- //----------------------------------------------------
ppuNameTableViewerDialog_t::~ppuNameTableViewerDialog_t(void) ppuNameTableViewerDialog_t::~ppuNameTableViewerDialog_t(void)
@ -537,12 +541,14 @@ ppuNameTableViewerDialog_t::~ppuNameTableViewerDialog_t(void)
updateTimer->stop(); updateTimer->stop();
nameTableViewWindow = NULL; nameTableViewWindow = NULL;
printf("Name Table Viewer Window Deleted\n"); //printf("Name Table Viewer Window Deleted\n");
} }
//---------------------------------------------------- //----------------------------------------------------
void ppuNameTableViewerDialog_t::closeEvent(QCloseEvent *event) void ppuNameTableViewerDialog_t::closeEvent(QCloseEvent *event)
{ {
printf("Name Table Viewer Close Window Event\n"); QSettings settings;
//printf("Name Table Viewer Close Window Event\n");
settings.setValue("ntViewer/geometry", saveGeometry());
done(0); done(0);
deleteLater(); deleteLater();
event->accept(); event->accept();
@ -550,7 +556,9 @@ void ppuNameTableViewerDialog_t::closeEvent(QCloseEvent *event)
//---------------------------------------------------- //----------------------------------------------------
void ppuNameTableViewerDialog_t::closeWindow(void) void ppuNameTableViewerDialog_t::closeWindow(void)
{ {
printf("Close Window\n"); QSettings settings;
//printf("Close Window\n");
settings.setValue("ntViewer/geometry", saveGeometry());
done(0); done(0);
deleteLater(); deleteLater();
} }

View File

@ -30,6 +30,7 @@
#include <QMenu> #include <QMenu>
#include <QMenuBar> #include <QMenuBar>
#include <QAction> #include <QAction>
#include <QSettings>
#include <QCloseEvent> #include <QCloseEvent>
#include <QFileDialog> #include <QFileDialog>
#include <QColorDialog> #include <QColorDialog>
@ -63,6 +64,7 @@ static std::vector <colorChangeData_t> redoColorHistory;
PaletteEditorDialog_t::PaletteEditorDialog_t(QWidget *parent) PaletteEditorDialog_t::PaletteEditorDialog_t(QWidget *parent)
: QDialog( parent ) : QDialog( parent )
{ {
QSettings settings;
QVBoxLayout *mainLayout; QVBoxLayout *mainLayout;
QMenuBar *menuBar; QMenuBar *menuBar;
QMenu *fileMenu, *editMenu, *memMenu, *subMenu; QMenu *fileMenu, *editMenu, *memMenu, *subMenu;
@ -177,11 +179,13 @@ PaletteEditorDialog_t::PaletteEditorDialog_t(QWidget *parent)
connect(updateTimer, &QTimer::timeout, this, &PaletteEditorDialog_t::updatePeriodic); connect(updateTimer, &QTimer::timeout, this, &PaletteEditorDialog_t::updatePeriodic);
updateTimer->start(500); // 2hz updateTimer->start(500); // 2hz
restoreGeometry(settings.value("paletteEditor/geometry").toByteArray());
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
PaletteEditorDialog_t::~PaletteEditorDialog_t(void) PaletteEditorDialog_t::~PaletteEditorDialog_t(void)
{ {
printf("Destroy Palette Editor Config Window\n"); //printf("Destroy Palette Editor Config Window\n");
updateTimer->stop(); updateTimer->stop();
@ -191,7 +195,9 @@ PaletteEditorDialog_t::~PaletteEditorDialog_t(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void PaletteEditorDialog_t::closeEvent(QCloseEvent *event) void PaletteEditorDialog_t::closeEvent(QCloseEvent *event)
{ {
QSettings settings;
//printf("Palette Editor Close Window Event\n"); //printf("Palette Editor Close Window Event\n");
settings.setValue("paletteEditor/geometry", saveGeometry());
done(0); done(0);
deleteLater(); deleteLater();
event->accept(); event->accept();
@ -199,7 +205,9 @@ void PaletteEditorDialog_t::closeEvent(QCloseEvent *event)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void PaletteEditorDialog_t::closeWindow(void) void PaletteEditorDialog_t::closeWindow(void)
{ {
QSettings settings;
//printf("Close Window\n"); //printf("Close Window\n");
settings.setValue("paletteEditor/geometry", saveGeometry());
done(0); done(0);
deleteLater(); deleteLater();
} }

View File

@ -29,6 +29,7 @@
#include <SDL.h> #include <SDL.h>
#include <QMenuBar> #include <QMenuBar>
#include <QAction> #include <QAction>
#include <QSettings>
#include <QHeaderView> #include <QHeaderView>
#include <QCloseEvent> #include <QCloseEvent>
#include <QGroupBox> #include <QGroupBox>
@ -68,6 +69,7 @@ void openRamWatchWindow( QWidget *parent, int force )
RamWatchDialog_t::RamWatchDialog_t(QWidget *parent) RamWatchDialog_t::RamWatchDialog_t(QWidget *parent)
: QDialog( parent, Qt::Window ) : QDialog( parent, Qt::Window )
{ {
QSettings settings;
QMenuBar *menuBar; QMenuBar *menuBar;
QHBoxLayout *mainLayout; QHBoxLayout *mainLayout;
QVBoxLayout *vbox, *vbox1; QVBoxLayout *vbox, *vbox1;
@ -303,6 +305,8 @@ RamWatchDialog_t::RamWatchDialog_t(QWidget *parent)
connect( updateTimer, &QTimer::timeout, this, &RamWatchDialog_t::periodicUpdate ); connect( updateTimer, &QTimer::timeout, this, &RamWatchDialog_t::periodicUpdate );
updateTimer->start( 100 ); // 10hz updateTimer->start( 100 ); // 10hz
restoreGeometry(settings.value("ramWatch/geometry").toByteArray());
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
RamWatchDialog_t::~RamWatchDialog_t(void) RamWatchDialog_t::~RamWatchDialog_t(void)
@ -318,16 +322,20 @@ RamWatchDialog_t::~RamWatchDialog_t(void)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void RamWatchDialog_t::closeEvent(QCloseEvent *event) void RamWatchDialog_t::closeEvent(QCloseEvent *event)
{ {
printf("RAM Watch Close Window Event\n"); QSettings settings;
done(0); //printf("RAM Watch Close Window Event\n");
settings.setValue("ramWatch/geometry", saveGeometry());
done(0);
deleteLater(); deleteLater();
event->accept(); event->accept();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void RamWatchDialog_t::closeWindow(void) void RamWatchDialog_t::closeWindow(void)
{ {
//printf("Close Window\n"); QSettings settings;
done(0); //printf("Close Window\n");
settings.setValue("ramWatch/geometry", saveGeometry());
done(0);
deleteLater(); deleteLater();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -35,6 +35,7 @@
#include <QMenu> #include <QMenu>
#include <QMenuBar> #include <QMenuBar>
#include <QAction> #include <QAction>
#include <QSettings>
#include <QFileDialog> #include <QFileDialog>
#include <QInputDialog> #include <QInputDialog>
#include <QMessageBox> #include <QMessageBox>
@ -140,6 +141,7 @@ static void initLogOption( const char *name, int bitmask )
TraceLoggerDialog_t::TraceLoggerDialog_t(QWidget *parent) TraceLoggerDialog_t::TraceLoggerDialog_t(QWidget *parent)
: QDialog(parent, Qt::Window) : QDialog(parent, Qt::Window)
{ {
QSettings settings;
QVBoxLayout *mainLayout; QVBoxLayout *mainLayout;
QHBoxLayout *hbox; QHBoxLayout *hbox;
QGridLayout *grid; QGridLayout *grid;
@ -361,6 +363,8 @@ TraceLoggerDialog_t::TraceLoggerDialog_t(QWidget *parent)
updateTimer->start(50); // 20hz updateTimer->start(50); // 20hz
diskThread = new TraceLogDiskThread_t(this); diskThread = new TraceLogDiskThread_t(this);
restoreGeometry(settings.value("traceLogger/geometry").toByteArray());
} }
//---------------------------------------------------- //----------------------------------------------------
TraceLoggerDialog_t::~TraceLoggerDialog_t(void) TraceLoggerDialog_t::~TraceLoggerDialog_t(void)
@ -380,7 +384,9 @@ TraceLoggerDialog_t::~TraceLoggerDialog_t(void)
//---------------------------------------------------- //----------------------------------------------------
void TraceLoggerDialog_t::closeEvent(QCloseEvent *event) void TraceLoggerDialog_t::closeEvent(QCloseEvent *event)
{ {
printf("Trace Logger Close Window Event\n"); QSettings settings;
//printf("Trace Logger Close Window Event\n");
settings.setValue("traceLogger/geometry", saveGeometry());
done(0); done(0);
deleteLater(); deleteLater();
event->accept(); event->accept();
@ -388,7 +394,9 @@ void TraceLoggerDialog_t::closeEvent(QCloseEvent *event)
//---------------------------------------------------- //----------------------------------------------------
void TraceLoggerDialog_t::closeWindow(void) void TraceLoggerDialog_t::closeWindow(void)
{ {
printf("Trace Logger Close Window\n"); QSettings settings;
//printf("Trace Logger Close Window\n");
settings.setValue("traceLogger/geometry", saveGeometry());
done(0); done(0);
deleteLater(); deleteLater();
} }
@ -2314,7 +2322,11 @@ void TraceLogDiskThread_t::run(void)
DWORD bytesWritten; DWORD bytesWritten;
WriteFile( logFile, buf, idx, &bytesWritten, NULL ); idx = 0; WriteFile( logFile, buf, idx, &bytesWritten, NULL ); idx = 0;
#else #else
write( logFile, buf, idx ); idx = 0; if ( write( logFile, buf, idx ) < 0 )
{
// HANDLE ERROR TODO
}
idx = 0;
#endif #endif
} }
} }
@ -2327,7 +2339,11 @@ void TraceLogDiskThread_t::run(void)
DWORD bytesWritten; DWORD bytesWritten;
WriteFile( logFile, buf, idx, &bytesWritten, NULL ); idx = 0; WriteFile( logFile, buf, idx, &bytesWritten, NULL ); idx = 0;
#else #else
write( logFile, buf, idx ); idx = 0; if ( write( logFile, buf, idx ) < 0 )
{
// HANDLE ERROR TODO
}
idx = 0;
#endif #endif
} }

View File

@ -87,6 +87,10 @@ int main( int argc, char *argv[] )
QApplication app(argc, argv); QApplication app(argc, argv);
//const char *styleSheetEnv = NULL; //const char *styleSheetEnv = NULL;
QCoreApplication::setOrganizationName("TasVideos");
QCoreApplication::setOrganizationDomain("TasVideos.org");
QCoreApplication::setApplicationName("fceux");
#ifdef WIN32 #ifdef WIN32
if (AttachConsole(ATTACH_PARENT_PROCESS)) if (AttachConsole(ATTACH_PARENT_PROCESS))
{ {

View File

@ -28,6 +28,7 @@
#include <QAction> #include <QAction>
#include <QMenuBar> #include <QMenuBar>
#include <QPainter> #include <QPainter>
#include <QSettings>
#include <QFileDialog> #include <QFileDialog>
#include <QInputDialog> #include <QInputDialog>
#include <QColorDialog> #include <QColorDialog>
@ -193,6 +194,7 @@ static int exportActivePaletteACT( const char *filename )
ppuViewerDialog_t::ppuViewerDialog_t(QWidget *parent) ppuViewerDialog_t::ppuViewerDialog_t(QWidget *parent)
: QDialog( parent, Qt::Window ) : QDialog( parent, Qt::Window )
{ {
QSettings settings;
QMenuBar *menuBar; QMenuBar *menuBar;
QVBoxLayout *mainLayout, *vbox; QVBoxLayout *mainLayout, *vbox;
QVBoxLayout *patternVbox[2]; QVBoxLayout *patternVbox[2];
@ -437,6 +439,8 @@ ppuViewerDialog_t::ppuViewerDialog_t(QWidget *parent)
connect( updateTimer, &QTimer::timeout, this, &ppuViewerDialog_t::periodicUpdate ); connect( updateTimer, &QTimer::timeout, this, &ppuViewerDialog_t::periodicUpdate );
updateTimer->start( 33 ); // 30hz updateTimer->start( 33 ); // 30hz
restoreGeometry(settings.value("ppuViewer/geometry").toByteArray());
} }
//---------------------------------------------------- //----------------------------------------------------
@ -450,7 +454,9 @@ ppuViewerDialog_t::~ppuViewerDialog_t(void)
//---------------------------------------------------- //----------------------------------------------------
void ppuViewerDialog_t::closeEvent(QCloseEvent *event) void ppuViewerDialog_t::closeEvent(QCloseEvent *event)
{ {
printf("PPU Viewer Close Window Event\n"); QSettings settings;
//printf("PPU Viewer Close Window Event\n");
settings.setValue("ppuViewer/geometry", saveGeometry());
done(0); done(0);
deleteLater(); deleteLater();
event->accept(); event->accept();
@ -458,7 +464,9 @@ void ppuViewerDialog_t::closeEvent(QCloseEvent *event)
//---------------------------------------------------- //----------------------------------------------------
void ppuViewerDialog_t::closeWindow(void) void ppuViewerDialog_t::closeWindow(void)
{ {
printf("Close Window\n"); QSettings settings;
//printf("Close Window\n");
settings.setValue("ppuViewer/geometry", saveGeometry());
done(0); done(0);
deleteLater(); deleteLater();
} }
@ -2791,6 +2799,7 @@ void ppuTileEditColorPicker_t::paintEvent(QPaintEvent *event)
spriteViewerDialog_t::spriteViewerDialog_t(QWidget *parent) spriteViewerDialog_t::spriteViewerDialog_t(QWidget *parent)
: QDialog(parent, Qt::Window) : QDialog(parent, Qt::Window)
{ {
QSettings settings;
QMenuBar *menuBar; QMenuBar *menuBar;
QVBoxLayout *mainLayout, *vbox, *vbox1, *vbox2, *vbox3; QVBoxLayout *mainLayout, *vbox, *vbox1, *vbox2, *vbox3;
QHBoxLayout *hbox, *hbox1, *hbox2; QHBoxLayout *hbox, *hbox1, *hbox2;
@ -3058,6 +3067,8 @@ spriteViewerDialog_t::spriteViewerDialog_t(QWidget *parent)
updateTimer->start( 33 ); // 30hz updateTimer->start( 33 ); // 30hz
resize( minimumSizeHint() ); resize( minimumSizeHint() );
restoreGeometry(settings.value("spriteViewer/geometry").toByteArray());
} }
//---------------------------------------------------- //----------------------------------------------------
spriteViewerDialog_t::~spriteViewerDialog_t(void) spriteViewerDialog_t::~spriteViewerDialog_t(void)
@ -3070,7 +3081,9 @@ spriteViewerDialog_t::~spriteViewerDialog_t(void)
//---------------------------------------------------- //----------------------------------------------------
void spriteViewerDialog_t::closeEvent(QCloseEvent *event) void spriteViewerDialog_t::closeEvent(QCloseEvent *event)
{ {
printf("Sprite Viewer Close Window Event\n"); QSettings settings;
//printf("Sprite Viewer Close Window Event\n");
settings.setValue("spriteViewer/geometry", saveGeometry());
done(0); done(0);
deleteLater(); deleteLater();
event->accept(); event->accept();
@ -3078,7 +3091,9 @@ void spriteViewerDialog_t::closeEvent(QCloseEvent *event)
//---------------------------------------------------- //----------------------------------------------------
void spriteViewerDialog_t::closeWindow(void) void spriteViewerDialog_t::closeWindow(void)
{ {
printf("Close Window\n"); QSettings settings;
//printf("Close Window\n");
settings.setValue("spriteViewer/geometry", saveGeometry());
done(0); done(0);
deleteLater(); deleteLater();
} }