![]() |
Mema
Memory Matrix — multi-channel audio matrix monitor and router
|
Main UI shell for the Mema application — composes the processor editor, toolbar, load bars, and settings menu. More...
#include <MemaUIComponent.h>
Inheritance diagram for Mema::MemaUIComponent:
Collaboration diagram for Mema::MemaUIComponent:Public Types | |
| enum | MemaSettingsOption { LookAndFeel_First = 1 , LookAndFeel_Automatic = LookAndFeel_First , LookAndFeel_Dark , LookAndFeel_Light , LookAndFeel_Last = LookAndFeel_Light , MeteringColour_First , MeteringColour_Green = MeteringColour_First , MeteringColour_Red , MeteringColour_Blue , MeteringColour_Pink , MeteringColour_Laser , MeteringColour_Last = MeteringColour_Laser , LoadConfig , SaveConfig } |
| Identifiers for all user-configurable settings exposed via the settings popup menu. More... | |
Public Member Functions | |
| MemaUIComponent () | |
| Constructs the UI component and wires up child components. | |
| ~MemaUIComponent () override | |
| void | setStandaloneWindow (bool standalone) |
| Switches between popup mode (embedded in the system tray/menubar popover) and standalone window mode. | |
| bool | isStandaloneWindow () |
Returns true when the component is currently shown in standalone window mode. | |
| void | setEditorComponent (juce::Component *editorComponent) |
Attaches the MemaProcessorEditor to be displayed in the central content area. | |
| void | handleEditorSizeChangeRequest (const juce::Rectangle< int > &requestedSize) |
| Responds to a resize request from the embedded editor. | |
| void | updateCpuUsageBar (int loadPercent) |
| Updates the CPU-load progress bar to reflect the current audio processing load. | |
| void | updateNetworkUsage (const std::map< int, std::pair< double, bool > > &netLoads) |
| Updates the network-health bar with per-connection traffic metrics. | |
| void | updateSessionServiceTopology (const JUCEAppBasics::SessionServiceTopology &serviceDiscoveryTopologyString) |
| Updates the service-topology display (if any) with freshly discovered Mema instances. | |
| void | darkModeSettingChanged () override |
| Responds to an OS dark-mode toggle. | |
| void | paint (Graphics &) override |
| Paints the component background using the current look-and-feel background colour. | |
| void | resized () override |
| Lays out all child components. | |
| void | lookAndFeelChanged () override |
| Propagates a look-and-feel change to all child buttons and bars. | |
| std::unique_ptr< juce::XmlElement > | createStateXml () override |
| Serialises the UI state (standalone mode, palette style, metering colour) to XML. | |
| bool | setStateXml (juce::XmlElement *stateXml) override |
Restores UI state from a <UICONFIG> XmlElement. | |
Public Attributes | |
| std::function< void(bool)> | onToggleStandaloneWindow |
| Called when the user toggles standalone/popup mode. | |
| std::function< void()> | onAudioSetupMenuClicked |
| Called when the audio-setup button is clicked. | |
| std::function< void()> | onLookAndFeelChanged |
| Called after a look-and-feel change is applied. | |
| std::function< void()> | onDeleted |
| Called when this component is destroyed. | |
| std::function< void()> | onSettingsChanged |
| Called when any setting changes. | |
| std::function< void(const JUCEAppBasics::CustomLookAndFeel::PaletteStyle &)> | onPaletteStyleChange |
| Called when palette style changes. | |
| std::function< void()> | onLoadConfig |
| Called when the user selects Load Config. | |
| std::function< void()> | onSaveConfig |
| Called when the user selects Save Config. | |
Main UI shell for the Mema application — composes the processor editor, toolbar, load bars, and settings menu.
MemaUIComponent is the outermost visible component shown to the user, both in menubar/tray popup mode and in standalone window mode. It:
MemaProcessorEditor (set via setEditorComponent()) in its central area.m_sysLoadBar) and a network health bar (m_netHealthBar) that are updated from the Mema singleton's timer callback via updateCpuUsageBar() and updateNetworkUsage().XmlConfigurableElement within the main MemaAppConfiguration XML under <UICONFIG>.juce::DarkModeSettingListener when "Automatic" palette is selected.The Mema singleton connects lambdas to all std::function members during construction, allowing MemaUIComponent to trigger application-level actions (window resize, audio setup, config load/save) without a direct back-reference to Mema.
Definition at line 62 of file MemaUIComponent.h.
Identifiers for all user-configurable settings exposed via the settings popup menu.
Values are grouped into three ranges: look-and-feel (1–3), metering colour (4–8), and action items (load/save config). The settings menu is built dynamically from m_settingsItems which maps each value to a localised display string and a submenu ID.
Definition at line 73 of file MemaUIComponent.h.
| Mema::MemaUIComponent::MemaUIComponent | ( | ) |
Constructs the UI component and wires up child components.
Definition at line 166 of file MemaUIComponent.cpp.
References darkModeSettingChanged(), LoadConfig, LookAndFeel_Automatic, LookAndFeel_Dark, LookAndFeel_First, LookAndFeel_Last, LookAndFeel_Light, MeteringColour_Blue, MeteringColour_First, MeteringColour_Green, MeteringColour_Laser, MeteringColour_Last, MeteringColour_Pink, MeteringColour_Red, onAudioSetupMenuClicked, onToggleStandaloneWindow, and SaveConfig.
|
override |
Definition at line 252 of file MemaUIComponent.cpp.
References onDeleted.
|
override |
Serialises the UI state (standalone mode, palette style, metering colour) to XML.
<UICONFIG> XmlElement for inclusion in the main application configuration. Definition at line 433 of file MemaUIComponent.cpp.
References Mema::MemaAppConfiguration::getAttributeName(), Mema::MemaAppConfiguration::getTagName(), LookAndFeel_First, Mema::MemaAppConfiguration::METERINGCOLOR, Mema::MemaAppConfiguration::PALETTESTYLE, and Mema::MemaAppConfiguration::UICONFIG.
|
override |
Responds to an OS dark-mode toggle.
Only acts when m_followLocalStyle is true (i.e. "Automatic" look-and-feel is selected). Reads the current OS setting and calls applyPaletteStyle() with the matching palette.
Definition at line 380 of file MemaUIComponent.cpp.
References LookAndFeel_First, and lookAndFeelChanged().
Referenced by MemaUIComponent(), and setStateXml().
| void Mema::MemaUIComponent::handleEditorSizeChangeRequest | ( | const juce::Rectangle< int > & | requestedSize | ) |
Responds to a resize request from the embedded editor.
Called by Mema::onEditorSizeChangeRequested when the editor (or a loaded plugin) wants to be displayed at a specific size. In standalone mode this resizes the window; in popup mode it adjusts the popup panel size if the host allows it.
| requestedSize | The new desired bounds for the editor area. |
Definition at line 298 of file MemaUIComponent.cpp.
References LookAndFeel_First.
| bool Mema::MemaUIComponent::isStandaloneWindow | ( | ) |
Returns true when the component is currently shown in standalone window mode.
Definition at line 283 of file MemaUIComponent.cpp.
Referenced by lookAndFeelChanged().
|
override |
Propagates a look-and-feel change to all child buttons and bars.
Definition at line 405 of file MemaUIComponent.cpp.
References isStandaloneWindow(), LookAndFeel_First, and onLookAndFeelChanged.
Referenced by darkModeSettingChanged(), and setStandaloneWindow().
Paints the component background using the current look-and-feel background colour.
Definition at line 333 of file MemaUIComponent.cpp.
References LookAndFeel_First.
|
override |
Lays out all child components.
Arranges the toolbar buttons and load bars in a fixed-height top strip, and scales the embedded editor to fill the remaining area below it.
Definition at line 338 of file MemaUIComponent.cpp.
References LookAndFeel_First.
| void Mema::MemaUIComponent::setEditorComponent | ( | juce::Component * | editorComponent | ) |
Attaches the MemaProcessorEditor to be displayed in the central content area.
The component pointer is borrowed (not owned); the editor is owned by MemaProcessor. Calling this again with a different pointer replaces the previous editor.
| editorComponent | Pointer to the processor editor, or nullptr to clear it. |
Definition at line 288 of file MemaUIComponent.cpp.
References LookAndFeel_First.
Switches between popup mode (embedded in the system tray/menubar popover) and standalone window mode.
In standalone mode the component fills a normal resizable OS window; in popup mode it is constrained to fit inside the system-provided popup panel. The onToggleStandaloneWindow callback is fired so the Mema singleton can show or hide the dedicated window.
| standalone | true to show as a standalone window, false for popup/tray mode. |
Definition at line 261 of file MemaUIComponent.cpp.
References LookAndFeel_First, and lookAndFeelChanged().
|
override |
Restores UI state from a <UICONFIG> XmlElement.
| stateXml | Pointer to the previously serialised XML element. |
true on success; false if the element is null or malformed. Definition at line 449 of file MemaUIComponent.cpp.
References darkModeSettingChanged(), Mema::MemaAppConfiguration::getAttributeName(), Mema::MemaAppConfiguration::getTagName(), LookAndFeel_Automatic, LookAndFeel_Dark, LookAndFeel_First, LookAndFeel_Light, Mema::MemaAppConfiguration::METERINGCOLOR, MeteringColour_Blue, MeteringColour_Green, MeteringColour_Laser, MeteringColour_Pink, MeteringColour_Red, Mema::MemaAppConfiguration::PALETTESTYLE, and Mema::MemaAppConfiguration::UICONFIG.
Updates the CPU-load progress bar to reflect the current audio processing load.
Called from the Mema singleton's juce::Timer callback (~1 Hz) after querying AudioDeviceManager::getCpuUsage().
| loadPercent | CPU load as a percentage in [0, 100]. |
Definition at line 309 of file MemaUIComponent.cpp.
References LookAndFeel_First.
| void Mema::MemaUIComponent::updateNetworkUsage | ( | const std::map< int, std::pair< double, bool > > & | netLoads | ) |
Updates the network-health bar with per-connection traffic metrics.
Called from the Mema singleton's timer callback after querying MemaProcessor::getNetworkHealth(). Each entry represents one connected TCP client (Mema.Mo or Mema.Re).
| netLoads | Map of {connectionId → {bytes/s, isConnected}} for each active TCP client. |
Definition at line 315 of file MemaUIComponent.cpp.
References LookAndFeel_First.
| void Mema::MemaUIComponent::updateSessionServiceTopology | ( | const JUCEAppBasics::SessionServiceTopology & | serviceDiscoveryTopologyString | ) |
Updates the service-topology display (if any) with freshly discovered Mema instances.
Called when ServiceTopologyManager detects a change in the multicast announcement list. Currently used to keep internal state; future UI may display a list of discoverable peers.
| serviceDiscoveryTopologyString | The full current service topology snapshot. |
Definition at line 327 of file MemaUIComponent.cpp.
References LookAndFeel_First.
| std::function<void()> Mema::MemaUIComponent::onAudioSetupMenuClicked |
Called when the audio-setup button is clicked.
Definition at line 184 of file MemaUIComponent.h.
Referenced by MemaUIComponent().
| std::function<void()> Mema::MemaUIComponent::onDeleted |
Called when this component is destroyed.
Definition at line 186 of file MemaUIComponent.h.
Referenced by ~MemaUIComponent().
| std::function<void()> Mema::MemaUIComponent::onLoadConfig |
Called when the user selects Load Config.
Definition at line 189 of file MemaUIComponent.h.
| std::function<void()> Mema::MemaUIComponent::onLookAndFeelChanged |
Called after a look-and-feel change is applied.
Definition at line 185 of file MemaUIComponent.h.
Referenced by lookAndFeelChanged().
| std::function<void(const JUCEAppBasics::CustomLookAndFeel::PaletteStyle&)> Mema::MemaUIComponent::onPaletteStyleChange |
Called when palette style changes.
Definition at line 188 of file MemaUIComponent.h.
| std::function<void()> Mema::MemaUIComponent::onSaveConfig |
Called when the user selects Save Config.
Definition at line 190 of file MemaUIComponent.h.
| std::function<void()> Mema::MemaUIComponent::onSettingsChanged |
Called when any setting changes.
Definition at line 187 of file MemaUIComponent.h.
Called when the user toggles standalone/popup mode.
Definition at line 183 of file MemaUIComponent.h.
Referenced by MemaUIComponent().