Skip to content

Commit

Permalink
Merge pull request #5086 from IllianiCBT/qualityReport
Browse files Browse the repository at this point in the history
    Refined `PartQualityReportDialog` Layout Handling and Exclusions
  • Loading branch information
HammerGS authored Oct 21, 2024
2 parents 36e75a9 + dfc093f commit f930cec
Showing 1 changed file with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
*/
package mekhq.gui.dialog.reportDialogs;

import mekhq.MekHQ;
import megamek.client.ui.swing.util.UIUtil;
import mekhq.campaign.parts.Part;
import mekhq.campaign.parts.enums.PartQuality;
import mekhq.campaign.parts.equipment.AmmoBin;
import mekhq.campaign.unit.Unit;
import mekhq.utilities.ReportingUtilities;

Expand Down Expand Up @@ -51,6 +51,8 @@ public PartQualityReportDialog(final JFrame frame, final Unit unit) {
setTitle(String.format(resources.getString("PartQualityReportDialog.Unit.title"),
unit.getName()));
initialize();
pack();
setModal(true);
}
//endregion Constructors

Expand Down Expand Up @@ -87,6 +89,10 @@ private String getPartsReport(Unit unit) {

// Iterate over parts, assigning each to its location in the map.
for (Part part : unit.getParts()) {
if (part instanceof AmmoBin) {
continue;
}

String location = part.getLocationName() != null ? part.getLocationName() : unit.getName();
reportMap.computeIfAbsent(location, k -> new ArrayList<>()).add(part);
}
Expand All @@ -113,17 +119,18 @@ private String getPartsReport(Unit unit) {
String colorCode = unit.getQuality().getHexColor();

// Add the location and its colored quality rating to the report.
report.append("<span style=\"font-size: 18px;\">")
int headerFontSize = UIUtil.scaleForGUI(18);
report.append("<span style=\"font-size: ").append(headerFontSize).append("px;\">")
.append(location)
.append(" - ");
report.append("<span style=\"color: ")
.append(colorCode)
.append(";\">")
report.append("<span style=\"color: ").append(colorCode).append(";\">")
.append(unit.getQualityName())
.append("</span>");
report.append("</span>");
} else {
report.append("<span style=\"font-size: 12px;\">").append(location).append("</span>");
int headerFontSize = UIUtil.scaleForGUI(12);
report.append("<span style=\"font-size: ").append(headerFontSize).append("px;\">")
.append(location).append("</span>");
}
report.append("</b><br>");

Expand Down

0 comments on commit f930cec

Please sign in to comment.