Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::GUI::Download Class Reference

#include <src/slic3r/GUI/Downloader.hpp>

+ Collaboration diagram for Slic3r::GUI::Download:

Public Member Functions

 Download (int ID, std::string url, wxEvtHandler *evt_handler, const boost::filesystem::path &dest_folder)
 
void start ()
 
void cancel ()
 
void pause ()
 
void resume ()
 
int get_id () const
 
boost::filesystem::path get_final_path () const
 
std::string get_filename () const
 
DownloadState get_state () const
 
void set_state (DownloadState state)
 
std::string get_dest_folder ()
 

Private Attributes

const int m_id
 
std::string m_filename
 
boost::filesystem::path m_final_path
 
boost::filesystem::path m_dest_folder
 
std::shared_ptr< FileGetm_file_get
 
DownloadState m_state { DownloadState::DownloadPending }
 

Detailed Description

Constructor & Destructor Documentation

◆ Download()

Slic3r::GUI::Download::Download ( int  ID,
std::string  url,
wxEvtHandler *  evt_handler,
const boost::filesystem::path &  dest_folder 
)
74 : m_id(ID)
76 , m_dest_folder(dest_folder)
77{
78 assert(boost::filesystem::is_directory(dest_folder));
79 m_final_path = dest_folder / m_filename;
80 m_file_get = std::make_shared<FileGet>(ID, std::move(url), m_filename, evt_handler, dest_folder);
81}
const int m_id
Definition Downloader.hpp:47
boost::filesystem::path m_dest_folder
Definition Downloader.hpp:50
boost::filesystem::path m_final_path
Definition Downloader.hpp:49
std::string m_filename
Definition Downloader.hpp:48
std::shared_ptr< FileGet > m_file_get
Definition Downloader.hpp:51
std::string filename_from_url(const std::string &url)
Definition Downloader.cpp:63

References m_file_get, m_filename, and m_final_path.

Member Function Documentation

◆ cancel()

void Slic3r::GUI::Download::cancel ( )
89{
91 m_file_get->cancel();
92}
DownloadState m_state
Definition Downloader.hpp:52
@ DownloadStopped
Definition Downloader.hpp:17

References Slic3r::GUI::DownloadStopped, m_file_get, and m_state.

◆ get_dest_folder()

std::string Slic3r::GUI::Download::get_dest_folder ( )
inline
45{ return m_dest_folder.string(); }

References m_dest_folder.

◆ get_filename()

std::string Slic3r::GUI::Download::get_filename ( ) const
inline
42{ return m_filename; }

References m_filename.

◆ get_final_path()

boost::filesystem::path Slic3r::GUI::Download::get_final_path ( ) const
inline
41{ return m_final_path; }

References m_final_path.

◆ get_id()

int Slic3r::GUI::Download::get_id ( ) const
inline
40{ return m_id; }

References m_id.

◆ get_state()

DownloadState Slic3r::GUI::Download::get_state ( ) const
inline
43{ return m_state; }

References m_state.

◆ pause()

void Slic3r::GUI::Download::pause ( )
94{
95 //assert(m_state == DownloadState::DownloadOngoing);
96 // if instead of assert - it can happen that user clicks on pause several times before the pause happens
98 return;
100 m_file_get->pause();
101}
@ DownloadOngoing
Definition Downloader.hpp:16
@ DownloadPaused
Definition Downloader.hpp:20

References Slic3r::GUI::DownloadOngoing, Slic3r::GUI::DownloadPaused, m_file_get, and m_state.

◆ resume()

void Slic3r::GUI::Download::resume ( )
103{
104 //assert(m_state == DownloadState::DownloadPaused);
106 return;
108 m_file_get->resume();
109}

References Slic3r::GUI::DownloadOngoing, Slic3r::GUI::DownloadPaused, m_file_get, and m_state.

◆ set_state()

void Slic3r::GUI::Download::set_state ( DownloadState  state)
inline
44{ m_state = state; }

References m_state.

◆ start()

void Slic3r::GUI::Download::start ( )

Member Data Documentation

◆ m_dest_folder

boost::filesystem::path Slic3r::GUI::Download::m_dest_folder
private

Referenced by get_dest_folder().

◆ m_file_get

std::shared_ptr<FileGet> Slic3r::GUI::Download::m_file_get
private

Referenced by Download(), cancel(), pause(), resume(), and start().

◆ m_filename

std::string Slic3r::GUI::Download::m_filename
private

Referenced by Download(), and get_filename().

◆ m_final_path

boost::filesystem::path Slic3r::GUI::Download::m_final_path
private

Referenced by Download(), and get_final_path().

◆ m_id

const int Slic3r::GUI::Download::m_id
private

Referenced by get_id().

◆ m_state

DownloadState Slic3r::GUI::Download::m_state { DownloadState::DownloadPending }
private

The documentation for this class was generated from the following files: