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 61 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.20%. Comparing base (fb4b93d) to head (8af5dec).
Report is 36 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4963      +/-   ##
============================================
- Coverage     10.44%   10.20%   -0.25%     
- Complexity     6015     6033      +18     
============================================
  Files           950      971      +21     
  Lines        133511   136986    +3475     
  Branches      19400    19487      +87     
============================================
+ Hits          13948    13981      +33     
- Misses       118217   121658    +3441     
- Partials       1346     1347       +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.
Updated the reference from imagePanel to headerPanel across multiple tabs to ensure consistent header naming conventions. Adjusted alignment for headerPanel components to CENTER for better UI consistency. Enhanced panel dimensions setup to improve layout appearance. Standardized label text formatting by removing HTML tags.
Condensed multi-line quotes into single lines in the properties file to improve consistency. Updated the UI code to enhance the layout and presentation of the quotes in the campaign options dialog.
Renamed 'Personnel Tab' as 'Human Resources Tab' and included tooltips and checkboxes for various options. Added new Life Paths tab with General and Background sub-tabs, introducing options for random gender, family display, random personalities, and origins.
Introduced a new Marriage Tab in the Life Paths configuration panel, including options for manual, clan personnel, and prisoner marriages. Enhanced random marriage settings with various input components and panels to customize marriage characteristics, logging, and random generation methods. Adjusted spinners in CampaignOptionsUtilities to align text to the left for improved readability.
Included a new Divorce tab with various settings such as manual, clan personnel, and prisoner divorces, along with random divorce configurations. Updated the campaign options pane to integrate the new tab and revised related resource files.
Implemented a new procreation tab in the LifePathsTab with various divorce options, including manual, clan personnel, and prisoner divorces. Updated the campaign options dialog properties to reflect the inclusion of new relationship categories for marriage and divorce.
Implemented a new Procreation Tab in the Campaign Options dialog. This includes various settings related to manual, clan, and random procreation methods, as well as options for managing offspring attributes and maternity leave.
Introduced a new Death tab in the Campaign Options pane, including various settings for simulating character deaths such as random death methods and death by age group. Implemented corresponding UI components and placeholders in the properties file.
Renamed TurnoverAndRetention.java to TurnoverAndRetentionTab.java to better reflect its extended functionality. Added comprehensive GUI elements for configuring turnover and fatigue settings, including numerous panels, checkboxes, labels, and spinners. Enhanced the structure and layout using Swing components to provide a detailed and user-friendly experience.
Replaced HTML tags with plain text in various labels to improve readability and maintain consistency across the user interface. Also updated component creation and layout handling in PersonnelTab.java to ensure proper alignment and sizing of labels and spinners.
Renamed relationship-related tabs and integrated a comprehensive Education tab. This includes various education settings such as XP rates, dropout chances, and accident rates, as well as new configuration panels and controls.
Added a new label to display the entrance exam modifier in the LifePathsTab for better clarity. Also updated the properties file to accommodate this new label and adjusted related UI components accordingly.
Created a new `RelationshipsTab` class in the campaign options GUI, featuring separate tabs for marriage, divorce, and procreation settings. Each tab includes options for manual, clan personnel, and prisoner actions, along with configurations for randomization.
This file was no longer needed and its presence could cause confusion. The removal helps in maintaining a cleaner and more understandable codebase.
Updated method visibility to private in several campaign options tabs to encapsulate functionality and improve code maintainability. This change affects multiple panels related to relationships, supplies, biographies, repairs, turnovers, technical limits, and more.
Introduced a new "Name and Portrait Generation" tab in campaign options. This includes functionality for assigning names based on origin faction and managing portrait generation/settings. Updated related UI components and properties accordingly.
Implemented a new Rank System tab in the campaign options and adjusted various panel dimensions from 500px to 750px for better layout consistency. Removed redundant instruction text for rank systems to streamline the user interface.
Copy link
Member

@SJuliez SJuliez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My 2 cents. Visually, this is very nice.

final GroupLayout layout = createStandardLayout(panel);
panel.setLayout(layout);

layout.setVerticalGroup(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GroupLayout and GridBagLayout are intended for use with UI creator programs. They are very powerful and exact but produce verbose and ugly code. Also, they are rather robotic, hence for UI creators.
The other layout managers require some more intuition (and experience) to use but usually need less cluttersome code to achieve the same result (here, panel = Box.createVerticalBox(); and add the three components would more or less do it)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to stick with GroupLayout, because I have no freaking clue what other options exist in our suite, let alone how to use them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np. Nothing special in our suite, it's just Swing's FlowLayout, GridLayout, Box(Layout), BorderLayout

quotePanel.add(quote);

// Reorganize mainPanel to include quotePanel at bottom
JPanel contentPanel = new JPanel(new BorderLayout());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

layout intuition used :)

The Javadoc was added to the createRankTab method to describe its purpose and functionality. Also, a variable name in the layout setup was changed for better readability. This improves the code documentation and clarity for future maintenance.
Reorganized initialization of components into separate methods for better readability and maintainability. This change involves splitting the initialization logic for each tab into distinct methods across multiple files, enhancing code modularity.
Renamed the biographyTab class and its references to BiographyTab to follow Java naming conventions. Updated Javadocs and comments to reflect the new class name and added an explanatory class header.
Refactored various campaign option tabs to use cleaner and more consistent styles. Eliminated HTML tags in labels, standardized panel creation methods, and integrated utility scaling methods where necessary. This improves readability, maintainability, and ensures UI scalability.
Removed a non-informative comment from CampaignOptionsUtilities.java for cleaner code. Simplified JScrollPane constructor usage in CampaignOptionsPane.java by using default scrollbar policy.
Corrected the order of combo and label components to ensure proper alignment in the UI layout. This change enhances the readability and consistency of the user interface.
return createParentPanel(panel, "maintenanceTab");
}

private void recreateFinancesPanel(boolean isReversingQualityNames) {

Check notice

Code scanning / CodeQL

Useless parameter Note

The parameter 'isReversingQualityNames' is never used.
IllianiCBT and others added 2 commits October 11, 2024 14:31
Simplified the font size initialization by using a constant and added error handling for missing UI scale property. This ensures consistent font size usage across tabs and improves code readability and robustness.
also a few boards
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