Qt: Close game inspector windows when game ends

This commit is contained in:
Jeffrey Pfau 2015-04-29 21:09:32 -07:00
parent a01f9921f5
commit a7ad78d46e
3 changed files with 9 additions and 0 deletions

View File

@ -21,6 +21,7 @@ using namespace QGBA;
MemoryModel::MemoryModel(QWidget* parent)
: QAbstractScrollArea(parent)
, m_cpu(nullptr)
, m_top(0)
{
m_font.setFamily("Source Code Pro");

View File

@ -6,6 +6,8 @@
#include "MemoryView.h"
#include "GameController.h"
using namespace QGBA;
MemoryView::MemoryView(GameController* controller, QWidget* parent)
@ -15,4 +17,5 @@ MemoryView::MemoryView(GameController* controller, QWidget* parent)
m_ui.setupUi(this);
m_ui.hexfield->setController(controller);
connect(controller, SIGNAL(gameStopped(GBAThread*)), this, SLOT(close()));
}

View File

@ -33,9 +33,14 @@ PaletteView::PaletteView(GameController* controller, QWidget* parent)
connect(m_ui.bgGrid, SIGNAL(indexPressed(int)), this, SLOT(selectIndex(int)));
connect(m_ui.objGrid, &Swatch::indexPressed, [this] (int index) { selectIndex(index + 256); });
connect(controller, SIGNAL(gameStopped(GBAThread*)), this, SLOT(close()));
}
void PaletteView::updatePalette() {
if (!m_controller->thread() || !m_controller->thread()->gba) {
return;
}
const uint16_t* palette = m_controller->thread()->gba->video.palette;
for (int i = 0; i < 256; ++i) {
m_ui.bgGrid->setColor(i, palette[i]);