Mema
Memory Matrix — multi-channel audio matrix monitor and router
Loading...
Searching...
No Matches
AboutComponent.cpp
Go to the documentation of this file.
1/* Copyright (c) 2024-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
19#include "AboutComponent.h"
20
21AboutComponent::AboutComponent(const char* imageData, int imageDataSize)
22 : juce::Component()
23{
24 m_appIcon = std::make_unique<juce::DrawableButton>("App Icon", juce::DrawableButton::ButtonStyle::ImageFitted);
25 m_appIcon->setColour(juce::DrawableButton::ColourIds::backgroundColourId, juce::Colours::transparentBlack);
26 m_appIcon->setColour(juce::DrawableButton::ColourIds::backgroundOnColourId, juce::Colours::transparentBlack);
27 m_appIcon->setImages(juce::Drawable::createFromImageData(imageData, imageDataSize).get());
28 addAndMakeVisible(m_appIcon.get());
29
30 m_appInfoLabel = std::make_unique<juce::Label>("Version", juce::JUCEApplication::getInstance()->getApplicationName() + " " + juce::JUCEApplication::getInstance()->getApplicationVersion());
31 m_appInfoLabel->setJustificationType(juce::Justification::centredBottom);
32 m_appInfoLabel->setFont(juce::Font(juce::FontOptions(16.0, juce::Font::plain)));
33 addAndMakeVisible(m_appInfoLabel.get());
34
35 m_appRepoLink = std::make_unique<juce::HyperlinkButton>(juce::JUCEApplication::getInstance()->getApplicationName() + juce::String(" on GitHub"), URL("https://www.github.com/ChristianAhrens/Mema"));
36 m_appRepoLink->setFont(juce::Font(juce::FontOptions(16.0, juce::Font::plain)), false /* do not resize */);
37 m_appRepoLink->setJustificationType(juce::Justification::centredTop);
38 addAndMakeVisible(m_appRepoLink.get());
39}
40
44
45void AboutComponent::paint(juce::Graphics &g)
46{
47 g.fillAll(getLookAndFeel().findColour(juce::DrawableButton::backgroundColourId));
48
49 juce::Component::paint(g);
50}
51
53{
54 auto bounds = getLocalBounds();
55 auto margin = bounds.getHeight() / 8;
56 bounds.reduce(margin, margin);
57 auto iconBounds = bounds.removeFromTop(bounds.getHeight() / 2);
58 auto infoBounds = bounds.removeFromTop(bounds.getHeight() / 2);
59 auto& repoLinkBounds = bounds;
60
61 m_appIcon->setBounds(iconBounds);
62 m_appInfoLabel->setBounds(infoBounds);
63 m_appRepoLink->setBounds(repoLinkBounds);
64}
void paint(juce::Graphics &) override
Renders the component.
void resized() override
Lays out child components.
AboutComponent(const char *imageData, int imageDataSize)
Constructs the about component with embedded image data.
~AboutComponent() override