diff options
author | Ethan Yonker <dees_troy@teamw.in> | 2016-02-25 20:47:30 +0100 |
---|---|---|
committer | Dees Troy <dees_troy@teamw.in> | 2016-03-31 16:44:24 +0200 |
commit | 472f506817bb1af2fceb039ba148d15723944562 (patch) | |
tree | 187516086121c42b1b671f69b4fc252fe5498b1c /progresstracking.hpp | |
parent | DataManager Updates (diff) | |
download | android_bootable_recovery-472f506817bb1af2fceb039ba148d15723944562.tar android_bootable_recovery-472f506817bb1af2fceb039ba148d15723944562.tar.gz android_bootable_recovery-472f506817bb1af2fceb039ba148d15723944562.tar.bz2 android_bootable_recovery-472f506817bb1af2fceb039ba148d15723944562.tar.lz android_bootable_recovery-472f506817bb1af2fceb039ba148d15723944562.tar.xz android_bootable_recovery-472f506817bb1af2fceb039ba148d15723944562.tar.zst android_bootable_recovery-472f506817bb1af2fceb039ba148d15723944562.zip |
Diffstat (limited to 'progresstracking.hpp')
-rw-r--r-- | progresstracking.hpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/progresstracking.hpp b/progresstracking.hpp new file mode 100644 index 000000000..15cf91c28 --- /dev/null +++ b/progresstracking.hpp @@ -0,0 +1,54 @@ +/* + Copyright 2016 bigbiff/Dees_Troy TeamWin + This file is part of TWRP/TeamWin Recovery Project. + + TWRP 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. + + TWRP 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 TWRP. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __PROGRESSTRACKING_HPP +#define __PROGRESSTRACKING_HPP + +#include <time.h> + +// Progress tracking class for tracking backup progess and updating the progress bar as appropriate +class ProgressTracking +{ +public: + ProgressTracking(const unsigned long long backup_size); + + void SetPartitionSize(const unsigned long long part_size); + void SetSizeCount(const unsigned long long part_size, unsigned long long f_count); + + void UpdateSize(const unsigned long long size); + void UpdateSizeCount(const unsigned long long size, const unsigned long long count); + + void DisplayFileCount(const bool display); + void UpdateDisplayDetails(const bool force); + +private: + unsigned long long total_backup_size; // Overall size (for the progress bar) + + unsigned long long partition_size; // Size of the current partition + unsigned long long file_count; // Count of files for the current partition (tar backup only, not restore) + + unsigned long long current_size; // Size of the current partition's already backed up data + unsigned long long current_count; // Count of files that have already been backed up for the current partition + + unsigned long long previous_partitions_size; // Total data already backed up from previous partitions (for the progress bar) + + bool display_file_count; // Inidicates if we will display the file count text + timespec last_update; // Tracks last update of the displayed progress (frequent updates tax the CPU and slow us down) +}; + +#endif //__PROGRESSTRACKING_HPP |