{"action":"created","issue":{"url":"https://api.github.com/repos/LMMS/lmms/issues/2176","labels_url":"https://api.github.com/repos/LMMS/lmms/issues/2176/labels{/name}","comments_url":"https://api.github.com/repos/LMMS/lmms/issues/2176/comments","events_url":"https://api.github.com/repos/LMMS/lmms/issues/2176/events","html_url":"https://github.com/LMMS/lmms/pull/2176","id":94174271,"number":2176,"title":"Recover file work over","user":{"login":"zonkmachine","id":6368949,"avatar_url":"https://avatars.githubusercontent.com/u/6368949?v=3","gravatar_id":"","url":"https://api.github.com/users/zonkmachine","html_url":"https://github.com/zonkmachine","followers_url":"https://api.github.com/users/zonkmachine/followers","following_url":"https://api.github.com/users/zonkmachine/following{/other_user}","gists_url":"https://api.github.com/users/zonkmachine/gists{/gist_id}","starred_url":"https://api.github.com/users/zonkmachine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zonkmachine/subscriptions","organizations_url":"https://api.github.com/users/zonkmachine/orgs","repos_url":"https://api.github.com/users/zonkmachine/repos","events_url":"https://api.github.com/users/zonkmachine/events{/privacy}","received_events_url":"https://api.github.com/users/zonkmachine/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":39,"created_at":"2015-07-09T23:24:25Z","updated_at":"2015-07-20T01:30:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/LMMS/lmms/pulls/2176","html_url":"https://github.com/LMMS/lmms/pull/2176","diff_url":"https://github.com/LMMS/lmms/pull/2176.diff","patch_url":"https://github.com/LMMS/lmms/pull/2176.patch"},"body":"Fixes issue: #2174 and touches upon #181\r\n\r\nIn summary: Multiple fixes for the recovery file system that introduces clear session states for LMMS.\r\nIt 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. \r\n\r\n![recovernew](https://cloud.githubusercontent.com/assets/6368949/8768816/2e32b088-2e8d-11e5-9014-3f93cef4f662.png)\r\n\r\n---\r\n\r\nWhen starting if you escape from the recover message the default is to delete recover.mmp  This is probably not expected or wanted behaviour for everyone. Escaping from the dialogue had better be non destructive.\r\nI fix this by defaulting 'Escape' to button 'Exit' instead close the app. Another option would be 'Ignore' and open a limited session (explained below).\r\nFixed in: c5f00eae58f21e6a73eada2b5e48cf548faace64\r\n\r\nIf you press yes to recover and immediately shut down LMMS you will not be asked any questions and recover.mmp is deleted. This is a bit rough. I think it's better to treat recover.mmp as 'is changed' from the very start of the session. You could solve this part by executing  add ```Engine::getSong()->setModified();```\r\nafter loading recover.mmp in main(). One simple line, but I don't think it will work that well as you would need separate messages on closing, and I think this is really important, depending on if the file is a modified project or a recovered one. To fix this I introduce a new variable in MainWindow: ```m_recoverSession``` which is set in main() upon loading recover.mmp\r\nFixed in: 1649e291bb389c888bd2026492933fa48c86711c\r\n\r\nIf you run multiple sessions of LMMS they will simply take turns to write over recover.mmp  :P\r\nI solve this by introducing another new variable ```bool m_isAutoSaveEnabled``` ( I'm contemplating renaming it to ```m_limitedSession``` to keep with the line of sessions. It is also a more general name and can fit other roles and it simply sounds better ) that will be set if the user press 'Ignore'. 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.\r\nFixed in: ed25a36eeff4b794786a57484ee74aab4b80f353\r\n\r\nOn starting LMMS the autosave() function takes a minute to kick in. This is problematic especially since the introduction of different sessions, because this minute of no backup file is actually a logic state of it's own that an LMMS session can be in. And it's an ill defined one. We take care of this by executing ```MainWindow::autosave()``` in main() once as a very last step after loading a project, but only if there is no\r\nrecover file present. For this to work I made MainWindow::autosave() public.\r\nFixed in: b9927dc878a48462e68d9802a825228932c44028\r\n\r\nClarity. It's quite easy to fix some of the problems mentioned with a bunch of one line hacks, and I love them one liners, but in the end that would be a dead end. I feel strongly that you need separate messages for modified and recovered projects upon closing a file. You can for instance set the project as modified on launch from main() but depending on the project it wouldn't necessarily differ from a new default project\r\nat a first glance. It's unclear and doesn't look professional. A dead end.\r\nFixed in: 1649e291bb389c888bd2026492933fa48c86711c\r\nWhere I introduce separate messages depending on type of session and in\r\ncommit: ce3c83d07ddb237db1b2d4056ef3b3d7622c07ae\r\nWhich sets the window title for recover sessions and in.\r\ncommit: ed25a36eeff4b794786a57484ee74aab4b80f353 \r\nwhich is mentioned earlier which also tweaks the main window title, signalling\r\nthat the auto save function is disabled.\r\n\r\nI 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.\r\nSeparate files for multiple sessions as has been in demand will most likely have to wait until later.\r\nThe actual action of the MainWindow::autosave() when it's running however will be one of my next areas to look at.\r\n\r\nLeft to do?\r\nHopefully just testing and tweaks on the messages/visible text and the recover qmessagebox layout.\r\nThen squashing some.\r\nI'm looking into using HTML for the layout as qmessagebox handles it but it needs to work with the translation functions too and I'm not sure how much work is needed to get it off ground. It looks good though. https://github.com/LMMS/lmms/pull/2176#issuecomment-122659720 The layout is now done simply with tabs and newlines and it was functional enough but hardly suitable for translation.\r\n\r\nEdit: Updated summary!"},"comment":{"url":"https://api.github.com/repos/LMMS/lmms/issues/comments/122726786","html_url":"https://github.com/LMMS/lmms/pull/2176#issuecomment-122726786","issue_url":"https://api.github.com/repos/LMMS/lmms/issues/2176","id":122726786,"user":{"login":"zonkmachine","id":6368949,"avatar_url":"https://avatars.githubusercontent.com/u/6368949?v=3","gravatar_id":"","url":"https://api.github.com/users/zonkmachine","html_url":"https://github.com/zonkmachine","followers_url":"https://api.github.com/users/zonkmachine/followers","following_url":"https://api.github.com/users/zonkmachine/following{/other_user}","gists_url":"https://api.github.com/users/zonkmachine/gists{/gist_id}","starred_url":"https://api.github.com/users/zonkmachine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zonkmachine/subscriptions","organizations_url":"https://api.github.com/users/zonkmachine/orgs","repos_url":"https://api.github.com/users/zonkmachine/repos","events_url":"https://api.github.com/users/zonkmachine/events{/privacy}","received_events_url":"https://api.github.com/users/zonkmachine/received_events","type":"User","site_admin":false},"created_at":"2015-07-20T01:30:55Z","updated_at":"2015-07-20T01:30:55Z","body":"I updated the first post to sum up the work so far."}}