OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::Download Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/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< FileGet > m_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 )
90 : m_id(ID)
92 , m_dest_folder(dest_folder)
93{
94 assert(boost::filesystem::is_directory(dest_folder));
95 m_final_path = dest_folder / m_filename;
96 m_file_get = std::make_shared<FileGet>(ID, std::move(url), m_filename, evt_handler, dest_folder);
97}
const int m_id
Definition Downloader.hpp:53
boost::filesystem::path m_dest_folder
Definition Downloader.hpp:56
boost::filesystem::path m_final_path
Definition Downloader.hpp:55
std::string m_filename
Definition Downloader.hpp:54
std::shared_ptr< FileGet > m_file_get
Definition Downloader.hpp:57
std::string filename_from_url(const std::string &url)
Definition Downloader.cpp:79

References m_dest_folder, m_file_get, m_filename, m_final_path, and m_id.

Member Function Documentation

◆ cancel()

void Slic3r::GUI::Download::cancel ( )
105{
107 m_file_get->cancel();
108}
DownloadState m_state
Definition Downloader.hpp:58
@ DownloadStopped
Definition Downloader.hpp:23

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

◆ get_dest_folder()

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

References m_dest_folder.

◆ get_filename()

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

References m_filename.

◆ get_final_path()

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

References m_final_path.

◆ get_id()

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

References m_id.

◆ get_state()

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

References m_state.

◆ pause()

void Slic3r::GUI::Download::pause ( )
110{
111 //assert(m_state == DownloadState::DownloadOngoing);
112 // if instead of assert - it can happen that user clicks on pause several times before the pause happens
114 return;
116 m_file_get->pause();
117}
@ DownloadOngoing
Definition Downloader.hpp:22
@ DownloadPaused
Definition Downloader.hpp:26

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

◆ resume()

void Slic3r::GUI::Download::resume ( )
119{
120 //assert(m_state == DownloadState::DownloadPaused);
122 return;
124 m_file_get->resume();
125}

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

◆ set_state()

void Slic3r::GUI::Download::set_state ( DownloadState state)
inline
50{ 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 Download(), and 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 Download(), and get_id().

◆ m_state

DownloadState Slic3r::GUI::Download::m_state { DownloadState::DownloadPending }
private
@ DownloadPending
Definition Downloader.hpp:21

Referenced by cancel(), get_state(), pause(), resume(), set_state(), and start().


The documentation for this class was generated from the following files:
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Downloader.hpp
  • /home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/Downloader.cpp