diff --git a/changelog.md b/changelog.md index 8dde0d2e..7445f5b0 100644 --- a/changelog.md +++ b/changelog.md @@ -29,6 +29,7 @@ Saves from 2.5 are not compatible with 3.0. * **[UI]** Engagement ranges are now displayed by default. * **[UI]** Engagement range display generalized to work for all patrolling flight plans (BARCAP, TARCAP, and CAS). +* **[UI]** DCS loadouts are now selectable in the loadout setup menu. * **[Flight Planner]** Front lines no longer project threat zones to avoid pushing BARCAPs back so much. TARCAPs will be forcibly planned but strike packages will not route around front lines even if it is reasonable to do so. ## Fixes diff --git a/qt_ui/windows/mission/flight/payload/QFlightPayloadTab.py b/qt_ui/windows/mission/flight/payload/QFlightPayloadTab.py index 2da14527..8262e2b4 100644 --- a/qt_ui/windows/mission/flight/payload/QFlightPayloadTab.py +++ b/qt_ui/windows/mission/flight/payload/QFlightPayloadTab.py @@ -1,5 +1,5 @@ from PySide2.QtCore import Qt -from PySide2.QtWidgets import QFrame, QLabel, QVBoxLayout +from PySide2.QtWidgets import QFrame, QLabel, QComboBox, QVBoxLayout from game import Game from gen.flights.flight import Flight @@ -7,11 +7,21 @@ from gen.flights.loadouts import Loadout from qt_ui.windows.mission.flight.payload.QLoadoutEditor import QLoadoutEditor +class DcsLoadoutSelector(QComboBox): + def __init__(self, flight: Flight) -> None: + super().__init__() + for loadout in Loadout.iter_for(flight): + self.addItem(loadout.name, loadout) + self.model().sort(0) + self.setCurrentText(flight.loadout.name) + + class QFlightPayloadTab(QFrame): def __init__(self, flight: Flight, game: Game): super(QFlightPayloadTab, self).__init__() self.flight = flight self.payload_editor = QLoadoutEditor(flight, game) + self.payload_editor.toggled.connect(self.on_custom_toggled) layout = QVBoxLayout() @@ -22,13 +32,20 @@ class QFlightPayloadTab(QFrame): docsText.setAlignment(Qt.AlignCenter) docsText.setOpenExternalLinks(True) - self.payload_editor.toggled.connect(self.on_custom_toggled) + self.loadout_selector = DcsLoadoutSelector(flight) + self.loadout_selector.currentIndexChanged.connect(self.on_new_loadout) + layout.addWidget(self.loadout_selector) layout.addWidget(self.payload_editor) layout.addWidget(docsText) self.setLayout(layout) + def on_new_loadout(self, index: int) -> None: + self.flight.loadout = self.loadout_selector.itemData(index) + self.payload_editor.reset_pylons() + def on_custom_toggled(self, use_custom: bool) -> None: + self.loadout_selector.setDisabled(use_custom) if use_custom: self.flight.loadout = self.flight.loadout.derive_custom("Custom") else: