diff --git a/lib/Tasks/src/Task.cpp b/lib/Tasks/src/Task.cpp index e195bb6..47a9214 100644 --- a/lib/Tasks/src/Task.cpp +++ b/lib/Tasks/src/Task.cpp @@ -1,48 +1,29 @@ #include "Task.h" // Constructeur -Task::Task() : is_paused(false), is_running(false) {} +Task::Task() : is_running(false) {} + +Task::~Task() +{ + // Si la tâche est en cours d'exécution, on l'arrête + stop(); +} // Démarre la tâche void Task::start() { + is_running = true; - is_paused = false; -} - -// Met en pause la tâche -void Task::pause() -{ - if (is_running && !is_paused) - { - is_paused = true; - } -} - -// Reprend la tâche -void Task::resume() -{ - if (is_paused) - { - is_paused = false; - } } // Arrête la tâche void Task::stop() { - if (is_running) - { - is_running = false; - is_paused = false; - } + + is_running = false; } // Getters -bool Task::isPaused() -{ - return is_paused; -} bool Task::isRunning() { return is_running; diff --git a/lib/Tasks/src/Task.h b/lib/Tasks/src/Task.h index 3631634..3056d40 100644 --- a/lib/Tasks/src/Task.h +++ b/lib/Tasks/src/Task.h @@ -4,21 +4,16 @@ class Task { private: - bool is_paused; bool is_running; public: - Task(); // Constructeur - // Mise en pause de la tâche - void pause(); - // Reprise de la tâche - void resume(); + Task(); // Constructeur + ~Task(); // Déstructeur // Démarrage de la tâche void start(); // Arrêt de la tâche void stop(); // Getters - bool isPaused(); bool isRunning(); };