48 lines
1.3 KiB
C++
48 lines
1.3 KiB
C++
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
#include <gtk/gtk.h>
|
|
#include <memory>
|
|
#include <map>
|
|
#include "temp_monitor.h"
|
|
#include "temperature_chart.h"
|
|
#include "config_manager.h"
|
|
|
|
class MainWindow {
|
|
public:
|
|
MainWindow();
|
|
~MainWindow();
|
|
|
|
void show();
|
|
|
|
private:
|
|
void setupUI();
|
|
void updateTemperatures();
|
|
void updateLegend();
|
|
void saveWindowState();
|
|
|
|
static gboolean onDeleteWindow(GtkWidget *widget, gpointer userData);
|
|
static gboolean onUpdateTimer(gpointer userData);
|
|
static void onRefreshRateChanged(GtkSpinButton *spinButton, gpointer userData);
|
|
static void onClearButtonClicked(GtkButton *button, gpointer userData);
|
|
static void onQuitButtonClicked(GtkButton *button, gpointer userData);
|
|
static void onColorSet(GObject *object, GParamSpec *pspec, gpointer userData);
|
|
static void onNameChanged(GtkEditable *editable, gpointer userData);
|
|
|
|
GtkWidget *window;
|
|
GtkWidget *statusLabel;
|
|
GtkSpinButton *refreshRateSpinBox;
|
|
std::unique_ptr<TemperatureChart> chart;
|
|
std::unique_ptr<TempMonitor> monitor;
|
|
std::unique_ptr<ConfigManager> config;
|
|
guint timerID;
|
|
int refreshRateSec;
|
|
GtkWidget *legendBox;
|
|
std::map<std::string, GtkWidget*> tempLabels;
|
|
};
|
|
|
|
// Global main loop reference for proper shutdown
|
|
extern GMainLoop *gMainLoop;
|
|
|
|
#endif // MAINWINDOW_H
|