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

Add function to autosave the project #217

Merged
merged 4 commits into from
Apr 24, 2023
Merged

Conversation

pankern
Copy link
Contributor

@pankern pankern commented Mar 29, 2023

The autosaves are implemented here in a rolling backup fashion, such that the 10 most recent autosaves are kept. The autosaves don't overwrite the main save file. The changes include modifying the incSaveProject function in order to avoid adding the autosave files to the list of previous projects.

I thought it would be good to get this PR going with what I have now so I could incorporate feedback sooner rather than later.

Things not included in this PR that will likely still be needed:

  • Ability to turn the autosave feature on/off.
  • Ability to configure how many backups are kept.
  • Ability to configure how often to trigger the autosave.
  • Improve the performance of the filesave so that the program doesn't freeze as long during autosave. This might not be as important but I did notice it during testing.

Copy link
Member

@LunaTheFoxgirl LunaTheFoxgirl left a comment

Choose a reason for hiding this comment

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

There's a few changes I'd like to see with what's currently submitted and some ideas on where to go from there.

source/creator/package.d Outdated Show resolved Hide resolved
source/creator/package.d Show resolved Hide resolved
@pankern
Copy link
Contributor Author

pankern commented Apr 6, 2023

I have addressed most of the comments. One thing I haven't figured out yet is how to elegantly load any of the autosaves displayed in the menu. See the TODO I added to mainmenu.d.
I also still need to implement the user settings for the autosaves, but I think that will be quick and easy now that I have a better handle on more of the code.

@pankern pankern marked this pull request as ready for review April 7, 2023 04:41
@pankern
Copy link
Contributor Author

pankern commented Apr 7, 2023

I have completed the code for properly opening autosaves from the recents menu as well as implementing the user settings panel for controlling the autosave behavior. This is now ready for additional review.

@LunaTheFoxgirl
Copy link
Member

Could this PR be rebased on the latest commit? if so then I'll merge it @pankern

@LunaTheFoxgirl LunaTheFoxgirl added the Needs Rebase PR needs to be rebased to be merged. label Apr 24, 2023
@LunaTheFoxgirl LunaTheFoxgirl added this to the 0.8 milestone Apr 24, 2023
@pankern
Copy link
Contributor Author

pankern commented Apr 24, 2023

Ok, I will rebase this feature on the latest from main.

pankern added 4 commits April 24, 2023 13:28
- Separated out most of the autosave code into seperate files.
- Autosaves are now stored in the app data directory.
- Added a buffer list of the recent autosaves.
- Added a per-project lockfile to indicate if there may be data not yet saved to the main save file.
- Changed the autosave file name to include date and time.
- Added a popup window to prompt the user to restore from a backup when appropriate.
This is so that when we open an autosave from the recents menu, we can still correctly set the current project path to be the main save file instead of the autosave file, and the user can continue to press Ctrl+S to have changes saved in the expected location.
@pankern
Copy link
Contributor Author

pankern commented Apr 24, 2023

Rebase on the latest main is completed.

@LunaTheFoxgirl LunaTheFoxgirl merged commit 13485ee into Inochi2D:main Apr 24, 2023
@LunaTheFoxgirl LunaTheFoxgirl removed the Needs Rebase PR needs to be rebased to be merged. label Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants