Skip to content

Commit 094030c

Browse files
author
alcomposer
committed
Add click-to-copy git hash display on welcome screen (only for nightly- incase app is non-responsive)
1 parent e93f0f5 commit 094030c

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

Source/Statusbar.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,13 @@ Statusbar::Statusbar(PluginProcessor* processor, PluginEditor* e)
11901190
snapEnableButton.setButtonText(Icons::Magnet);
11911191
snapSettingsButton.setButtonText(Icons::ThinDown);
11921192

1193+
if (String(PLUGDATA_GIT_HASH).isNotEmpty()) {
1194+
plugdataString.setText(String("Nightly build: ") + String(PLUGDATA_GIT_HASH), dontSendNotification);
1195+
addAndMakeVisible(plugdataString);
1196+
plugdataString.setTooltip("Click to copy hash to clipboard");
1197+
plugdataString.addMouseListener(this, false);
1198+
}
1199+
11931200
helpButton.setButtonText(Icons::Help);
11941201
helpButton.onClick = []() {
11951202
URL("https://plugdata.org/documentation.html").launchInDefaultBrowser();
@@ -1334,6 +1341,12 @@ void Statusbar::paint(Graphics& g)
13341341
g.drawLine(secondSeparatorPosition, 6.0f, secondSeparatorPosition, getHeight() - 6.0f);
13351342
}
13361343

1344+
void Statusbar::mouseDown(const MouseEvent& e)
1345+
{
1346+
if (e.originalComponent == &plugdataString)
1347+
SystemClipboard::copyTextToClipboard(String(PLUGDATA_GIT_HASH));
1348+
}
1349+
13371350
void Statusbar::resized()
13381351
{
13391352
int pos = 0;
@@ -1375,6 +1388,9 @@ void Statusbar::resized()
13751388

13761389
auto lastButtonPosition = position(getHeight(), true);
13771390
helpButton.setBounds(4, 0, 34, getHeight());
1391+
if (plugdataString.isVisible())
1392+
plugdataString.setBounds(helpButton.getRight() + 4, 0, 200, getHeight());
1393+
13781394
sidebarExpandButton.setBounds(lastButtonPosition, 0, getHeight(), getHeight());
13791395
audioSettingsButton.setBounds(lastButtonPosition, 0, getHeight(), getHeight());
13801396
powerButton.setBounds(position(getHeight() - 6, true), 0, getHeight(), getHeight());
@@ -1458,6 +1474,7 @@ void Statusbar::setWelcomePanelShown(bool isShowing)
14581474
audioSettingsButton.setVisible(!isShowing);
14591475
sidebarExpandButton.setVisible(isShowing);
14601476
helpButton.setVisible(isShowing);
1477+
plugdataString.setVisible(isShowing);
14611478
if(!isShowing) sidebarExpandButton.setToggleState(false, dontSendNotification);
14621479
}
14631480

Source/Statusbar.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ class Statusbar : public Component
113113
void setWelcomePanelShown(bool isShowing);
114114

115115
private:
116+
void mouseDown(const MouseEvent& e) override;
117+
116118
void handleAsyncUpdate() override;
117119

118120
std::unique_ptr<LevelMeter> levelMeter;
@@ -125,6 +127,7 @@ class Statusbar : public Component
125127
SmallIconButton snapEnableButton, snapSettingsButton;
126128
SmallIconButton powerButton, audioSettingsButton;
127129
SmallIconButton sidebarExpandButton, helpButton;
130+
Label plugdataString;
128131
std::unique_ptr<CommandButton> commandInputButton;
129132

130133
SafePointer<CallOutBox> commandInputCallout;

0 commit comments

Comments
 (0)