13 clearSingletonInstance();
19 body_(
Shaders::kRoundedRectangleFragment) {
20 addOpenGlComponent(&body_);
22 notify_text_ = std::make_unique<PlainTextComponent>(
"notify",
"There is a new version of Vital!");
23 notify_text_->setTextSize(20.0f);
25 addOpenGlComponent(notify_text_.get());
27 version_text_ = std::make_unique<PlainTextComponent>(
"version",
"");
28 version_text_->setTextSize(14.0f);
30 addOpenGlComponent(version_text_.get());
32 download_button_ = std::make_unique<OpenGlToggleButton>(TRANS(
"Download"));
33 download_button_->addListener(
this);
34 download_button_->setUiButton(
true);
35 addAndMakeVisible(download_button_.get());
36 addOpenGlComponent(download_button_->getGlComponent());
38 nope_button_ = std::make_unique<OpenGlToggleButton>(TRANS(
"Ignore"));
39 nope_button_->addListener(
this);
40 nope_button_->setUiButton(
false);
41 addAndMakeVisible(nope_button_.get());
42 addOpenGlComponent(nope_button_->getGlComponent());
44 content_update_ =
false;
52 notify_text_->setColor(text_color);
53 version_text_->setColor(text_color);
56 body_.setBounds(update_rect);
58 int text_width = update_rect.getWidth() - 2 *
kPaddingX;
60 notify_text_->setBounds(update_rect.getX() +
kPaddingX, update_rect.getY() +
kPaddingY, text_width, height);
61 version_text_->setBounds(update_rect.getX() +
kPaddingX, update_rect.getY() +
kPaddingY + height, text_width, height);
63 float button_width = (update_rect.getWidth() - 3 *
kPaddingX) / 2.0f;
64 download_button_->setBounds(update_rect.getX() +
kPaddingX,
67 nope_button_->setBounds(update_rect.getX() + button_width + 2 *
kPaddingX,
77 if (should_be_visible) {
78 Image image(Image::ARGB, 1, 1,
false);
84void UpdateCheckSection::updateContent(String version) {
88 for (
Listener* listener : listeners_)
89 listener->needsUpdate();
93 if (clicked_button == download_button_.get()) {
95 updateContent(content_version_);
97 URL(
"").launchInDefaultBrowser();
111 StringArray versions;
112 version_file_.readLines(versions);
113 if (versions.size() < 2)
116 MessageManagerLock lock(&version_request_);
117 if (!lock.lockWasGained())
120 app_version_ = versions[0];
121 content_version_ = versions[1];
124 version_text_->setText(String(
"Version: ") + app_version_);
131 version_file_ = File::getSpecialLocation(File::tempDirectory).getChildFile(
"vital_versions.txt");
132 download_task_ = version_url.downloadToFile(version_file_,
"",
this);
138 notify_text_->setText(
"There is new preset content available");
139 version_text_->setText(String(
"Version: ") + content_version_);
140 content_update_ =
true;
static String loadContentVersion()
Loads the saved content version string.
Definition load_save.cpp:1638
static bool shouldCheckForUpdates()
Checks if Vital should perform update checks.
Definition load_save.cpp:1554
static int compareVersionStrings(String a, String b)
Compares two version strings.
Definition load_save.cpp:1895
force_inline void setColor(Colour color)
Sets the base color for the quads.
Definition open_gl_multi_quad.h:102
void setRounding(float rounding)
Sets the rounding radius of the quads.
Definition open_gl_multi_quad.h:347
A SynthSection that displays an overlay with a background and optional listeners.
Definition overlay.h:180
virtual void resized() override
Called when the overlay is resized. Updates background color and size.
Definition overlay.h:237
void setVisible(bool should_be_visible) override
Sets the visibility of the overlay and notifies listeners.
Definition overlay.h:224
@ kLight
Definition open_gl_image_component.h:309
Manages and provides access to vertex and fragment shaders used by the OpenGL rendering pipeline.
Definition shaders.h:19
@ kBodyRounding
Definition skin.h:71
@ kBodyText
Definition skin.h:133
@ kBody
Definition skin.h:129
void paintOpenGlChildrenBackgrounds(Graphics &g)
Paints the backgrounds for all OpenGL child components.
Definition synth_section.cpp:267
float findValue(Skin::ValueId value_id) const
Finds a value in the skin overrides or from the parent if not found locally.
Definition synth_section.cpp:18
Interface for components interested in update notifications.
Definition update_check_section.h:96
A UI overlay for checking software or content updates.
Definition update_check_section.h:59
void resized() override
Called when the component is resized. Updates layout of all elements.
Definition update_check_section.cpp:47
static constexpr int kUpdateCheckHeight
Height of the update check dialog.
Definition update_check_section.h:62
void checkUpdate()
Actual method that checks for an update. Usually called from the thread.
Definition update_check_section.cpp:129
static constexpr int kPaddingY
Vertical padding inside the dialog.
Definition update_check_section.h:64
Rectangle< int > getUpdateCheckRect()
Computes the rectangle of the update check dialog within the overlay.
Definition update_check_section.cpp:145
void mouseUp(const MouseEvent &e) override
Closes the overlay if clicked outside the dialog area.
Definition update_check_section.cpp:102
void buttonClicked(Button *clicked_button) override
Handles button clicks.
Definition update_check_section.cpp:92
void checkContentUpdate()
Checks for content updates (e.g., new preset content).
Definition update_check_section.cpp:135
static constexpr int kPaddingX
Horizontal padding inside the dialog.
Definition update_check_section.h:63
static constexpr int kUpdateCheckWidth
Width of the update check dialog.
Definition update_check_section.h:61
void finished(URL::DownloadTask *task, bool success) override
Called when a download task finishes.
Definition update_check_section.cpp:107
static constexpr int kButtonHeight
Height of buttons in the dialog.
Definition update_check_section.h:65
void needsUpdate()
Informs listeners that an update is available.
Definition update_check_section.cpp:87
void setVisible(bool should_be_visible) override
Sets the visibility of the update overlay. When made visible, lays out elements accordingly.
Definition update_check_section.cpp:74
A singleton class that keeps track of whether an update check should be performed.
Definition update_check_section.h:14
UpdateMemory()
Constructs the UpdateMemory object. Initializes the checker count based on user settings for update c...
Definition update_check_section.cpp:6
virtual ~UpdateMemory()
Destructor.
Definition update_check_section.cpp:12