diff options
| author | Mikaƫl Capelle <capelle.mikael@gmail.com> | 2024-06-09 12:18:17 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-09 12:18:17 +0200 |
| commit | 88c386d74d7d94ec16d4d84ed674eb51e31647ac (patch) | |
| tree | adf0b2537f12d11d8df77f68a84926d15b063554 /src/mainwindow.cpp | |
| parent | c43535f5bcf1043c3b9c00c77967267cf1acf60f (diff) | |
Refactoring of game features for better management. (#2043)
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
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<GamePlugins>()) { + auto& features = m_OrganizerCore.gameFeatures(); + if (!features.gameFeature<GamePlugins>()) { ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->espTab)); } - if (!game->feature<DataArchives>()) { + if (!features.gameFeature<DataArchives>()) { 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<LocalSavegames>(); + auto saveGames = m_OrganizerCore.gameFeatures().gameFeature<LocalSavegames>(); if (saveGames != nullptr) { if (saveGames->prepareProfile(m_OrganizerCore.currentProfile())) { m_SavesTab->refreshSaveList(); } } - BSAInvalidation* invalidation = - m_OrganizerCore.managedGame()->feature<BSAInvalidation>(); + auto invalidation = m_OrganizerCore.gameFeatures().gameFeature<BSAInvalidation>(); 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<std::pair<UINT32, QTreeWidgetItem*>> items; - BSAInvalidation* invalidation = - m_OrganizerCore.managedGame()->feature<BSAInvalidation>(); + auto invalidation = m_OrganizerCore.gameFeatures().gameFeature<BSAInvalidation>(); std::vector<FileEntryPtr> 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<DataArchives>(); + auto archives = m_OrganizerCore.gameFeatures().gameFeature<DataArchives>(); if (archives != nullptr) { ui->bsaList->blockSignals(true); @@ -2384,15 +2382,14 @@ void MainWindow::on_actionAdd_Profile_triggered() } } - LocalSavegames* saveGames = m_OrganizerCore.managedGame()->feature<LocalSavegames>(); + auto saveGames = m_OrganizerCore.gameFeatures().gameFeature<LocalSavegames>(); if (saveGames != nullptr) { if (saveGames->prepareProfile(m_OrganizerCore.currentProfile())) { m_SavesTab->refreshSaveList(); } } - BSAInvalidation* invalidation = - m_OrganizerCore.managedGame()->feature<BSAInvalidation>(); + auto invalidation = m_OrganizerCore.gameFeatures().gameFeature<BSAInvalidation>(); if (invalidation != nullptr) { if (invalidation->prepareProfile(m_OrganizerCore.currentProfile())) { QTimer::singleShot(5, [this] { |
