22 static constexpr int kY = 180;
69 Thread(
"Vial Download Thread"), ref_(ref), url_(std::move(url)), dest_(std::move(dest)) { }
103 for (
auto& thread : download_threads_)
104 thread->stopThread(300);
112 void setVisible(
bool should_be_visible)
override;
122 void mouseUp(
const MouseEvent& e)
override;
136 void finished(URL::DownloadTask* task,
bool success)
override;
142 void progress(URL::DownloadTask* task, int64 bytesDownloaded, int64 totalLength)
override;
158 void startDownload(Thread* thread, URL& url,
const File& dest);
178 bool initial_download_;
179 float progress_value_;
185 std::unique_ptr<AppLogo> logo_;
186 std::unique_ptr<LoadingWheel> loading_wheel_;
188 std::vector<std::unique_ptr<DownloadThread>> download_threads_;
189 InstallThread install_thread_;
192 URL factory_download_url_;
193 File available_packs_location_;
194 std::vector<DownloadPack> awaiting_install_;
195 std::vector<DownloadPack> awaiting_download_;
197 std::vector<std::unique_ptr<URL::DownloadTask>> download_tasks_;
198 File install_location_;
199 std::vector<Listener*> listeners_;
201 std::unique_ptr<OpenGlShapeButton> folder_button_;
202 std::unique_ptr<PlainTextComponent> download_text_;
203 std::unique_ptr<PlainTextComponent> install_location_text_;
204 std::unique_ptr<OpenGlToggleButton> install_button_;
205 std::unique_ptr<OpenGlToggleButton> cancel_button_;
A no-op stub implementation used when authentication is disabled.
Definition authentication.h:163
A background thread to handle downloading content without blocking the GUI.
Definition download_section.h:66
virtual ~DownloadThread()
Definition download_section.h:70
DownloadThread(DownloadSection *ref, URL url, File dest)
Definition download_section.h:68
void run() override
Definition download_section.h:72
A background thread for installing downloaded packs.
Definition download_section.h:83
void run() override
Definition download_section.h:88
InstallThread(DownloadSection *ref)
Definition download_section.h:85
virtual ~InstallThread()
Definition download_section.h:86
Interface for objects that need to respond to data directory changes or no-download scenarios.
Definition download_section.h:54
virtual void noDownloadNeeded()=0
Called when no downloads are needed (all content is up-to-date).
virtual ~Listener()=default
virtual void dataDirectoryChanged()=0
Called when the data directory changes (e.g., after a successful installation).
An overlay component handling the download and installation of factory content and packs.
Definition download_section.h:17
void timerCallback() override
Timer callback used for hiding the UI after a delay.
Definition download_section.h:115
void startDownload(Thread *thread, URL &url, const File &dest)
Definition download_section.cpp:319
void triggerInstall()
Starts the installation process after all downloads are completed.
Definition download_section.cpp:298
static constexpr int kDownloadAdditionalHeight
The additional height if more content is available.
Definition download_section.h:28
static const std::string kFactoryDownloadPath
The URL path for the factory download.
Definition download_section.h:20
void renderOpenGlComponents(OpenGlWrapper &open_gl, bool animate) override
Definition download_section.cpp:172
virtual ~DownloadSection()
Destructor.
Definition download_section.h:102
static constexpr int kDownloadWidth
The width of the download UI.
Definition download_section.h:24
void triggerDownload()
Triggers the process of checking available packs and downloading necessary content.
Definition download_section.cpp:286
static constexpr int kTextHeight
The text height for labels.
Definition download_section.h:30
Rectangle< int > getDownloadRect()
Definition download_section.cpp:275
static constexpr int kY
The vertical offset for the download UI.
Definition download_section.h:22
void mouseUp(const MouseEvent &e) override
Definition download_section.cpp:158
void cancelDownload()
Cancels all ongoing downloads.
Definition download_section.cpp:366
void setVisible(bool should_be_visible) override
Definition download_section.cpp:148
void chooseInstallFolder()
Allows the user to choose a folder for installation.
Definition download_section.cpp:372
static constexpr int kPaddingX
Horizontal padding inside the UI.
Definition download_section.h:32
void progress(URL::DownloadTask *task, int64 bytesDownloaded, int64 totalLength) override
Definition download_section.cpp:266
void startInstall(Thread *thread)
Definition download_section.cpp:323
static constexpr int kButtonHeight
Height of buttons.
Definition download_section.h:36
static constexpr int kDownloadInitialHeight
The initial height of the download UI before any content is loaded.
Definition download_section.h:26
DownloadSection(String name, Authentication *auth)
Definition download_section.cpp:17
static constexpr int kPaddingY
Vertical padding inside the UI.
Definition download_section.h:34
void resized() override
Lays out the UI components within the overlay.
Definition download_section.cpp:81
void addListener(Listener *listener)
Definition download_section.h:172
static constexpr int kCompletionWaitMs
Time in milliseconds to wait before hiding the UI after completion.
Definition download_section.h:38
void finished(URL::DownloadTask *task, bool success) override
Definition download_section.cpp:180
void buttonClicked(Button *clicked_button) override
Definition download_section.cpp:163
A convenience class for a single quad rendered via OpenGL.
Definition open_gl_multi_quad.h:447
A SynthSection that displays an overlay with a background and optional listeners.
Definition overlay.h:180
virtual void animate(bool animate)
Triggers animation state change in sub-sections if needed.
Definition synth_section.cpp:822
Represents a downloadable pack with name, author, ID, URL, and local destination file.
Definition download_section.h:41
bool finished
Whether the download is finished.
Definition download_section.h:49
std::string author
The author of the pack.
Definition download_section.h:45
int id
The pack's unique ID.
Definition download_section.h:46
std::string name
The name of the pack.
Definition download_section.h:44
File download_location
The local file where the pack is downloaded.
Definition download_section.h:48
DownloadPack(std::string n, std::string a, int i, URL u, File d)
Definition download_section.h:42
URL url
The download URL for the pack.
Definition download_section.h:47
A helper struct containing references to OpenGL context, shaders, and display scale.
Definition shaders.h:174