Skip to content

Commit

Permalink
added link to documentation on firmware uploaded panel
Browse files Browse the repository at this point in the history
  • Loading branch information
benkuper committed May 7, 2024
1 parent 6816043 commit 8bae066
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
26 changes: 25 additions & 1 deletion Source/Prop/ui/PropFlasherPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#include "PropFlasherPanel.h"

PropFlasherPanel::PropFlasherPanel() :
ShapeShifterContentComponent("Firmware Uploader")
ShapeShifterContentComponent("Firmware Uploader"),
noDeviceLabel("NoDeviceLabel", "No device detected. If you already plugged a device, you may need to install the driver. Click here to get the instructions.")
{
filterKnownDevicesUI.reset(PropFlasher::getInstance()->filterKnownDevices->createToggle());
firmwareToUploadUI.reset((EnumParameterUI*)PropFlasher::getInstance()->fwType->createDefaultUI());
Expand Down Expand Up @@ -55,6 +56,13 @@ PropFlasherPanel::PropFlasherPanel() :
addAndMakeVisible(serverFolder.get());
addAndMakeVisible(uploadServerFiles.get());

noDeviceLabel.setJustificationType(Justification::centred);
noDeviceLabel.setColour(Label::textColourId, BLUE_COLOR);
noDeviceLabel.setFont(noDeviceLabel.getFont().withHeight(14).withStyle(Font::underlined));
noDeviceLabel.setMouseCursor(MouseCursor::PointingHandCursor);
noDeviceLabel.addMouseListener(this, true);
addAndMakeVisible(noDeviceLabel);


SerialManager::getInstance()->addSerialManagerListener(this);
PropFlasher::getInstance()->filterKnownDevices->addAsyncCoalescedParameterListener(this);
Expand Down Expand Up @@ -118,6 +126,12 @@ void PropFlasherPanel::resized()

filterKnownDevicesUI->setBounds(propInfosRect.removeFromBottom(30).withSizeKeepingCentre(160, 20));

if (noDeviceLabel.isVisible())
{
noDeviceLabel.setBounds(propInfosRect.reduced(10));

}

controlRect = r.withLeft(propInfosRect.getRight() + 10);

Rectangle<int> cr = controlRect.reduced(10);
Expand Down Expand Up @@ -164,9 +178,19 @@ void PropFlasherPanel::resized()
void PropFlasherPanel::updateInfos()
{
infos = PropFlasher::getInstance()->getDevicesToFlash();
noDeviceLabel.setVisible(infos.isEmpty());
}


void PropFlasherPanel::mouseDown(const MouseEvent& e)
{
if (e.eventComponent == &noDeviceLabel)
{
URL url("https://benkuper.notion.site/Installation-73cc90fceb7b4e918c576e4cad37f7dd");
url.launchInDefaultBrowser();
}
}

void PropFlasherPanel::portAdded(SerialDeviceInfo* info)
{
updateInfos();
Expand Down
3 changes: 3 additions & 0 deletions Source/Prop/ui/PropFlasherPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class PropFlasherPanel :
Array<SerialDeviceInfo*> infos;

std::unique_ptr<BoolToggleUI> filterKnownDevicesUI;
Label noDeviceLabel;

std::unique_ptr<EnumParameterUI> firmwareToUploadUI;
std::unique_ptr<StringParameterFileUI> firmwareCustomFileUI;
Expand All @@ -44,6 +45,8 @@ class PropFlasherPanel :
std::unique_ptr<TriggerButtonUI> uploadServerFiles;


void mouseDown(const MouseEvent& e) override;

virtual void portAdded(SerialDeviceInfo* info) override;
virtual void portRemoved(SerialDeviceInfo* info) override;

Expand Down

0 comments on commit 8bae066

Please sign in to comment.