Mema
Memory Matrix — multi-channel audio matrix monitor and router
Loading...
Searching...
No Matches
MemaClientConnectingComponent.cpp
Go to the documentation of this file.
1/* Copyright (c) 2025, Christian Ahrens
2 *
3 * This file is part of Mema <https://github.com/ChristianAhrens/Mema>
4 *
5 * This tool is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU Lesser General Public License version 3.0 as published
7 * by the Free Software Foundation.
8 *
9 * This tool is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this tool; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
20
21#include <CustomLookAndFeel.h>
22
24 : juce::Component()
25{
26 m_startupProgressIndicator = std::make_unique<juce::ProgressBar>(m_progress, juce::ProgressBar::Style::circular);
27 addAndMakeVisible(m_startupProgressIndicator.get());
28}
29
33
34void MemaClientConnectingComponent::setMasterServiceDescription(const juce::String& serviceDescription)
35{
36 m_serviceDescription = serviceDescription;
37 repaint();
38}
39
41{
42 g.fillAll(getLookAndFeel().findColour(juce::ResizableWindow::ColourIds::backgroundColourId));
43
44 g.setColour(getLookAndFeel().findColour(juce::TextEditor::ColourIds::textColourId));
45 g.drawFittedText("Waiting for\n" + (m_serviceDescription.isNotEmpty() ? m_serviceDescription : "UNKNOWN"), getLocalBounds().reduced(35), juce::Justification::centred, 2);
46}
47
49{
50 auto bounds = getLocalBounds();
51 if (bounds.getWidth() > bounds.getHeight())
52 bounds.reduce((bounds.getWidth() - bounds.getHeight()) / 2, 0);
53 else
54 bounds.reduce(0, (bounds.getHeight() - bounds.getWidth()) / 2);
55
56 auto progressIndicatorBounds = bounds;
57 progressIndicatorBounds.reduce(35, 35);
58 m_startupProgressIndicator->setBounds(progressIndicatorBounds);
59
60}
61
63{
64 if (m_startupProgressIndicator)
65 m_startupProgressIndicator->setColour(juce::ProgressBar::ColourIds::foregroundColourId, getLookAndFeel().findColour(JUCEAppBasics::CustomLookAndFeel::ColourIds::MeteringRmsColourId));
66}
67
void setMasterServiceDescription(const juce::String &serviceDescription)
void paint(juce::Graphics &g) override