Qt: Move controller-based subview auto-closing

This commit is contained in:
Vicki Pfau 2023-09-12 16:56:27 -07:00
parent f051b88f81
commit 4b9072de03
8 changed files with 1 additions and 11 deletions

View File

@ -32,7 +32,6 @@ AssetView::AssetView(std::shared_ptr<CoreController> controller, QWidget* parent
connect(controller.get(), &CoreController::frameAvailable, &m_updateTimer,
static_cast<void(QTimer::*)()>(&QTimer::start));
connect(controller.get(), &CoreController::stopping, this, &AssetView::close);
connect(controller.get(), &CoreController::stopping, &m_updateTimer, &QTimer::stop);
}

View File

@ -63,7 +63,6 @@ BattleChipView::BattleChipView(std::shared_ptr<CoreController> controller, Windo
connect(m_ui.insert, &QAbstractButton::clicked, this, &BattleChipView::reinsert);
connect(m_ui.add, &QAbstractButton::clicked, this, &BattleChipView::addChip);
connect(m_ui.remove, &QAbstractButton::clicked, this, &BattleChipView::removeChip);
connect(controller.get(), &CoreController::stopping, this, &QWidget::close);
connect(m_ui.save, &QAbstractButton::clicked, this, &BattleChipView::saveDeck);
connect(m_ui.load, &QAbstractButton::clicked, this, &BattleChipView::loadDeck);
connect(m_ui.updateData, &QAbstractButton::clicked, this, &BattleChipView::updateData);

View File

@ -41,7 +41,6 @@ CheatsView::CheatsView(std::shared_ptr<CoreController> controller, QWidget* pare
connect(m_ui.addSet, &QAbstractButton::clicked, this, &CheatsView::addSet);
connect(m_ui.remove, &QAbstractButton::clicked, this, &CheatsView::removeSet);
connect(m_ui.add, &QAbstractButton::clicked, this, &CheatsView::enterCheat);
connect(controller.get(), &CoreController::stopping, this, &CheatsView::close);
connect(controller.get(), &CoreController::stateLoaded, &m_model, &CheatsModel::invalidated);
switch (controller->platform()) {

View File

@ -1651,8 +1651,6 @@ IOViewer::IOViewer(std::shared_ptr<CoreController> controller, QWidget* parent)
}
selectRegister(0);
connect(controller.get(), &CoreController::stopping, this, &QWidget::close);
}
void IOViewer::updateRegister() {

View File

@ -27,8 +27,6 @@ MemorySearch::MemorySearch(std::shared_ptr<CoreController> controller, QWidget*
connect(m_ui.numHex, &QPushButton::clicked, this, &MemorySearch::refresh);
connect(m_ui.numDec, &QPushButton::clicked, this, &MemorySearch::refresh);
connect(m_ui.viewMem, &QPushButton::clicked, this, &MemorySearch::openMemory);
connect(controller.get(), &CoreController::stopping, this, &QWidget::close);
}
MemorySearch::~MemorySearch() {

View File

@ -153,8 +153,6 @@ MemoryView::MemoryView(std::shared_ptr<CoreController> controller, QWidget* pare
connect(m_ui.hexfield, &MemoryModel::selectionChanged, this, &MemoryView::updateSelection);
connect(m_ui.saveRange, &QAbstractButton::clicked, this, &MemoryView::saveRange);
connect(controller.get(), &CoreController::stopping, this, &QWidget::close);
connect(controller.get(), &CoreController::frameAvailable, this, &MemoryView::update);
connect(controller.get(), &CoreController::paused, this, &MemoryView::update);
connect(controller.get(), &CoreController::stateLoaded, this, &MemoryView::update);

View File

@ -60,8 +60,6 @@ PaletteView::PaletteView(std::shared_ptr<CoreController> controller, QWidget* pa
connect(m_ui.objGrid, &Swatch::indexPressed, [this, count] (int index) { selectIndex(index + count); });
connect(m_ui.exportBG, &QAbstractButton::clicked, [this, count] () { exportPalette(0, count); });
connect(m_ui.exportOBJ, &QAbstractButton::clicked, [this, count] () { exportPalette(count, count); });
connect(controller.get(), &CoreController::stopping, this, &QWidget::close);
}
void PaletteView::updatePalette() {

View File

@ -569,6 +569,7 @@ template <typename T, typename... A>
std::function<void()> Window::openControllerTView(A... arg) {
return [=]() {
T* view = new T(m_controller, arg...);
connect(m_controller.get(), &CoreController::stopping, view, &QWidget::close);
openView(view);
};
}