#pragma once #include "Hardware/Widgets/ScenarioComponent.hpp" #include "Scenario/Document/TimeSync/TimeSyncModel.hpp" #include namespace Hardware { struct TimeSyncWidget final : ScenarioComponentSpec< Scenario::TimeSyncModel, bugui::container_widget> , Nano::Observer , QObject { explicit TimeSyncWidget(Scenario::TimeSyncModel& timeSync, ScenarioWidget* scenario, bugui::container_widget* parent); ~TimeSyncWidget() override; int x() const override { return model.date().sec(); } int y() const override { return m_y; } int height() const override { return m_height; } void set_span(); void time_propagate(const TimeVal& t); private: W_OBJECT(TimeSyncWidget) void on_state_added(Scenario::EventModel& event); void on_state_removed(const Scenario::EventModel& event); bool contains(int px, int py) const override; void paint(bugui::painter& painter) const override; bool press{false}; int m_y{0}; int m_height{0}; }; } //namespace Hardware