Files
bar/include/widgets/controlCenter/timer.hpp
2026-02-09 13:50:26 +01:00

30 lines
823 B
C++

#pragma once
#include <memory>
#include <sigc++/connection.h>
#include <sys/types.h>
#include "components/timer.hpp"
#include "services/timerService.hpp"
#include "gtkmm/box.h"
class TimerWidget : public Gtk::Box {
public:
TimerWidget();
~TimerWidget();
void addTimer(const std::string &duration, uint64_t timerId);
void removeTimer(uint64_t timerId);
void activateTimer(uint64_t timerId);
private:
std::shared_ptr<TimerService> timerService = TimerService::getInstance();
bool updatingText = false;
std::string rawDigits;
std::map<uint64_t, std::unique_ptr<Timer>> activeTimers;
sigc::connection timerSetConnection;
sigc::connection timerCancelledConnection;
sigc::connection timerExpiredConnection;
sigc::connection tickConnection;
};