Added save/recall window geometry for various windows in Qt GUI.
This commit is contained in:
parent
911e903ecb
commit
e6d0822dad
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
#include "../../types.h"
|
#include "../../types.h"
|
||||||
#include "../../fceu.h"
|
#include "../../fceu.h"
|
||||||
|
@ -104,6 +105,7 @@ GameGenieDialog_t::GameGenieDialog_t(QWidget *parent)
|
||||||
QFont font;
|
QFont font;
|
||||||
QPushButton *closeButton;
|
QPushButton *closeButton;
|
||||||
fceuGGCodeValidtor *ggCodeValidator;
|
fceuGGCodeValidtor *ggCodeValidator;
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
font.setFamily("Courier New");
|
font.setFamily("Courier New");
|
||||||
font.setStyle( QFont::StyleNormal );
|
font.setStyle( QFont::StyleNormal );
|
||||||
|
@ -228,11 +230,15 @@ GameGenieDialog_t::GameGenieDialog_t(QWidget *parent)
|
||||||
connect( tree, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(romAddrDoubleClicked(QTreeWidgetItem*, int)) );
|
connect( tree, SIGNAL(itemActivated(QTreeWidgetItem*, int)), this, SLOT(romAddrDoubleClicked(QTreeWidgetItem*, int)) );
|
||||||
|
|
||||||
addCheatBtn->setEnabled( false );
|
addCheatBtn->setEnabled( false );
|
||||||
|
|
||||||
|
restoreGeometry(settings.value("GameGenieWindow/geometry").toByteArray());
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
GameGenieDialog_t::~GameGenieDialog_t(void)
|
GameGenieDialog_t::~GameGenieDialog_t(void)
|
||||||
{
|
{
|
||||||
printf("Destroy Game Genie Window\n");
|
QSettings settings;
|
||||||
|
//printf("Destroy Game Genie Window\n");
|
||||||
|
settings.setValue("GameGenieWindow/geometry", saveGeometry());
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void GameGenieDialog_t::closeEvent(QCloseEvent *event)
|
void GameGenieDialog_t::closeEvent(QCloseEvent *event)
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
#include "../../fceu.h"
|
#include "../../fceu.h"
|
||||||
|
|
||||||
|
@ -114,6 +115,7 @@ LuaControlDialog_t::LuaControlDialog_t(QWidget *parent)
|
||||||
QPushButton *closeButton;
|
QPushButton *closeButton;
|
||||||
QLabel *lbl;
|
QLabel *lbl;
|
||||||
std::string filename;
|
std::string filename;
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
resize(512, 512);
|
resize(512, 512);
|
||||||
|
|
||||||
|
@ -193,11 +195,14 @@ LuaControlDialog_t::LuaControlDialog_t(QWidget *parent)
|
||||||
connect(periodicTimer, &QTimer::timeout, this, &LuaControlDialog_t::updatePeriodic);
|
connect(periodicTimer, &QTimer::timeout, this, &LuaControlDialog_t::updatePeriodic);
|
||||||
|
|
||||||
periodicTimer->start(200); // 5hz
|
periodicTimer->start(200); // 5hz
|
||||||
|
|
||||||
|
restoreGeometry(settings.value("LuaWindow/geometry").toByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
LuaControlDialog_t::~LuaControlDialog_t(void)
|
LuaControlDialog_t::~LuaControlDialog_t(void)
|
||||||
{
|
{
|
||||||
|
QSettings settings;
|
||||||
std::list<LuaControlDialog_t *>::iterator it;
|
std::list<LuaControlDialog_t *>::iterator it;
|
||||||
|
|
||||||
//printf("Destroy Lua Control Window\n");
|
//printf("Destroy Lua Control Window\n");
|
||||||
|
@ -213,6 +218,7 @@ LuaControlDialog_t::~LuaControlDialog_t(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
settings.setValue("LuaWindow/geometry", saveGeometry());
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
void LuaControlDialog_t::closeEvent(QCloseEvent *event)
|
void LuaControlDialog_t::closeEvent(QCloseEvent *event)
|
||||||
|
|
|
@ -31,6 +31,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"
|
||||||
|
@ -191,6 +192,7 @@ MsgLogViewDialog_t::MsgLogViewDialog_t(QWidget *parent)
|
||||||
QVBoxLayout *mainLayout;
|
QVBoxLayout *mainLayout;
|
||||||
QHBoxLayout *hbox;
|
QHBoxLayout *hbox;
|
||||||
QPushButton *clearBtn, *closeBtn;
|
QPushButton *clearBtn, *closeBtn;
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
setWindowTitle("Message Log Viewer");
|
setWindowTitle("Message Log Viewer");
|
||||||
|
|
||||||
|
@ -233,17 +235,21 @@ MsgLogViewDialog_t::MsgLogViewDialog_t(QWidget *parent)
|
||||||
totalLines = msgLog.getTotalLineCount();
|
totalLines = msgLog.getTotalLineCount();
|
||||||
|
|
||||||
txtView->moveCursor(QTextCursor::End);
|
txtView->moveCursor(QTextCursor::End);
|
||||||
|
|
||||||
|
restoreGeometry(settings.value("MsgLogWindow/geometry").toByteArray());
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
MsgLogViewDialog_t::~MsgLogViewDialog_t(void)
|
MsgLogViewDialog_t::~MsgLogViewDialog_t(void)
|
||||||
{
|
{
|
||||||
printf("Destroy Msg Log Key Config Window\n");
|
QSettings settings;
|
||||||
|
//printf("Destroy Msg Log Config Window\n");
|
||||||
updateTimer->stop();
|
updateTimer->stop();
|
||||||
|
settings.setValue("MsgLogWindow/geometry", saveGeometry());
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void MsgLogViewDialog_t::closeEvent(QCloseEvent *event)
|
void MsgLogViewDialog_t::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
printf("Msg Log Key Close Window Event\n");
|
//printf("Msg Log Close Window Event\n");
|
||||||
done(0);
|
done(0);
|
||||||
deleteLater();
|
deleteLater();
|
||||||
event->accept();
|
event->accept();
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
#include "../../types.h"
|
#include "../../types.h"
|
||||||
#include "../../fceu.h"
|
#include "../../fceu.h"
|
||||||
|
@ -170,6 +171,7 @@ iNesHeaderEditor_t::iNesHeaderEditor_t(QWidget *parent)
|
||||||
QGroupBox *box, *hdrBox;
|
QGroupBox *box, *hdrBox;
|
||||||
QGridLayout *grid;
|
QGridLayout *grid;
|
||||||
QStyle *style;
|
QStyle *style;
|
||||||
|
QSettings settings;
|
||||||
char stmp[128];
|
char stmp[128];
|
||||||
|
|
||||||
style = this->style();
|
style = this->style();
|
||||||
|
@ -529,21 +531,25 @@ iNesHeaderEditor_t::iNesHeaderEditor_t(QWidget *parent)
|
||||||
setHeaderData( iNesHdr );
|
setHeaderData( iNesHdr );
|
||||||
|
|
||||||
initOK = true;
|
initOK = true;
|
||||||
|
|
||||||
|
restoreGeometry(settings.value("iNesHeaderWindow/geometry").toByteArray());
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
iNesHeaderEditor_t::~iNesHeaderEditor_t(void)
|
iNesHeaderEditor_t::~iNesHeaderEditor_t(void)
|
||||||
{
|
{
|
||||||
printf("Destroy Header Editor Config Window\n");
|
QSettings settings;
|
||||||
|
//printf("Destroy Header Editor Config Window\n");
|
||||||
|
|
||||||
if ( iNesHdr )
|
if ( iNesHdr )
|
||||||
{
|
{
|
||||||
free( iNesHdr ); iNesHdr = NULL;
|
free( iNesHdr ); iNesHdr = NULL;
|
||||||
}
|
}
|
||||||
|
settings.setValue("iNesHeaderWindow/geometry", saveGeometry());
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void iNesHeaderEditor_t::closeEvent(QCloseEvent *event)
|
void iNesHeaderEditor_t::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
printf("iNES Header Editor Close Window Event\n");
|
//printf("iNES Header Editor Close Window Event\n");
|
||||||
done(0);
|
done(0);
|
||||||
deleteLater();
|
deleteLater();
|
||||||
event->accept();
|
event->accept();
|
||||||
|
|
|
@ -461,10 +461,13 @@ ppuViewerDialog_t::ppuViewerDialog_t(QWidget *parent)
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
ppuViewerDialog_t::~ppuViewerDialog_t(void)
|
ppuViewerDialog_t::~ppuViewerDialog_t(void)
|
||||||
{
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
updateTimer->stop();
|
updateTimer->stop();
|
||||||
ppuViewWindow = NULL;
|
ppuViewWindow = NULL;
|
||||||
|
|
||||||
printf("PPU Viewer Window Deleted\n");
|
//printf("PPU Viewer Window Deleted\n");
|
||||||
|
settings.setValue("ppuViewer/geometry", saveGeometry());
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
void ppuViewerDialog_t::closeEvent(QCloseEvent *event)
|
void ppuViewerDialog_t::closeEvent(QCloseEvent *event)
|
||||||
|
@ -2004,6 +2007,7 @@ ppuTileEditor_t::ppuTileEditor_t(int patternIndex, QWidget *parent)
|
||||||
QMenuBar *menuBar;
|
QMenuBar *menuBar;
|
||||||
QMenu *fileMenu, *helpMenu;
|
QMenu *fileMenu, *helpMenu;
|
||||||
QAction *act;
|
QAction *act;
|
||||||
|
QSettings settings;
|
||||||
int useNativeMenuBar;
|
int useNativeMenuBar;
|
||||||
|
|
||||||
this->setFocusPolicy(Qt::StrongFocus);
|
this->setFocusPolicy(Qt::StrongFocus);
|
||||||
|
@ -2108,18 +2112,22 @@ ppuTileEditor_t::ppuTileEditor_t(int patternIndex, QWidget *parent)
|
||||||
connect( updateTimer, &QTimer::timeout, this, &ppuTileEditor_t::periodicUpdate );
|
connect( updateTimer, &QTimer::timeout, this, &ppuTileEditor_t::periodicUpdate );
|
||||||
|
|
||||||
updateTimer->start( 100 ); // 10hz
|
updateTimer->start( 100 ); // 10hz
|
||||||
|
|
||||||
|
restoreGeometry(settings.value("ppuTileEditorWindow/geometry").toByteArray());
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
ppuTileEditor_t::~ppuTileEditor_t(void)
|
ppuTileEditor_t::~ppuTileEditor_t(void)
|
||||||
{
|
{
|
||||||
|
QSettings settings;
|
||||||
updateTimer->stop();
|
updateTimer->stop();
|
||||||
|
|
||||||
printf("PPU Tile Editor Window Deleted\n");
|
//printf("PPU Tile Editor Window Deleted\n");
|
||||||
|
settings.setValue("ppuTileEditorWindow/geometry", saveGeometry());
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
void ppuTileEditor_t::closeEvent(QCloseEvent *event)
|
void ppuTileEditor_t::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
printf("PPU Tile Editor Close Window Event\n");
|
//printf("PPU Tile Editor Close Window Event\n");
|
||||||
done(0);
|
done(0);
|
||||||
deleteLater();
|
deleteLater();
|
||||||
event->accept();
|
event->accept();
|
||||||
|
@ -2127,14 +2135,13 @@ void ppuTileEditor_t::closeEvent(QCloseEvent *event)
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
void ppuTileEditor_t::closeWindow(void)
|
void ppuTileEditor_t::closeWindow(void)
|
||||||
{
|
{
|
||||||
printf("Close Window\n");
|
//printf("Close Window\n");
|
||||||
done(0);
|
done(0);
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
void ppuTileEditor_t::periodicUpdate(void)
|
void ppuTileEditor_t::periodicUpdate(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
tileView->update();
|
tileView->update();
|
||||||
colorPicker->update();
|
colorPicker->update();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue