diff --git a/include/autosave.h b/include/autosave.h index 0b8785c8cb60662c896a34aaecff45d0dc7cfad7..06ac28684eb6279bda9d3901fc4b5505dfc43cf1 100644 --- a/include/autosave.h +++ b/include/autosave.h @@ -1,3 +1,23 @@ +/* + * PeTrack - Software for tracking pedestrians movement in videos + * Copyright (C) 2010-2021 Forschungszentrum Jülich GmbH, + * Maik Boltes, Juliane Adrian, Ricardo Martin Brualla, Arne Graf, Paul Häger, Daniel Hillebrand, + * Deniz Kilic, Paul Lieberenz, Daniel Salden, Tobias Schrödter, Ann Katrin Seemann + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef AUTOSAVE_H #define AUTOSAVE_H diff --git a/src/autosave.cpp b/src/autosave.cpp index 8e66f958aca9a842e6fd153ae86cf6e21bbbcfd2..15b7d3caaadc73e339088e6dbc5128a3754f05e4 100644 --- a/src/autosave.cpp +++ b/src/autosave.cpp @@ -1,3 +1,23 @@ +/* + * PeTrack - Software for tracking pedestrians movement in videos + * Copyright (C) 2010-2021 Forschungszentrum Jülich GmbH, + * Maik Boltes, Juliane Adrian, Ricardo Martin Brualla, Arne Graf, Paul Häger, Daniel Hillebrand, + * Deniz Kilic, Paul Lieberenz, Daniel Salden, Tobias Schrödter, Ann Katrin Seemann + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #include "autosave.h" #include "petrack.h" @@ -62,8 +82,6 @@ void Autosave::deleteAutosave() */ void Autosave::loadAutosave() { - // TODO: Rename autosave to name from save and then load it?!?! Needs to have a different name than autosave, or - // does it? auto autosaveFiles = getAutosave(); if(autosaveFiles.empty()) { @@ -156,6 +174,7 @@ void Autosave::savePet() mPetrack.saveProject(autosaveName); mPetrack.setProFileName(proFileName); + // first save to temp file, so crash during saving doesn't corrupt old autosave QString finalAutosaveName = buildAutosaveName(projectName, ".pet"); QFile tempAutosave{autosaveName}; QFile autosave{finalAutosaveName}; @@ -188,6 +207,7 @@ void Autosave::saveTrc() mPetrack.exportTracker(autosaveName); mPetrack.setTrackFileName(trackFileName); + // first save to temp file, so crash during saving doesn't corrupt old autosave QString finalAutosaveName = buildAutosaveName(projectName, ".trc"); QFile tempAutosave{autosaveName}; QFile autosave{finalAutosaveName};