roundabout,
created on Thursday, 29 May 2025, 19:13:31 (1748546011),
received on Thursday, 29 May 2025, 19:13:33 (1748546013)
Author identity: vlad <vlad.muntoiu@gmail.com>
094a764eab3aedc8c81832c45b84d0f430b9f62d
panthera-www.cc
@@ -139,6 +139,60 @@ public:
auto box = dynamic_cast<Gtk::Box*>(this->child); box->append(*history_toolbar); history_button_next->signal_clicked().connect([this]() { Glib::DateTime calendar_day = calendar->get_date(); Glib::DateTime datetime = Glib::DateTime::create_local( calendar_day.get_year(), calendar_day.get_month(), calendar_day.get_day_of_month(), 0, 0, 0 ); auto next_entries = this->history_manager->storage.get_all<HistoryEntry>( sqlite_orm::where(sqlite_orm::c(&HistoryEntry::timestamp) >= datetime.to_unix() + 86400), sqlite_orm::order_by(&HistoryEntry::timestamp).desc() ); if(next_entries.empty()) { return; } auto last_entry = next_entries.front(); Glib::DateTime next_day = Glib::DateTime::create_now_local(last_entry.timestamp); Glib::DateTime new_date = Glib::DateTime::create_local( next_day.get_year(), next_day.get_month(), next_day.get_day_of_month(), 0, 0, 0 ); calendar->select_day(new_date); reload_history(); }); history_button_previous->signal_clicked().connect([this]() { Glib::DateTime calendar_day = calendar->get_date(); Glib::DateTime datetime = Glib::DateTime::create_local( calendar_day.get_year(), calendar_day.get_month(), calendar_day.get_day_of_month(), 0, 0, 0 ); auto previous_entries = this->history_manager->storage.get_all<HistoryEntry>( sqlite_orm::where(sqlite_orm::c(&HistoryEntry::timestamp) < datetime.to_unix()), sqlite_orm::order_by(&HistoryEntry::timestamp).desc() ); if(previous_entries.empty()) { return; } auto last_entry = previous_entries.front(); Glib::DateTime previous_day = Glib::DateTime::create_now_local(last_entry.timestamp); Glib::DateTime new_date = Glib::DateTime::create_local( previous_day.get_year(), previous_day.get_month(), previous_day.get_day_of_month(), 0, 0, 0 ); calendar->select_day(new_date); reload_history(); }); calendar->signal_day_selected().connect(sigc::mem_fun(*this, &HistoryViewer::reload_history)); Glib::DateTime datetime = Glib::DateTime::create_now_local(); calendar->select_day(datetime);
@@ -148,8 +202,15 @@ public:
reload_history(); }); auto scrolled_window = Gtk::make_managed<Gtk::ScrolledWindow>(); box_place = Gtk::make_managed<Gtk::Box>(Gtk::Orientation::VERTICAL, 0); box->append(*box_place);auto viewport = Gtk::make_managed<Gtk::Viewport>(nullptr, nullptr); viewport->set_child(*box_place); scrolled_window->set_child(*viewport); scrolled_window->set_policy(Gtk::PolicyType::AUTOMATIC, Gtk::PolicyType::AUTOMATIC); scrolled_window->set_vexpand(true); scrolled_window->set_hexpand(true); box->append(*scrolled_window);// TODO: make the arrows work, they should move to the previous/next day with any entries // TODO: allow deleting entries