Skip to content

Commit

Permalink
move firmware label to MainComponent (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
vsicurella committed Aug 4, 2024
1 parent b32591d commit aee2e46
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
5 changes: 5 additions & 0 deletions Source/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ void TerpstraSysExApplication::shutdown()

savePropertiesFile();

// juce::String stateStr =state.toString();
// auto lines = juce::StringArray::fromLines(stateStr);
// for (auto line : lines)
// DBG(line);

if (state.firmwareUpdateCompleted())
FirmwareTransfer::exitLibSsh2();

Expand Down
20 changes: 17 additions & 3 deletions Source/MainComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ MainContentComponent::MainContentComponent(const LumatoneEditorState& stateIn, j
lblAppVersion->setColour(Label::ColourIds::textColourId, Colour(0xff777777));
addAndMakeVisible(lblAppVersion.get());

lblFirmwareVersion = std::make_unique<juce::Label>("lblFirmwareVersion", "");
lblFirmwareVersion->setFont(getAppFonts().getFont(LumatoneEditorFont::FranklinGothic));
lblFirmwareVersion->setColour(Label::ColourIds::textColourId, juce::Colour(0xff777777));
addAndMakeVisible(lblFirmwareVersion.get());


addStatusListener(this);

Expand Down Expand Up @@ -508,9 +513,9 @@ void MainContentComponent::resized()
allKeysOverview->setBounds(contentMargin, midiAreaHeight, contentWidth, controlsLabelYPos - midiAreaHeight);

int btnHeight = roundToInt(getHeight() * fileButtonH);
int btnMargin = roundToInt(getWidth() * saveloadMarginW);
int btnMargin = roundToInt(contentWidth * saveLoadMarginW);
int saveLoadWidth = roundToInt(getWidth() * saveLoadW);
int btnY = allKeysOverview->getY() - roundToInt(getHeight() * btnYFromImageTop);
int btnY = allKeysOverview->getY() - (allKeysOverview->getHeight() * btnYFromImageTop);

int halfWidthX = roundToInt(getWidth() * 0.5f);

Expand Down Expand Up @@ -539,7 +544,11 @@ void MainContentComponent::resized()

resizeLabelWithHeight(lblAppVersion.get(), roundToInt(lblAppName->getHeight() * 0.75f));
lblAppVersion->setTopLeftPosition(lblAppName->getRight(), lblAppName->getBottom() - lblAppVersion->getHeight());

// resizeLabelWithHeight(lblFirmwareVersion.get(), btnHeight * 0.6f);
lblFirmwareVersion->setBounds(allKeysOverview->getX(), allKeysOverview->getBottom(), btnHeight * 0.6f, contentWidth);
}

void MainContentComponent::resizeEditSectionTabs()
{
int sectionTabsMargin = proportionOfWidth(sectionTabsMarginW);
Expand Down Expand Up @@ -580,8 +589,13 @@ void MainContentComponent::handleStatePropertyChange(juce::ValueTree stateIn, co
{
updateDeveloperMode();
}
if (property == LumatoneApplicationProperty::NumKeySelected)
else if (property == LumatoneApplicationProperty::NumKeySelected)
{
lblSelectedKeys->setText(stateIn[property].toString() + " Keys Selected", juce::NotificationType::dontSendNotification);
}
else if (property == LumatoneStateProperty::LastConnectedFirmwareVersion)
{
auto string = juce::String("Firmware version: " + getFirmwareVersion().toDisplayString());
lblFirmwareVersion->setText(string, juce::NotificationType::sendNotification);
}
}
4 changes: 3 additions & 1 deletion Source/MainComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ class MainContentComponent : public juce::Component
std::unique_ptr<juce::Label> lblAppName;
std::unique_ptr<juce::Label> lblAppVersion;

std::unique_ptr<juce::Label> lblFirmwareVersion;

// Buffer for copy/paste of sub board data
std::unique_ptr<LumatoneBoard> copiedSubBoardData;

Expand Down Expand Up @@ -161,7 +163,7 @@ class MainContentComponent : public juce::Component

const float btnYFromImageTop = 0.02;
const float saveLoadW = 0.08f;
const float saveloadMarginW = 0.0034f;
const float saveLoadMarginW = 0.0034f;


const float popupWidth = 0.4f;
Expand Down
4 changes: 0 additions & 4 deletions Source/lumatone_editor_library/ui/keyboard_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ void LumatoneKeyboardComponent::resized()

octaveLineY = lumatoneBounds.getBottom() + juce::roundToInt(getHeight() * octaveLineYRatio);

// int btnHeight = juce::roundToInt(getHeight() * saveLoadH);
//resizeLabelWithHeight(lblFirmwareVersion.get(), btnHeight * 0.6f);
// lblFirmwareVersion->setTopLeftPosition(lumatoneBounds.getX(), lumatoneBounds.getY() - btnHeight * 0.6f);

keyWidth = juce::roundToInt(lumatoneBounds.getWidth() * keyW);
keyHeight = juce::roundToInt(lumatoneBounds.getHeight() * keyH);

Expand Down
2 changes: 0 additions & 2 deletions Source/lumatone_editor_library/ui/keyboard_component.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,6 @@ class LumatoneKeyboardComponent : public juce::Component,

juce::Array<MappedLumatoneKey> lastKeySelection;

// std::unique_ptr<juce::Label> lblFirmwareVersion;

//==============================================================================
// UI Data

Expand Down

0 comments on commit aee2e46

Please sign in to comment.