MCPcopy Create free account
hub / github.com/apohl79/audiogridder / StatisticsWindow

Method StatisticsWindow

Server/Source/StatisticsWindow.cpp:18–215  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16namespace e47 {
17
18StatisticsWindow::StatisticsWindow(App* app)
19 : DocumentWindow("Server Statistics",
20 LookAndFeel::getDefaultLookAndFeel().findColour(ResizableWindow::backgroundColourId),
21 DocumentWindow::closeButton),
22 LogTag("statistics"),
23 m_app(app),
24 m_sandboxing(false),
25 m_updater(this) {
26 traceScope();
27 setUsingNativeTitleBar(true);
28
29 if (auto srv = m_app->getServer()) {
30 m_sandboxing = srv->getSandboxMode() == Server::SANDBOX_CHAIN;
31 }
32
33 int totalWidth = 400;
34 int totalHeight = 40;
35 int borderLR = 15; // left/right border
36 int borderTB = 15; // top/bottom border
37 int rowHeight = 25;
38
39 int fieldWidth = 80;
40 int fieldHeight = 25;
41 int labelWidth = 250;
42 int labelHeight = 30;
43
44 auto getLabelBounds = [&](int r, int indent = 0) {
45 return juce::Rectangle<int>(borderLR + indent, borderTB + r * rowHeight, labelWidth, labelHeight);
46 };
47 auto getFieldBounds = [&](int r) {
48 return juce::Rectangle<int>(totalWidth - fieldWidth - borderLR, borderTB + r * rowHeight + 3, fieldWidth,
49 fieldHeight);
50 };
51 auto getLineBounds = [&](int r) {
52 return juce::Rectangle<int>(5, borderTB + r * rowHeight, totalWidth - borderLR, rowHeight);
53 };
54
55 int row = 0;
56 String tmpStr;
57
58 addLabel("CPU Load:", getLabelBounds(row));
59 m_cpu.setBounds(getFieldBounds(row));
60 m_cpu.setJustificationType(Justification::right);
61 addChildAndSetID(&m_cpu, "cpu");
62
63 row++;
64
65 auto line = std::make_unique<HirozontalLine>(getLineBounds(row++));
66 addChildAndSetID(line.get(), "line");
67 m_components.push_back(std::move(line));
68
69 if (m_sandboxing) {
70 addLabel("Sanboxes:", getLabelBounds(row));
71 m_totalWorkers.setBounds(getFieldBounds(row));
72 m_totalWorkers.setJustificationType(Justification::right);
73 addChildAndSetID(&m_totalWorkers, "totalworkers");
74
75 row++;

Callers

nothing calls this directly

Calls 11

getFunction · 0.85
windowToFrontFunction · 0.85
getSandboxModeMethod · 0.80
push_backMethod · 0.80
getNumSandboxesMethod · 0.80
get1minHistogramMethod · 0.80
rate_1minMethod · 0.80
getServerMethod · 0.45
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected