quic
This commit is contained in:
@@ -1,20 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <glibmm/dispatcher.h>
|
||||
#include <gtkmm/box.h>
|
||||
#include <gtkmm/label.h>
|
||||
#include <sigc++/sigc++.h>
|
||||
|
||||
#include "gtkmm/scrolledwindow.h"
|
||||
|
||||
class WeatherWidget : public Gtk::Box {
|
||||
public:
|
||||
struct CurrentWeather {
|
||||
double temperature;
|
||||
double apparent_temperature;
|
||||
double precipitation;
|
||||
int weather_code;
|
||||
};
|
||||
|
||||
struct DailyWeather {
|
||||
double temperature_2m_max;
|
||||
double temperature_2m_min;
|
||||
double apparent_temperature_min;
|
||||
double apparent_temperature_max;
|
||||
double precipitation_sum;
|
||||
int weather_code;
|
||||
std::string time;
|
||||
};
|
||||
|
||||
struct HourlyWeather {
|
||||
double temperature_2m;
|
||||
double apparent_temperature;
|
||||
double precipitation_probability;
|
||||
double precipitation;
|
||||
int weather_code;
|
||||
std::string time;
|
||||
};
|
||||
|
||||
WeatherWidget();
|
||||
|
||||
private:
|
||||
Gtk::Label titleLabel;
|
||||
Gtk::Label currentLabel;
|
||||
Gtk::Label todayLabel;
|
||||
std::array<DailyWeather, 7> daily_weather{};
|
||||
std::array<HourlyWeather, 24> hourly_weather{};
|
||||
CurrentWeather current_weather{};
|
||||
|
||||
Gtk::ScrolledWindow currentScroll;
|
||||
Gtk::ScrolledWindow hourlyScroll;
|
||||
Gtk::ScrolledWindow dailyScroll;
|
||||
|
||||
Glib::Dispatcher m_dispatcher;
|
||||
|
||||
bool onRefreshTick();
|
||||
void fetchWeather();
|
||||
void applyWeatherText(const std::string ¤t_text,
|
||||
const std::string &today_text);
|
||||
|
||||
void refreshCurrentWeather();
|
||||
void refreshHourlyWeather();
|
||||
void refreshDailyWeather();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user