Skip to content

Commit

Permalink
feat: Reversed rating names based on campaign options
Browse files Browse the repository at this point in the history
- Updated rating names sequence in `MissionViewPanel.java`, `ContractSummaryPanel.java`, and `CustomizeAtBContractDialog.java`
- Added conditional check to reverse rating names if `isReverseQualityNames()` in campaign options is true.
IllianiCBT committed Jun 20, 2024
1 parent f66f2a6 commit 48fa065
Showing 3 changed files with 20 additions and 8 deletions.
13 changes: 9 additions & 4 deletions MekHQ/src/mekhq/gui/dialog/CustomizeAtBContractDialog.java
Original file line number Diff line number Diff line change
@@ -164,17 +164,22 @@ public Component getListCellRendererComponent(final JList<?> list, final Object
btnClose = new JButton();
txtDesc = new MarkdownEditorPanel("Contract Description");
JLabel lblPlanetName = new JLabel();
// TODO : Switch me to use IUnitRating
String[] ratingNames = {"F", "D", "C", "B", "A"};

String[] qualityNames = {"A", "B", "C", "D", "F"};

if (campaign.getCampaignOptions().isReverseQualityNames()) {
qualityNames = new String[] { "F", "D", "C", "B", "A" };
}

final DefaultComboBoxModel<SkillLevel> allySkillModel = new DefaultComboBoxModel<>();
allySkillModel.addAll(SkillLevel.getGeneratableValues());
comboAllySkill = new MMComboBox<>("comboAllySkill", allySkillModel);
cbAllyQuality = new JComboBox<>(ratingNames);
cbAllyQuality = new JComboBox<>(qualityNames);
JLabel lblAllyRating = new JLabel();
final DefaultComboBoxModel<SkillLevel> enemySkillModel = new DefaultComboBoxModel<>();
enemySkillModel.addAll(SkillLevel.getGeneratableValues());
comboEnemySkill = new MMComboBox<>("comboEnemySkill", enemySkillModel);
cbEnemyQuality = new JComboBox<>(ratingNames);
cbEnemyQuality = new JComboBox<>(qualityNames);
JLabel lblAllyBotName = new JLabel();
txtAllyBotName = new JTextField();
JLabel lblEnemyBotName = new JLabel();
7 changes: 5 additions & 2 deletions MekHQ/src/mekhq/gui/view/ContractSummaryPanel.java
Original file line number Diff line number Diff line change
@@ -117,8 +117,11 @@ private void initComponents() {

private void fillStats() {
//region Variable Initialization
// TODO : Switch me to use IUnitRating
String[] ratingNames = {"F", "D", "C", "B", "A"};
String[] ratingNames = {"A", "B", "C", "D", "F"};

if (campaign.getCampaignOptions().isReverseQualityNames()) {
ratingNames = new String[] { "F", "D", "C", "B", "A" };
}

// Initializing the GridBagConstraint used for Labels
// To use this you MUST AND ONLY overwrite gridy
8 changes: 6 additions & 2 deletions MekHQ/src/mekhq/gui/view/MissionViewPanel.java
Original file line number Diff line number Diff line change
@@ -557,8 +557,12 @@ private void fillStatsAtBContract() {
AtBContract contract = (AtBContract) mission;
Campaign campaign = gui.getCampaign();

// TODO : Switch me to use IUnitRating
String[] ratingNames = {"F", "D", "C", "B", "A"};
String[] ratingNames = {"A", "B", "C", "D", "F"};

if (campaign.getCampaignOptions().isReverseQualityNames()) {
ratingNames = new String[] { "F", "D", "C", "B", "A" };
}

lblStatus = new JLabel();
lblLocation = new JLabel();
txtLocation = new JLabel();

0 comments on commit 48fa065

Please sign in to comment.