4#include <wx/xrc/xmlres.h>
10#include <wx/settings.h>
15#include <wx/notebook.h>
20#include <wx/dataview.h>
21#include <wx/stattext.h>
22#include <wx/statbox.h>
23#include <RumPi/Data/SelectedSensorReadings.h>
24#include "../../Headers/LoggerEventForwarder.h"
25#include "../../Headers/GUI/ComponentData.h"
26#include "../../Headers/GUI/ComponentPanel.h"
27#include "../../Headers/GUI/HomeScenePanel.h"
28#include "../../Headers/GUI/LoggerListData.h"
207 wxStaticText*
CreateSummaryTile(wxWindow* parent, wxSizer* tileGridSizer,
const wxString& title);
237 virtual void OnClose(wxCloseEvent& event);
251 virtual void OnExit(wxCommandEvent& event);
265 virtual void OnAbout(wxCommandEvent& event);
280 virtual void OnShowLogs(wxCommandEvent& event);
347 MainWindow(wxWindow* parent, wxWindowID
id = wxID_ANY,
const wxString& title = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize(500, 300),
long style = wxDEFAULT_FRAME_STYLE | wxTAB_TRAVERSAL);
wxDECLARE_EVENT(wxEVT_RUMPI_UPDATE, wxThreadEvent)
Custom event carrying a component-data update from the manager thread to the UI.
RumPiMenuID
Menu / control command IDs for the main window.
Definition: MainWindow.h:43
@ ID_SHOW_LOGS
The "Show Log Files" menu item.
Definition: MainWindow.h:44
The Home tab's stylized, condition-reactive backdrop.
Definition: HomeScenePanel.h:26
Bridges the library's AlertManager to the wxWidgets event system: it subscribes to the AlertManager o...
Definition: LoggerEventForwarder.h:18
A virtual list model backing the on-screen log's data-view control, holding the log lines and colouri...
Definition: LoggerListData.h:27
The client's main window: a tabbed frame (Home scene, Summary tiles, Devices, Logger,...
Definition: MainWindow.h:55
wxStaticText * myAirQualityValue
The Air Quality tile's value label.
Definition: MainWindow.h:76
wxStaticText * myPmTwoPointFiveValue
The PM2.5 tile's value label.
Definition: MainWindow.h:77
void ConstructLoggerPanel()
Builds the Logger tab: a data-view control with icon/time/level/description columns,...
Definition: MainWindow.cpp:357
void ConstructMenuAndStatusBar()
Builds the menu bar and status bar and binds the window's menu, update, logger, and close events.
Definition: MainWindow.cpp:95
virtual void OnExit(wxCommandEvent &event)
Exit handler: closes the window.
Definition: MainWindow.cpp:473
void ConstructSummaryPanel()
Builds the Summary tab: a three-per-row grid of at-a-glance sensor tiles, stashing each tile's value ...
Definition: MainWindow.cpp:203
void ConstructSettingsPanel()
Builds the (currently empty) Settings tab and adds it to the notebook.
Definition: MainWindow.cpp:399
wxStaticText * myFormaldehydeValue
The Formaldehyde tile's value label.
Definition: MainWindow.h:79
wxStaticText * myTVOCValue
The TVOC tile's value label.
Definition: MainWindow.h:78
HomeScenePanel * myHomeScenePanel
The Home tab's condition-reactive backdrop.
Definition: MainWindow.h:58
wxPanel * myLoggerPanel
The Logger tab.
Definition: MainWindow.h:61
wxPanel * mySummaryPanel
The Summary tab (at-a-glance tiles).
Definition: MainWindow.h:59
wxStaticText * CreateSummaryTile(wxWindow *parent, wxSizer *tileGridSizer, const wxString &title)
Builds one titled summary tile with a large centered value label and adds it to the grid.
Definition: MainWindow.cpp:247
virtual void OnRumPiUpdate(wxThreadEvent &event)
RumPi-update handler (main thread): refreshes the Summary tiles and Home scene from the event's snaps...
Definition: MainWindow.cpp:549
void RefreshDeviceTiles(const std::string &componentJson)
Parses the component JSON payload and creates/refreshes one device tile per named component instance.
Definition: MainWindow.cpp:568
wxStaticText * myWindSpeedValue
The Wind Speed tile's value label.
Definition: MainWindow.h:82
LoggerListData * myLoggerListDataModel
The model backing the log control.
Definition: MainWindow.h:70
void ConstructNotebook()
Builds the notebook and its five tabs (Home, Summary, Devices, Logger, Settings) and adds it to the w...
Definition: MainWindow.cpp:139
wxStaticText * myHumidityValue
The Humidity tile's value label.
Definition: MainWindow.h:75
wxStaticText * myMotionValue
The Motion tile's value label.
Definition: MainWindow.h:81
std::unordered_map< std::string, ComponentPanel * > myComponentDataCollection
Definition: MainWindow.h:87
RumPiManagerThread * myRumPiManagerThread
Definition: MainWindow.h:91
wxDataViewCtrl * myLoggerDataViewCtrl
The data-view control showing the log.
Definition: MainWindow.h:69
MainWindow(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=wxEmptyString, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(500, 300), long style=wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL)
Builds the main window: sets up the menu/status bar and notebook, creates the alert forwarder,...
Definition: MainWindow.cpp:32
void ConstructDevicesPanel()
Builds the Devices tab: a scrollable, three-column grid that will hold one tile per component instanc...
Definition: MainWindow.cpp:320
LoggerEventForwarder * myLoggerEventForwarder
Forwards AlertManager alerts to the Logger tab.
Definition: MainWindow.h:71
void TeardownBackgroundWork()
Stops the background poll thread and then tears down the alert forwarder, in that order (stop the pro...
Definition: MainWindow.cpp:416
wxPanel * myDevicesPanel
The Devices tab.
Definition: MainWindow.h:60
wxStaticText * myTemperatureValue
The Temperature tile's value label.
Definition: MainWindow.h:74
virtual void OnLoggerUpdate(wxThreadEvent &event)
Logger-update handler (main thread): appends the event's log line to the logger model.
Definition: MainWindow.cpp:647
void UpdateSummaryPanel(const RumPi::SelectedSensorReadings &readings)
Refreshes every summary tile's value label from a sensor snapshot (temperature, humidity,...
Definition: MainWindow.cpp:284
wxPanel * mySettingsPanel
The Settings tab.
Definition: MainWindow.h:62
wxStaticText * myLightValue
The Light tile's value label.
Definition: MainWindow.h:83
void ConstructHomePanel()
Builds the Home tab's condition-reactive scene panel and adds it to the notebook.
Definition: MainWindow.cpp:182
wxGridSizer * myDataViewGridSizer
The grid sizer holding the device tiles.
Definition: MainWindow.h:65
virtual void OnShowLogs(wxCommandEvent &event)
"Show Log Files" handler: opens the log folder in the platform's file manager, falling back to a mess...
Definition: MainWindow.cpp:509
wxStaticText * myCO2Value
The CO2 tile's value label.
Definition: MainWindow.h:80
~MainWindow()
Destroys the window, tearing down the background work as a safety net for paths that bypass OnClose (...
Definition: MainWindow.cpp:78
wxScrolledWindow * myDevicesScrollWindow
The scrollable container for the device tiles.
Definition: MainWindow.h:66
virtual void OnAbout(wxCommandEvent &event)
About handler: shows the application's about dialog.
Definition: MainWindow.cpp:490
wxNotebook * myNotebook
The tab container.
Definition: MainWindow.h:57
virtual void OnClose(wxCloseEvent &event)
Close handler: tears down the background work before the window is destroyed (the worker and forwarde...
Definition: MainWindow.cpp:452
Background wxThread that runs the RumPi library's sensor loop and posts refreshed component data (and...
Definition: RumPiManagerThread.h:16