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