mirror of
https://codeberg.org/armin/chromaflock.git
synced 2026-09-01 12:20:47 +02:00
Add bottom status bar with git build info and compile time
This commit is contained in:
parent
cd2caf7821
commit
a2485907ef
6 changed files with 118 additions and 1 deletions
32
Source/BuildInfo.cpp
Normal file
32
Source/BuildInfo.cpp
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#include "BuildInfo.h"
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
std::string getBuildInfoString() {
|
||||
// Actual compilation time from compiler built-ins.
|
||||
// __DATE__ -> "Mmm dd yyyy", __TIME__ -> "HH:MM:SS"
|
||||
const char* date = __DATE__;
|
||||
const char* time = __TIME__;
|
||||
|
||||
static const char* months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
char mon[4] = {0};
|
||||
int day = 0, year = 0, hh = 0, mm = 0, ss = 0;
|
||||
std::sscanf(date, "%3s %d %d", mon, &day, &year);
|
||||
std::sscanf(time, "%d:%d:%d", &hh, &mm, &ss);
|
||||
|
||||
int mi = 1;
|
||||
for (int i = 0; i < 12; ++i)
|
||||
if (std::strcmp(mon, months[i]) == 0) { mi = i + 1; break; }
|
||||
|
||||
char buf[64];
|
||||
std::snprintf(buf, sizeof(buf), "%04d-%02d-%02d__%02d-%02d-%02d",
|
||||
year, mi, day, hh, mm, ss);
|
||||
|
||||
std::string s = std::string("build ") + CHROMAFLOCK_GIT_HASH
|
||||
+ " (" + CHROMAFLOCK_GIT_BRANCH + ")";
|
||||
if (CHROMAFLOCK_GIT_DIRTY)
|
||||
s += " *";
|
||||
s += " built " + std::string(buf);
|
||||
return s;
|
||||
}
|
||||
8
Source/BuildInfo.h.in
Normal file
8
Source/BuildInfo.h.in
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#pragma once
|
||||
// Generated at build time by cmake/GenerateBuildInfo.cmake. Do not edit manually.
|
||||
#define CHROMAFLOCK_GIT_HASH "@CHROMAFLOCK_GIT_HASH@"
|
||||
#define CHROMAFLOCK_GIT_BRANCH "@CHROMAFLOCK_GIT_BRANCH@"
|
||||
#define CHROMAFLOCK_GIT_DIRTY @CHROMAFLOCK_GIT_DIRTY@
|
||||
|
||||
#include <string>
|
||||
std::string getBuildInfoString();
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
#include "PluginEditor.h"
|
||||
#include "BuildInfo.h"
|
||||
#include <BinaryData.h>
|
||||
|
||||
namespace
|
||||
|
|
@ -698,6 +699,12 @@ MainContentComponent::MainContentComponent(ChromaFlockProcessor& p)
|
|||
setupParam(reverbDampKnob, reverbDampAttach, "reverbDamping", "DAMP");
|
||||
setupParam(reverbMixKnob, reverbMixAttach, "reverbMix", "MIX");
|
||||
|
||||
// Bottom status bar: git build info + actual compilation time
|
||||
addAndMakeVisible(statusBar);
|
||||
statusBar.setColour(juce::Label::textColourId, juce::Colour(0xff888888));
|
||||
statusBar.setFont(juce::Font(juce::FontOptions(11.0f)));
|
||||
statusBar.setText(juce::String(getBuildInfoString()), juce::dontSendNotification);
|
||||
|
||||
// Preset section: title button + dot-matrix LCD + prev/next
|
||||
presetButton.setColour(juce::TextButton::buttonColourId, juce::Colour(0xcc2a2a2a));
|
||||
presetButton.setColour(juce::TextButton::textColourOffId, juce::Colour(0xffccaa44));
|
||||
|
|
@ -1175,6 +1182,10 @@ void MainContentComponent::paint(juce::Graphics& g) {
|
|||
|
||||
// Arpeggiator section (replaces the removed spectrum analyzer)
|
||||
drawSubSection(860, 754, 790, 128, "ARPEGGIATOR", 6);
|
||||
|
||||
// Status bar divider
|
||||
g.setColour(juce::Colour(0xff333333));
|
||||
g.drawHorizontalLine(1034, 10.0f, 1650.0f);
|
||||
}
|
||||
|
||||
void MainContentComponent::resized() {
|
||||
|
|
@ -1416,6 +1427,9 @@ void MainContentComponent::resized() {
|
|||
|
||||
// Piano roll
|
||||
pianoRoll.setBounds(10, 892, 1640, 136);
|
||||
|
||||
// Status bar (bottom strip)
|
||||
statusBar.setBounds(10, 1036, 1640, 20);
|
||||
}
|
||||
|
||||
// ===== PianoRollComponent =====
|
||||
|
|
|
|||
|
|
@ -209,6 +209,8 @@ private:
|
|||
|
||||
juce::ComboBox uiScaleBox;
|
||||
|
||||
juce::Label statusBar;
|
||||
|
||||
using SliderAttachment = juce::AudioProcessorValueTreeState::SliderAttachment;
|
||||
using ComboBoxAttachment = juce::AudioProcessorValueTreeState::ComboBoxAttachment;
|
||||
|
||||
|
|
@ -275,7 +277,7 @@ private:
|
|||
MainContentComponent content;
|
||||
float currentScale = 1.0f;
|
||||
static constexpr int baseWidth = 1660;
|
||||
static constexpr int baseHeight = 1036;
|
||||
static constexpr int baseHeight = 1058;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ChromaFlockEditor)
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue