working timer

This commit is contained in:
2026-02-07 21:16:35 +01:00
parent ff2d0afd9b
commit 6be70a7d93
14 changed files with 456 additions and 3 deletions

View File

@@ -6,6 +6,7 @@
#include "components/button/tabButton.hpp"
#include "components/popover.hpp"
#include "widgets/controlCenter/mediaWidget.hpp"
#include "widgets/controlCenter/timer.hpp"
#include "widgets/weather.hpp"
#include "gtkmm/box.h"
@@ -29,6 +30,7 @@ class ControlCenter : public Popover {
std::unique_ptr<WeatherWidget> weatherWidget;
std::unique_ptr<MediaWidget> mediaControlWidget;
std::unique_ptr<TimerWidget> timerWidget;
void addPlayerWidget(const std::string &bus_name);
void removePlayerWidget(const std::string &bus_name);

View File

@@ -0,0 +1,22 @@
#pragma once
#include <memory>
#include <sys/types.h>
#include "components/timer.hpp"
#include "services/timerService.hpp"
#include "gtkmm/box.h"
class TimerWidget : public Gtk::Box {
public:
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;
};