#2819 closed defect (fixed)
[PATCH][ATLAS]Add a unsaved changes check on exiting Atlas
Reported by: | Niek | Owned by: | trompetin17 |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 18 |
Component: | Atlas editor | Keywords: | |
Cc: | Patch: |
Description (last modified by )
It would be nice to ask for confirmation on exiting Atlas if there are unsaved changes (and it saves me for wasting more hours on Scenario Designing just because I forgot to save the map :))
Attachments (7)
Change History (24)
comment:1 by , 10 years ago
Description: | modified (diff) |
---|
by , 10 years ago
Attachment: | 2819.patch added |
---|
comment:2 by , 10 years ago
Keywords: | review patch added |
---|---|
Summary: | [ATLAS]Add a unsaved changes check on exiting Atlas → [PATCH][ATLAS]Add a unsaved changes check on exiting Atlas |
comment:3 by , 10 years ago
Description: | modified (diff) |
---|
comment:4 by , 10 years ago
comment:5 by , 10 years ago
I think this is a proper way to handle the behavior suggested above:
- Keep track of the undo history.
- Mark the first map state as the initial state (this is the state when you just loaded the map, without any changes.
- If you save the map, mark that state as the saved state. If the saved state is not present in the undo history (either because you didn't save the map yet or because you undo-ed and made changes again) don't care about it (no need to check the file system if the current state is exactly the state of the saved map). If it isn't in the undo history you won't realistically reach the exact state (without reloading the map) anyway.
comment:6 by , 10 years ago
Keywords: | review removed |
---|
After looking more closely at the code, I think niektb's suggestion is better.
Indeed, you had to add manually a notification to the editor for each change, so if someone adds a new way to change the map, they'll have to add this notification too. I think the undo/redo approach is saner.
About the style, I'll just suggest some English changes, and I'll review seriously the future version of the patch, as you'll have to change a significant part of your code.
m_changesWithoutSave
->m_needsSave
or something like this- "The map has not been saved... continue closing?" -> "You have unsaved changes. Are you sure you want to quit?" is more standard
- "Please confirm" -> "Discard unsaved changes?" is also more standard
¡Gracias por trabajar sobre eso! ;-)
by , 10 years ago
Attachment: | 2819_III.patch added |
---|
by , 10 years ago
Attachment: | 2819_III.2.patch added |
---|
comment:8 by , 9 years ago
Keywords: | review added |
---|
comment:9 by , 9 years ago
Type: | task → defect |
---|
Ok, I tested the patch. I really like how it is now, just some style comments:
- Beware the trailing spaces on lines 581, 748, 773, 788
- your comments "change the flag" are useless, and I'd write "Check for unsaved changes" on line 572 (also please write
//(space)Your text
)
Now, about the functionality, you should also perform the check when opening another map, or when creating a new one, etc. After that I think it will be ok :)
comment:10 by , 9 years ago
Itms, could you re-check, i added some configuration in my xcode about "indentation", hope this help.
And about functionality i added a check in "OnOpen", "OnMRUFile" and "OnImportHeightmap".
by , 9 years ago
Attachment: | 2819_dic.diff added |
---|
by , 9 years ago
Attachment: | 2819_dic.2.diff added |
---|
comment:12 by , 9 years ago
by , 9 years ago
Attachment: | 2819_dic.3.diff added |
---|
comment:15 by , 9 years ago
by , 9 years ago
Attachment: | 2819_dic.4.diff added |
---|
The patch provided by trompetin17 works as expected. Modify the map and you'll get a confirmation box when you're trying to exit with unsaved changes. There is one thing I however want to add, if you undo all the way back to a saved state it still comes up with that warning (while technically it is saved, it only is modified and reverted afterwards)