Evaluate active flag on gcode analyzer AFTER fetching an item from the work queue, otherwise it will always start working once it finds something if the active flag was true once but then switched to false while the queue was still empty. Thanks to @Salandora for spotting this.
Fixes#357
(manually cherry-picked from 592f3dc)
When re-uploading a file with characters that will be later sanitized,
the old metadata entry wasn't removed because it checked the unsane
filename rather than the sanitized version that will later be stored.
This was creating an inconsistent metadata view during analysis for
files with spaces in them.
Now UI and backend take data from saved metadata (if available). Metadata gets written after file upload and also on startup (for files that have not been added yet). Gcode analysis is interrupted if a printjob is started and resumed when it ends. Frontend is notified when new metadata comes available and UI triggers reload of gcode file list. Also started on implementing proper logging.