Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Campaign Options IIC - Test Branch #4963

Draft
wants to merge 129 commits into
base: master
Choose a base branch
from

Conversation

IllianiCBT
Copy link
Collaborator

This draft PR is specifically to allow users to test Campaign Options IIC with different computer setups and operating systems, so we can identify and resolve issues early.

All text is placeholder.

This is not remotely suitable for general play, you won't even be able to progress beyond Campaign Options (by design).

Introduced a new dialog for selecting campaign presets within the campaign options. Updated `CampaignPreset` to include a `getTitle()` method and added resource strings for dialog configuration.
Eliminated the unused logger variable in SelectPresetDialog.java to reduce clutter. Additionally, formatted comments in CampaignPreset.java to improve readability and follow documentation standards.
Moved CampaignOptions and related classes to a new package structure under mekhq.campaign.campaignOptions. This improves code organization and clarity. Updated all references to reflect the new package structure.
Created 20 new empty classes under the campaignOptions and campaignOptions.panes packages. These classes will serve as placeholders for future implementation of various campaign option functionalities.
Renamed `campaignOptionsDialogController.java` to `CampaignOptionsDialogController.java` and implemented `CampaignOptionsDialogController` with added functionalities. Included new `GeneralTab` class for campaign's general settings and updated resources for localization.
Changed the package name of all campaign option classes from 'panes' to 'tabs' for consistency. Removed the empty `RepairAndMaintenance` class. Updated the `CampaignOptionsDialogController` to reflect these changes.
Enhanced campaign options dialog by adding a Repair and Maintenance tab. Implemented detailed options for repair and maintenance settings, including various checkboxes and spinners.
Replaced CampaignOptionsPane with CampaignOptionsDialogController to streamline campaign options management. Commented out methods related to the old pane's options handling to avoid conflicts. Added Javadoc comments to GeneralTab to improve code documentation.
Removed CampaignOptionsDialogController and replaced its functionality with CampaignOptionsPane and CampaignOptionsUtilities. This change aimed at modularizing the code, improving maintainability and readability. Updated relevant imports and class usages accordingly.
Removed the inheritance from AbstractMHQTabbedPane in RepairAndMaintenanceTab and GeneralTab. Adjusted constructors and methods to accommodate this change and updated utility imports to reflect the new package structure.
Moved CampaignOptionsPane to the "tabs" subpackage for better organization. Updated the import statements in relevant classes to reflect the new package path.
Reorganized properties and labels in various tabs. Introduced a new Supplies and Acquisition tab with Acquisition, Delivery, and Planetary Acquisition sub-tabs while maintaining existing functionality for Repair and Maintenance.
@IllianiCBT IllianiCBT added GUI Refactoring Campaign Options Relates to, or includes, campaign option changes labels Oct 2, 2024
@IllianiCBT IllianiCBT self-assigned this Oct 2, 2024
@IllianiCBT IllianiCBT marked this pull request as draft October 2, 2024 01:19
@codecov-commenter
Copy link

codecov-commenter commented Oct 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 10.13%. Comparing base (4a9cce8) to head (93c2ab0).
Report is 9 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4963      +/-   ##
============================================
- Coverage     10.43%   10.13%   -0.31%     
+ Complexity     6032     6026       -6     
============================================
  Files           952      964      +12     
  Lines        133878   137826    +3948     
  Branches      19436    19496      +60     
============================================
- Hits          13976    13971       -5     
- Misses       118560   122512    +3952     
- Partials       1342     1343       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

IllianiCBT and others added 4 commits October 1, 2024 20:29
Replaced the createLabeledSpinner method with distinct createSpinner and createLabel methods to simplify spinner creation. This change reduced redundancy by removing the need for label creation in spinner methods and updated relevant sections across multiple files. Additionally, the getDimensionWidthForComboBox and getDimensionWidthForButton helper methods were removed to streamline the codebase.
Removed explicit maximum width parameters in the createParentPanel method. Adjusted width handling to dynamically ensure a minimum width of 500 for the parent panels. Simplified the import statements by consolidating them. Deleted an unused utility method related to panel size calculation.
@repligator
Copy link
Collaborator

repligator commented Oct 2, 2024

Using Campaign Options IIC - Test #4139
General Impression(s): Looks good.

Very Minor Issues:

  • Nothing scales to the height of the window. If the user happens to have a very short monitor (640 pixels tall or so) they won't be able to access all the options.
  • There is no limit on the length used for the Unit Name. This may or may not cause issues latter on with other parts of MHQ.
  • Regenerate Name is awkwardly squished in its button.
  • The date field allows for entry of dates as early as 0001-01-01. Again, this may or may not cause issues with other parts of MHQ.
  • The Manual Modifier for Reputation will accept "-0" as a valid option. So will the Maintenance Modifier.

@IllianiCBT
Copy link
Collaborator Author

IllianiCBT commented Oct 2, 2024

For your first point, can you verify that a scroll bar appears for very short monitors?

Unit name works how it's always worked, as has manual modifier. If they weren't breaking stuff before they won't start. I hope :D Same for date field.

The regenerate name button issue should be fixed in the next test. However I can't be 100% certain without a screen grab

@repligator
Copy link
Collaborator

I don't see any scroll bars at all, regardless of size. I also can't scroll up or down with mouse wheel or the trackpad equivalent.
Screenshot_20241002_190926

Added new tabs for Combat Readiness, Human Resources, Unit Development, Logistics and Maintenance, and Strategic Operations to the Campaign Options Pane. Updated the resource file with corresponding titles for the new tabs. These changes enhance the structure and organization of the campaign options interface.
The TODO comments for creating various parent tabs in different sections were removed. This cleanup helps to reduce clutter and improves the readability of the code. It also indicates that the initial implementation for these tabs is complete.
Refactored the creation of campaign option tabs to use wrapper panels for better alignment and added decorative borders with contextual quotes. Also, centralized tab creation into a utility method for improved readability and maintainability of the code.
Updated Javadoc comments in CampaignOptionsPane.java to remove unnecessary link annotations and improve readability.
Replaced GroupLayout with GridBagConstraints in PersonnelTab and SalaryMultipliersPanel. This change provides more flexibility in component positioning and alignment, improving overall layout management. The modifications ensure that UI elements are better organized and maintainable.
The AdministratorsTab initialization was removed and its components were relocated. Also, reordered the layout of icons in the GeneralTab for better organization.
Inserted a quote "No job too tough, no fee too high!" into the campaign options UI for better user engagement. The quote was added as a new label at the bottom of the relevant panel.
# Conflicts:
#	MekHQ/docs/history.txt
This commit integrated a new "Random Backgrounds" panel into the Biography Tab. It included the UI elements and layout adjustments to accommodate the new panel, ensuring consistency with existing design patterns. All related properties and labels were also updated to support the new feature.
Revised grid layout configuration for PersonnelTab and BiographyTab to improve readability and maintainability. Moved component initialization and layout setup for better logical grouping and updated layout constraints to align with standard practices.
Eliminated the redundant boolean parameters from the `CampaignOptionsStandardPanel` and `CampaignOptionsGridBagConstraints` constructors to simplify the code. Adjusted the layout creation accordingly and made minor updates to related property labels and method documentation.
Updated the GUI layout for several panels to use GridBagLayout for enhanced flexibility and clarity. Adjusted scaling logic using `UIUtil.scaleForGUI` to ensure consistent UI appearance across different resolutions. Also made minor text label changes for better clarity.
Updated layout configurations in GeneralTab, BiographyTab, and CampaignOptionsUtilities to ensure consistency across panels. Replaced GroupLayout with GridBagConstraints in BiographyTab and adjusted layout settings for better alignment.
Replaced GroupLayout with GridBagLayout for more flexible and concise layout management. Simplified panel structure by removing unnecessary intermediate containers, which reduces code duplication and enhances readability.
Added the initialization of the Tech Limits Tab in EquipmentAndSuppliesTab and moved the initialization of the Rank Systems Pane in BiographyTab. This ensures that both tabs are set up correctly, improving the UI consistency and functionality.
Refactored the campaign options pane to use GridBagLayout for better alignment and consistent spacing. This change impacts multiple panels, providing a more maintainable and visually organized layout structure for the UI components.
private JSpinner spnPercentageRandomDeathChance;

private JPanel pnlDeathAgeGroup;
private Map<AgeGroup, JCheckBox> chkEnabledRandomDeathAgeGroups;

Check failure

Code scanning / CodeQL

Container contents are never accessed Error

The contents of this container are never accessed.
// Layout the Panel
final JPanel panelSystemPlanetOrigins = new CampaignOptionsStandardPanel(
"RandomOriginOptionsPanelSystemPlanetOrigins", false, "");
final GridBagConstraints layoutSystemPlanetOrigins = new CampaignOptionsGridBagConstraints(panelSystemPlanetOrigins);

Check notice

Code scanning / CodeQL

Unread local variable Note

Variable 'GridBagConstraints layoutSystemPlanetOrigins' is never read.

final JPanel panel = new CampaignOptionsStandardPanel("RandomOriginOptionsPanel", true,
"RandomOriginOptionsPanel");
final GridBagConstraints layout = new CampaignOptionsGridBagConstraints(panel);

Check notice

Code scanning / CodeQL

Unread local variable Note

Variable 'GridBagConstraints layout' is never read.
return createParentPanel(panel, "maintenanceTab");
}

private void recreateFinancesPanel(boolean isReversingQualityNames) {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'isReversingQualityNames' is never used.
return Math.round(intensity * 10.0) / 10.0;
}

private class AtBBattleIntensityChangeListener implements ChangeListener {

Check notice

Code scanning / CodeQL

Unused classes and interfaces Note

Unused class: AtBBattleIntensityChangeListener is not referenced within this codebase. If not used as an external API it should be removed.
Merged acquisition and delivery panels into a single tab for consistency and better user experience. Removed the redundant initialization and layout code, and updated related resource strings to reflect the changes.
Replaced GroupLayout with GridBagLayout for better control over component positioning and layout consistency across the Campaign Options tabs. Adjusted component placements and grid constraints accordingly to ensure all elements are arranged properly.
Separated the Repair and Maintenance tab into two panels using GridBagLayout. This change improves the layout structure and readability of the GUI code, making it easier to manage and extend in the future. Updated relevant properties file with new labels and tooltips.
Reorganized the layout configurations in PersonnelTab, EquipmentAndSuppliesTab, and CampaignOptionsUtilities to improve code readability and maintainability. Adjusted the use of GridBagConstraints and other layout constraints to ensure consistent GUI element alignment and spacing.
Replaced GroupLayout with GridBagLayout for improved readability and maintainability. This change also standardized the panel layout code and simplified adding components to the panel.
Renamed `spnDamageMargin` to `spnMaintenanceDays` in `RepairAndMaintenanceTab.java` for clarity and consistency. Additionally, rearranged UI elements to properly display `spnMaintenanceDays` and added new maintenance logging component.
Reset the gridx value before adding lblMaintenanceBonus. This ensured that the layout of the panel elements aligned correctly, avoiding UI misalignment in the campaign options.
Replaced GroupLayout with GridBagLayout in various panels within FinancesTab.java for improved layout management. Adjusted the positions and alignments of UI components to maintain the visual structure. Updated properties file for Strategic Operations tab title.
Replaced GroupLayout with GridBagLayout in `MarketsTab` and related panels. Simplified the layout management, making the panels more flexible and easier to maintain. Adjusted constraints and component placements to ensure a consistent user interface.
Revised layout configurations to consistently use GridBagLayout across various campaign options tabs. This ensures uniformity in the layout management and improves maintainability of the UI code.
Changed "General Information" to "General" for the general panel title in the campaign options dialog. This makes the title more concise and aligns with the naming convention of other panels.
Changed the "Unit Development" tab title to "Advancement" in the campaign options dialog. This update makes the tab name more concise and better reflects its content. It also ensures consistency with the naming convention of other panels.
Clarified the categorization of skills in the comments section by adding "Combat Skills," "Non-Combat Skills," and "Roleplay Skills." This improves code readability and provides better insight into the skill classification system.
Renamed the "unitDevelopmentParentTab" to "advancementParentTab" and introduced the new "AdvancementTab" class. Added comprehensive components for managing experience awards and skill randomization within the advancement tab, enhancing the campaign options functionality.
Deleted unused JLabel and JSpinner variables associated with XP cost multipliers to clean up the code. This reduces memory footprint and potentially improves maintainability and readability.
Included a new XP Cost Multiplier label and spinner in the AdvancementTab. Updated the layout to accommodate these new components and added corresponding entries in the resource file.
# Conflicts:
#	MekHQ/unittests/mekhq/gui/dialog/nagDialogs/UnableToAffordJumpNagDialogTest.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Campaign Options Relates to, or includes, campaign option changes GUI Refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants