RAM2118 commited on
Commit
179fedf
·
verified ·
1 Parent(s): e99e9f9

Sprint 1: Add PluginBridgeEditor.cpp — shows MCP server status

Browse files
Files changed (1) hide show
  1. Source/PluginBridgeEditor.cpp +58 -0
Source/PluginBridgeEditor.cpp ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include "PluginBridgeEditor.h"
2
+
3
+ PluginBridgeEditor::PluginBridgeEditor(PluginBridgeProcessor& p)
4
+ : AudioProcessorEditor(&p), processorRef(p)
5
+ {
6
+ setSize(300, 150);
7
+
8
+ titleLabel.setText("PluginBridge", juce::dontSendNotification);
9
+ titleLabel.setFont(juce::FontOptions(20.0f));
10
+ titleLabel.setJustificationType(juce::Justification::centred);
11
+ addAndMakeVisible(titleLabel);
12
+
13
+ statusLabel.setText("MCP: starting...", juce::dontSendNotification);
14
+ statusLabel.setFont(juce::FontOptions(14.0f));
15
+ statusLabel.setJustificationType(juce::Justification::centred);
16
+ addAndMakeVisible(statusLabel);
17
+
18
+ portLabel.setText("", juce::dontSendNotification);
19
+ portLabel.setFont(juce::FontOptions(12.0f));
20
+ portLabel.setJustificationType(juce::Justification::centred);
21
+ portLabel.setColour(juce::Label::textColourId, juce::Colours::grey);
22
+ addAndMakeVisible(portLabel);
23
+
24
+ startTimerHz(2); // Update status 2x per second
25
+ }
26
+
27
+ PluginBridgeEditor::~PluginBridgeEditor()
28
+ {
29
+ stopTimer();
30
+ }
31
+
32
+ void PluginBridgeEditor::paint(juce::Graphics& g)
33
+ {
34
+ g.fillAll(juce::Colour(0xff1a1a2e));
35
+ }
36
+
37
+ void PluginBridgeEditor::resized()
38
+ {
39
+ auto area = getLocalBounds().reduced(10);
40
+ titleLabel.setBounds(area.removeFromTop(40));
41
+ area.removeFromTop(10);
42
+ statusLabel.setBounds(area.removeFromTop(30));
43
+ portLabel.setBounds(area.removeFromTop(25));
44
+ }
45
+
46
+ void PluginBridgeEditor::timerCallback()
47
+ {
48
+ if (processorRef.isMcpServerRunning()) {
49
+ statusLabel.setText("MCP: running", juce::dontSendNotification);
50
+ statusLabel.setColour(juce::Label::textColourId, juce::Colours::limegreen);
51
+ portLabel.setText("http://127.0.0.1:" + juce::String(processorRef.getMcpServerPort()) + "/mcp",
52
+ juce::dontSendNotification);
53
+ } else {
54
+ statusLabel.setText("MCP: offline", juce::dontSendNotification);
55
+ statusLabel.setColour(juce::Label::textColourId, juce::Colours::red);
56
+ portLabel.setText("", juce::dontSendNotification);
57
+ }
58
+ }