From 88c386d74d7d94ec16d4d84ed674eb51e31647ac Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Sun, 9 Jun 2024 12:18:17 +0200 Subject: Refactoring of game features for better management. (#2043) --- src/mainwindow.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ca738c78..b14a14a1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -332,11 +332,11 @@ MainWindow::MainWindow(Settings& settings, OrganizerCore& organizerCore, m_SavesTab.reset(new SavesTab(this, m_OrganizerCore, ui)); // Hide stuff we do not need: - IPluginGame const* game = m_OrganizerCore.managedGame(); - if (!game->feature()) { + auto& features = m_OrganizerCore.gameFeatures(); + if (!features.gameFeature()) { ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->espTab)); } - if (!game->feature()) { + if (!features.gameFeature()) { ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->bsaTab)); } @@ -1796,15 +1796,14 @@ void MainWindow::on_profileBox_currentIndexChanged(int index) activateSelectedProfile(); - LocalSavegames* saveGames = m_OrganizerCore.managedGame()->feature(); + auto saveGames = m_OrganizerCore.gameFeatures().gameFeature(); if (saveGames != nullptr) { if (saveGames->prepareProfile(m_OrganizerCore.currentProfile())) { m_SavesTab->refreshSaveList(); } } - BSAInvalidation* invalidation = - m_OrganizerCore.managedGame()->feature(); + auto invalidation = m_OrganizerCore.gameFeatures().gameFeature(); if (invalidation != nullptr) { if (invalidation->prepareProfile(m_OrganizerCore.currentProfile())) { QTimer::singleShot(5, [this] { @@ -1922,8 +1921,7 @@ void MainWindow::updateBSAList(const QStringList& defaultArchives, ui->bsaList->header()->setSectionResizeMode(QHeaderView::ResizeToContents); std::vector> items; - BSAInvalidation* invalidation = - m_OrganizerCore.managedGame()->feature(); + auto invalidation = m_OrganizerCore.gameFeatures().gameFeature(); std::vector files = m_OrganizerCore.directoryStructure()->getFiles(); QStringList plugins = @@ -2032,7 +2030,7 @@ void MainWindow::updateBSAList(const QStringList& defaultArchives, void MainWindow::checkBSAList() { - DataArchives* archives = m_OrganizerCore.managedGame()->feature(); + auto archives = m_OrganizerCore.gameFeatures().gameFeature(); if (archives != nullptr) { ui->bsaList->blockSignals(true); @@ -2384,15 +2382,14 @@ void MainWindow::on_actionAdd_Profile_triggered() } } - LocalSavegames* saveGames = m_OrganizerCore.managedGame()->feature(); + auto saveGames = m_OrganizerCore.gameFeatures().gameFeature(); if (saveGames != nullptr) { if (saveGames->prepareProfile(m_OrganizerCore.currentProfile())) { m_SavesTab->refreshSaveList(); } } - BSAInvalidation* invalidation = - m_OrganizerCore.managedGame()->feature(); + auto invalidation = m_OrganizerCore.gameFeatures().gameFeature(); if (invalidation != nullptr) { if (invalidation->prepareProfile(m_OrganizerCore.currentProfile())) { QTimer::singleShot(5, [this] { -- cgit v1.3.1