![]() |
Umsci
Upmix Spatial Control Interface — OCA/OCP.1 spatial audio utility
|
A ComboBox that continuously scans the local network for DS100 devices announced via Zeroconf/mDNS and lets the user select one to connect to. More...
#include <UmsciZeroconfDiscoverComboComponent.h>
Inheritance diagram for UmsciZeroconfDiscoverComboComponent:
Collaboration diagram for UmsciZeroconfDiscoverComboComponent:Public Member Functions | |
| UmsciZeroconfDiscoverComboComponent () | |
| ~UmsciZeroconfDiscoverComboComponent () override | |
| void | resized () override |
| void | parentSizeChanged () override |
| Resizes the component to 80 % of the parent's width whenever the parent (AlertWindow) is resized, matching the width that AlertWindow gives to its built-in text editors and combo boxes. | |
| void | handleServicesChanged (std::string serviceName) override |
ZeroconfSearcherListener callback — called when devices appear or disappear. | |
Public Attributes | |
| std::function< void(const ZeroconfSearcher::ZeroconfSearcher::ServiceInfo &)> | onServiceSelected |
Fired when the user selects a device from the combo box. The ServiceInfo contains the resolved hostname, IP address, and port. | |
A ComboBox that continuously scans the local network for DS100 devices announced via Zeroconf/mDNS and lets the user select one to connect to.
Used inside the connection settings dialog (MainComponent::showConnectionSettings()), embedded via juce::AlertWindow::addCustomComponent().
When the user picks an entry, onServiceSelected fires with the resolved IP and port so the caller can populate the IP/port text editors in the same dialog.
Backed by ZeroconfSearcher::ZeroconfSearcher("OCA", "_oca._tcp") from the JUCEAppBasics submodule, which handles mDNS browsing on a background thread. handleServicesChanged() is called on the JUCE message thread via MessageManager::callAsync whenever the service list changes, rebuilding the combo items with entries of the form "DeviceName (ip:port)".
juce::AlertWindow::updateLayout() only calls setTopLeftPosition() for custom components — it never resizes them. If the component were left at its initial size it would overflow and be clipped whenever the dialog is narrower than that size (e.g. on narrow Stage Manager windows or small device screens).
parentSizeChanged() therefore overrides the JUCE hook that fires on each parent resize to set the component's width to 80 % of the parent dialog's width, matching the width that AlertWindow gives to its own built-in text editors and combo boxes. The initial setSize() call in the caller sets a small placeholder width (10 px) so the component does not inflate the dialog before parentSizeChanged() runs.
Definition at line 56 of file UmsciZeroconfDiscoverComboComponent.h.
| UmsciZeroconfDiscoverComboComponent::UmsciZeroconfDiscoverComboComponent | ( | ) |
Definition at line 22 of file UmsciZeroconfDiscoverComboComponent.cpp.
References onServiceSelected.
|
override |
Definition at line 41 of file UmsciZeroconfDiscoverComboComponent.cpp.
|
override |
ZeroconfSearcherListener callback — called when devices appear or disappear.
Definition at line 58 of file UmsciZeroconfDiscoverComboComponent.cpp.
|
override |
Resizes the component to 80 % of the parent's width whenever the parent (AlertWindow) is resized, matching the width that AlertWindow gives to its built-in text editors and combo boxes.
Definition at line 52 of file UmsciZeroconfDiscoverComboComponent.cpp.
|
override |
Definition at line 47 of file UmsciZeroconfDiscoverComboComponent.cpp.
| std::function<void(const ZeroconfSearcher::ZeroconfSearcher::ServiceInfo&)> UmsciZeroconfDiscoverComboComponent::onServiceSelected |
Fired when the user selects a device from the combo box. The ServiceInfo contains the resolved hostname, IP address, and port.
Definition at line 80 of file UmsciZeroconfDiscoverComboComponent.h.
Referenced by UmsciZeroconfDiscoverComboComponent().