Skip to content

Commit f347f4c

Browse files
committed
add timestamp, its crashing on close for standalone now idk why
1 parent 89b4c43 commit f347f4c

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

source/UI/Utils/Timestamp.h

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
3+
Simple label component for displaying timestamps in a user interface.
4+
Used for checking build times when developing.
5+
6+
*/
7+
8+
9+
#pragma once
10+
11+
#include <juce_gui_basics/juce_gui_basics.h>
12+
13+
using namespace juce;
14+
15+
class ExtLabel : public Label
16+
{
17+
public:
18+
ExtLabel() : Label("", "")
19+
{
20+
setMouseCursor(MouseCursor::PointingHandCursor);
21+
setTooltip("Visit DirektDSP.com for more information");
22+
setLookAndFeel(&mainLabelLookAndFeel);
23+
24+
// create a string with the current build time
25+
auto buildTime = String(__DATE__) + " " + String(__TIME__);
26+
27+
setText("DirektDSP - " + buildTime, NotificationType::dontSendNotification);
28+
}
29+
30+
// click = open link
31+
void mouseDown(const MouseEvent& event) override
32+
{
33+
if (event.mods.isLeftButtonDown())
34+
{
35+
URL("https://direktdsp.com").launchInDefaultBrowser();
36+
}
37+
}
38+
39+
~ExtLabel()
40+
{
41+
setLookAndFeel(nullptr);
42+
}
43+
44+
private:
45+
struct MainLabelLookAndFeel : public LookAndFeel_V4
46+
{
47+
MainLabelLookAndFeel()
48+
{
49+
}
50+
51+
private:
52+
juce::Colour bgColour;
53+
54+
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(MainLabelLookAndFeel)
55+
} mainLabelLookAndFeel;
56+
57+
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ExtLabel)
58+
};

0 commit comments

Comments
 (0)