21#include <JuceHeader.h>
25#include <CustomLookAndFeel.h>
26#include <ServiceTopologyManager.h>
29class NetworkHealthBar;
63 public juce::DarkModeSettingListener,
64 public JUCEAppBasics::AppConfigurationBase::XmlConfigurableElement
195 void handleSettingsMenuResult(
int selectedId);
197 void handleSettingsLookAndFeelMenuResult(
int selectedId);
199 void handleSettingsMeteringColourMenuResult(
int selectedId);
205 void applyMeteringColour();
208 void applyPaletteStyle(
const JUCEAppBasics::CustomLookAndFeel::PaletteStyle&
paletteStyle);
211 std::unique_ptr<juce::DrawableButton> m_toggleStandaloneWindowButton;
212 std::unique_ptr<juce::DrawableButton> m_appSettingsButton;
213 std::unique_ptr<juce::DrawableButton> m_audioSetupButton;
214 std::unique_ptr<juce::DrawableButton> m_aboutButton;
215 std::unique_ptr<juce::DrawableButton> m_powerButton;
216 std::unique_ptr<EmptySpace> m_emptySpace;
217 std::unique_ptr<LoadBar> m_sysLoadBar;
218 std::unique_ptr<LoadBar> m_netHealthBar;
220 juce::Component* m_editorComponent =
nullptr;
222 std::unique_ptr<AboutComponent> m_aboutComponent;
224 std::map<int, std::pair<std::string, int>> m_settingsItems;
226 bool m_followLocalStyle =
true;
228 bool m_isStandaloneWindow =
false;
230 juce::Colour m_meteringColour = juce::Colours::forestgreen;
232 static constexpr int sc_buttonSize = 26;
233 static constexpr int sc_loadNetWidth = 70;
Main UI shell for the Mema application — composes the processor editor, toolbar, load bars,...
std::function< void()> onDeleted
Called when this component is destroyed.
std::function< void(const JUCEAppBasics::CustomLookAndFeel::PaletteStyle &)> onPaletteStyleChange
Called when palette style changes.
std::function< void()> onSettingsChanged
Called when any setting changes.
std::function< void()> onLoadConfig
Called when the user selects Load Config.
std::function< void(bool)> onToggleStandaloneWindow
Called when the user toggles standalone/popup mode.
MemaSettingsOption
Identifiers for all user-configurable settings exposed via the settings popup menu.
@ SaveConfig
Save configuration to file.
@ MeteringColour_Blue
Blue metering bars.
@ MeteringColour_Pink
Pink metering bars.
@ LookAndFeel_Dark
Force dark look-and-feel.
@ LookAndFeel_Automatic
Match the host OS appearance.
@ LoadConfig
Load configuration from file.
@ MeteringColour_Red
Red metering bars.
@ MeteringColour_Green
Green metering bars (default).
@ LookAndFeel_Light
Force light look-and-feel.
@ MeteringColour_Laser
High-visibility laser-green metering bars.
~MemaUIComponent() override
void setStandaloneWindow(bool standalone)
Switches between popup mode (embedded in the system tray/menubar popover) and standalone window mode.
void updateSessionServiceTopology(const JUCEAppBasics::SessionServiceTopology &serviceDiscoveryTopologyString)
Updates the service-topology display (if any) with freshly discovered Mema instances.
void paint(Graphics &) override
Paints the component background using the current look-and-feel background colour.
void setEditorComponent(juce::Component *editorComponent)
Attaches the MemaProcessorEditor to be displayed in the central content area.
std::function< void()> onLookAndFeelChanged
Called after a look-and-feel change is applied.
std::function< void()> onAudioSetupMenuClicked
Called when the audio-setup button is clicked.
bool setStateXml(juce::XmlElement *stateXml) override
Restores UI state from a <UICONFIG> XmlElement.
void updateCpuUsageBar(int loadPercent)
Updates the CPU-load progress bar to reflect the current audio processing load.
std::unique_ptr< juce::XmlElement > createStateXml() override
Serialises the UI state (standalone mode, palette style, metering colour) to XML.
bool isStandaloneWindow()
Returns true when the component is currently shown in standalone window mode.
void resized() override
Lays out all child components.
std::function< void()> onSaveConfig
Called when the user selects Save Config.
void darkModeSettingChanged() override
Responds to an OS dark-mode toggle.
void updateNetworkUsage(const std::map< int, std::pair< double, bool > > &netLoads)
Updates the network-health bar with per-connection traffic metrics.
void handleEditorSizeChangeRequest(const juce::Rectangle< int > &requestedSize)
Responds to a resize request from the embedded editor.
MemaUIComponent()
Constructs the UI component and wires up child components.
void lookAndFeelChanged() override
Propagates a look-and-feel change to all child buttons and bars.