Skip to content

Commit

Permalink
Added tooltips and improved mission panel layout.
Browse files Browse the repository at this point in the history
Introduced tooltips to several labels in the MissionViewPanel to enhance user guidance with morale information. Adjusted GridBag layout configurations for better UI alignment and positioning. Also, changed the calculation of targetCargoTonnage to use a constant multiplier for better maintainability.
  • Loading branch information
IllianiCBT committed Dec 6, 2024
1 parent 33c87ce commit b84b44b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion MekHQ/resources/mekhq/resources/Resupply.properties
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ contractStartMessageGuerrilla.text=%s, for this contract it won't be safe to est
usePlayerConvoyOptional.text=%s, our employer has a delivery ready for us but is offering to expand\
\ it if we supply our own transports.\
<br>\
<br>This delivery requires a total of %s tons of cargo space across all convoys. We currently\
<br>This enhanced delivery requires a total of %s tons of cargo space across all convoys. We currently\
\ have a total of %s available space across %s convoy%s. Any excess space will be used to help\
\ resupply allied forces operating in this AO. Damaged or uncrewed vehicles are not considered\
\ available.\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1722,8 +1722,8 @@ public void getResupply(int dropCount, boolean bypassConvoyNeeds, boolean isLoot
return;
}

if (!isIndependent && usePlayerConvoy) {
targetCargoTonnage = targetCargoTonnage * 2;
if (usePlayerConvoy) {
targetCargoTonnage = targetCargoTonnage * CARGO_MULTIPLIER;
}

if (!isLoot) {
Expand Down
19 changes: 12 additions & 7 deletions MekHQ/src/mekhq/gui/view/MissionViewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ public void mouseClicked(MouseEvent e) {
if (campaign.getCampaignOptions().isUseShareSystem()) {
lblSharePct.setName("lblSharePct");
lblSharePct.setText(resourceMap.getString("lblSharePct.text"));
lblSharePct.setToolTipText(wordWrap(contract.getMoraleLevel().getToolTipText()));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = y;
Expand All @@ -971,10 +972,12 @@ public void mouseClicked(MouseEvent e) {

txtSharePct.setName("txtSharePct");
txtSharePct.setText(contract.getSharesPercent() + "%");
txtSharePct.setToolTipText(wordWrap(contract.getMoraleLevel().getToolTipText()));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = y++;
gridBagConstraints.gridwidth = 1;
gridBagConstraints.weightx = 0.5;
gridBagConstraints.insets = new Insets(0, 10, 0, 0);
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
pnlStats.add(txtSharePct, gridBagConstraints);
Expand All @@ -983,20 +986,22 @@ public void mouseClicked(MouseEvent e) {
if (campaign.getCampaignOptions().isUseStratCon()) {
lblCargoRequirement.setName("lblCargoRequirement");
lblCargoRequirement.setText(resourceMap.getString("lblCargoRequirement.text"));
lblCargoRequirement.setToolTipText(wordWrap(contract.getMoraleLevel().getToolTipText()));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = y++;
gridBagConstraints.gridwidth = 1;
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.gridy = y;
gridBagConstraints.fill = GridBagConstraints.NONE;
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
pnlStats.add(lblCargoRequirement, gridBagConstraints);

txtCargoRequirement.setName("txtCargoRequirement");
txtCargoRequirement.setText(getEstimatedCargoRequirements(campaign, contract));
txtCargoRequirement.setToolTipText(wordWrap(contract.getMoraleLevel().getToolTipText()));
gridBagConstraints = new GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = y++;
gridBagConstraints.gridwidth = 1;
gridBagConstraints.weightx = 0.5;
gridBagConstraints.insets = new Insets(0, 10, 0, 0);
gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
gridBagConstraints.anchor = GridBagConstraints.NORTHWEST;
pnlStats.add(txtCargoRequirement, gridBagConstraints);
Expand Down

0 comments on commit b84b44b

Please sign in to comment.