-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Recover file work over #2176
Recover file work over #2176
Conversation
undefined reference to `MainWindow::recoverSessionCleanup()' ... ? Yeah, I didn't think the last one would pass. I need some feedback here. void recoverSessionCleanup()
{
// delete recover session files
QFile::remove( ConfigManager::inst()->recoveryFile() );
QFile::remove( ConfigManager::inst()->recoveryFile() + ".bak" );
QFile::remove( ConfigManager::inst()->recoverSessionFile() );
} void MainWindow::closeEvent( QCloseEvent * _ce )
{
if( mayChangeProject(true) )
{
if( isRecoverSession() )
{
recoverSessionCleanup();
}
_ce->accept();
}
else
{
_ce->ignore();
}
} Travis says:
|
0024a55
to
44a1a4d
Compare
I squashed it down to two commits and reverted to the last working state by commenting out the function above, recoverSessionCleanup() .
What doesn't work? |
By the way, it looks like all you need to do is change void recoverSessionCleanup()
{
[...]
} to void MainWindow::recoverSessionCleanup()
{
[...]
} |
You mean like ALL the other functions... :-P |
@Wallacoloo Thanks! Now I have a working patch for the recovery file. It turned out to need a little bit more than the 5 - 10 lines I was hoping for but there are many places to exit an ongoing project and you need to cover all those events. What I've done is create a file RECOVER which lets other instances know that they don't need to care about recover.mmp. There is also a bool m_recoverSession which we set to make LMMS aware of that it is doing recover work. We can check session state whith 'MainWindow::isRecoverSession()'
Issues:
|
This is now a working fix for #2174 and is best described here #2176 (comment) |
"Open" might be misleading.... As an example, here's what VIM says:
-Tres |
BTW, I'm not a fan of the |
I scavenged among the default buttons. I haven't looked into adding custom buttons to QMessageBox yet,
OK. I'm not too happy about the extra file either but it kind of work. I can just remove it and have a more general message like the one from VIM about the dire consequences of running multiple instances. |
There is a one line fix for this that does exactly what the title proposes. This would mean you wouldn't be able to just open and close recover.mmp and it's gone, which was what triggered the bug report in the first place. We could do this for 1.2 and do a more complete fix later. Being in a freeze and all. I think however it's a good idea to really have separate messages. |
Simplified. File RECOVER is gone as is the new Messagebox. Changes in summary:
|
"unsaved and will be lost if you don't " | ||
"Save it. Do you want to save it now?" ); | ||
|
||
QString messageTitleUnsaved = tr( "Project not saved" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens with the already translated strings "Project not saved" and "The current project..." when I move it to a variable? I didn't change the text. Do I need to do anything to link it to the old string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the strings are translated at creation time by using tr() it should be Ok. You can then copy to an other variable because the content is already translated.
So this should work as expected :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks! 8)
Here's the messagebox in master. I've struck a somewhat odd problem. If you try and close the messagebox with the [x] recover.mmp is discarded. In a basic messagebox the closeEvent() isn't defined so you have to take care of this yourself but in the simpler version of messagebox with default buttons closeEvent() takes care of closing the window just fine but also seem to return the enum of the button with the highest value. OK is lowest...: |
Buttons renamed. I changed 'escape/close' button to a new 'close' button instead of as today, 'no' (discard). |
"Close" may be a but confusing, as it is often associated with the closing of a dialog... |
Quit or Abort then? |
Yeah... I think. Quit, or Quit LMMS. Quit LMMS seems a bit overkill, but the action is clear. We could use a wildcard to replace LMMS with application name too, if desired. |
I prefer Quit over Quit LMMS then.
You lost me there. What other app? |
Oh, I just meant the global name "LMMS" to prevent hard-coding. |
I've reimplemented the possibility to open a limited session without autosave that was lost with the file RECOVER. I'm not happy with the name 'Open' for the button though. |
I think 'Ignore' would be a good name for that button. |
That's better yes. |
Closing the messagebox ( Escape / [x] / Alt+F4 ) right now defaults to 'Quit'. With the new button perhaps Ignore should be the default response? |
ff08551
to
3183f92
Compare
Merge conflicts fixed. I'm looking into the suggested improvements now. |
OK. I swapped the bools for a session state int/enum. Edit2! The "enum SessionState" commit isn't working (crashes). |
I haven't been able to repeat the crashes I saw. It seem to work as intended. I disabled 'open last project' on limited session as the last project in this case probably was the crashed one and should be opened with recover. |
@tresf @Wallacoloo |
Thanks. Much cleaner with the enum state. I only had one comment to make. Interested in hearing from @Wallacoloo. |
26e43c7
to
9024f5a
Compare
Squashed and done. I've updated the Issue/OP. |
9024f5a
to
bd73c6d
Compare
Just a last minute tweak. I changed the name of function recoverSessionCleanup() to sessionCleanup() . |
@tresf I think I'm done here. I've found other things related to the auto save function to work on but I think it's probably better to get this committed and start from a fresh pull request. |
@zonkmachine much cleaner, thanks. I'll give some time for final comments prior to merging. |
bd73c6d
to
9e80207
Compare
@tresf @Wallacoloo @Umcaruje |
@zonkmachine sorry for the delay. Merging, adding to 1.2 changelog. 👍 |
RC3 -An unwanted change has sneaked in. I have several times had lmms 'stagger' during song-editor replay, and if i emediately after such a stagger, look at the recover.mmp, is has that exact timestamp. This mean that the protection against making a recover-file during replay, no longer works in RC3 |
Thanks, looking into it. |
🤡 o ..m ..g 🤡 + 😊 |
No. But the default is that both options are on. In your case you need to set this off every time you have a brand new .lmmsrc.xml |
@zonkmachine I dont like that descission. That feature should not be on in replay as default.
|
Fixes issue: #2174
Edit: I've started a feedback thread in the forum https://lmms.io/forum/viewtopic.php?f=15&t=3479
In summary: Multiple fixes for the recovery file system that introduces clear session states for LMMS.
It won't allow overwriting of
recover.mmp
if you run multiple instances but it will only do autosave for the first instance of LMMS launched.Bugs and fixes!
I fix this by defaulting 'Escape' to button 'Exit' instead close the app.
I solve this by introducing the limited session, that will be set if the user press 'Ignore' at the recovery dialogue. This allows you to launch another session that doesn't write to recover.mmp. This way LMMS will launch a slightly limited session which simply turns off autosave for this instance. This together with running autosave() the first thing of all (described below) should minimise the risk of recover.mmp being overwritten.
MainWindow::autosave()
in main() once as a very last step after loading a project, but only if there is no recover file present. For this to work I made MainWindow::autosave() public.I know it's not 100% what users have asked for but it is a solid solution for recover files which has no uncertain states and is hopefully clear enough to use. It's intended as a modification/bugfix for the upcoming 1.2 release.
Separate files for multiple sessions as has been in demand will most likely have to wait until later.
The actual action of the MainWindow::autosave() when it's running however will be one of my next areas to look at.
Last updated on 15 Dec 2015