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

Detect unsaved work #1685

Merged
merged 4 commits into from
Jan 9, 2025
Merged

Detect unsaved work #1685

merged 4 commits into from
Jan 9, 2025

Conversation

pavelbraginskiy
Copy link
Member

This enables MML to determine if a unit has unsaved changes, offering us two features: First, tabs now show a little * next to the unit name if the tab has unsaved work, and second, we don't show the "would you like to save your work" safety prompt for units which don't have any work to save.

This PR also contains a very small extra feature, which allows you to middle click tabs to close them, which might cause merge conflicts if it was in a separate PR.

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 2.13%. Comparing base (5875756) to head (f4991ab).
Report is 20 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##             master   #1685      +/-   ##
===========================================
- Coverage      2.13%   2.13%   -0.01%     
  Complexity      209     209              
===========================================
  Files           271     272       +1     
  Lines         31368   31441      +73     
  Branches       5339    5352      +13     
===========================================
  Hits            670     670              
- Misses        30541   30614      +73     
  Partials        157     157              

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

@pavelbraginskiy pavelbraginskiy changed the title Tabbed UI Detect unsaved work Jan 9, 2025
@@ -88,6 +91,11 @@ public MegaMekLabTabbedUI(MegaMekLabMainUI... entities) {
// Enable opening unit and mul files by drag-and-drop
setTransferHandler(new MMLFileDropTransferHandler(this));

// If you can think of a way to detect when the user makes a change to the entity, let me know.
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might be able to get by with a 'dirty' flag in the entity or something, but for now let's see how this works out.

@Sleet01 Sleet01 merged commit e131c7e into MegaMek:master Jan 9, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants