Refactoring of DownloaderUtils (remove including ConfigWizard_private.hpp))
This commit is contained in:
parent
ee0871880f
commit
41ab733cd8
7 changed files with 46 additions and 51 deletions
|
@ -1315,10 +1315,12 @@ PageUpdate::PageUpdate(ConfigWizard *parent)
|
||||||
box_presets->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &event) { this->preset_update = event.IsChecked(); });
|
box_presets->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &event) { this->preset_update = event.IsChecked(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace DownloaderUtils
|
namespace DownloaderUtils
|
||||||
{
|
{
|
||||||
|
namespace {
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
wxString get_downloads_path()
|
wxString get_downloads_path()
|
||||||
{
|
{
|
||||||
wxString ret;
|
wxString ret;
|
||||||
|
@ -1330,7 +1332,6 @@ namespace DownloaderUtils
|
||||||
CoTaskMemFree(path);
|
CoTaskMemFree(path);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
wxString get_downloads_path()
|
wxString get_downloads_path()
|
||||||
{
|
{
|
||||||
|
@ -1348,9 +1349,8 @@ namespace DownloaderUtils
|
||||||
}
|
}
|
||||||
return wxString();
|
return wxString();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
Worker::Worker(wxWindow* parent)
|
Worker::Worker(wxWindow* parent)
|
||||||
: wxBoxSizer(wxHORIZONTAL)
|
: wxBoxSizer(wxHORIZONTAL)
|
||||||
, m_parent(parent)
|
, m_parent(parent)
|
||||||
|
@ -1432,16 +1432,16 @@ PageDownloader::PageDownloader(ConfigWizard* parent)
|
||||||
)));
|
)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
box_allow_downloads->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& event) { this->downloader->allow(event.IsChecked()); });
|
box_allow_downloads->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& event) { this->m_downloader->allow(event.IsChecked()); });
|
||||||
|
|
||||||
downloader = new DownloaderUtils::Worker(this);
|
m_downloader = new DownloaderUtils::Worker(this);
|
||||||
append(downloader);
|
append(m_downloader);
|
||||||
downloader->allow(box_allow_value);
|
m_downloader->allow(box_allow_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PageDownloader::on_finish_downloader() const
|
bool PageDownloader::on_finish_downloader() const
|
||||||
{
|
{
|
||||||
return downloader->on_finish();
|
return m_downloader->on_finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DownloaderUtils::Worker::perform_register(const std::string& path_override/* = {}*/)
|
bool DownloaderUtils::Worker::perform_register(const std::string& path_override/* = {}*/)
|
||||||
|
|
|
@ -14,6 +14,36 @@ class PresetUpdater;
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
|
namespace DownloaderUtils {
|
||||||
|
class Worker : public wxBoxSizer
|
||||||
|
{
|
||||||
|
wxWindow* m_parent{ nullptr };
|
||||||
|
wxTextCtrl* m_input_path{ nullptr };
|
||||||
|
bool downloader_checked{ false };
|
||||||
|
#ifdef __linux__
|
||||||
|
bool perform_registration_linux{ false };
|
||||||
|
#endif // __linux__
|
||||||
|
|
||||||
|
void deregister();
|
||||||
|
|
||||||
|
public:
|
||||||
|
Worker(wxWindow* parent);
|
||||||
|
~Worker() {}
|
||||||
|
|
||||||
|
void allow(bool allow_) { downloader_checked = allow_; }
|
||||||
|
bool is_checked() const { return downloader_checked; }
|
||||||
|
wxString path_name() const { return m_input_path ? m_input_path->GetValue() : wxString(); }
|
||||||
|
|
||||||
|
void set_path_name(wxString name);
|
||||||
|
void set_path_name(const std::string& name);
|
||||||
|
|
||||||
|
bool on_finish();
|
||||||
|
bool perform_register(const std::string& path_override = {});
|
||||||
|
#ifdef __linux__
|
||||||
|
bool get_perform_registration_linux() { return perform_registration_linux; }
|
||||||
|
#endif // __linux__
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
class ConfigWizard: public DPIDialog
|
class ConfigWizard: public DPIDialog
|
||||||
{
|
{
|
||||||
|
|
|
@ -418,44 +418,10 @@ struct PageUpdate: ConfigWizardPage
|
||||||
PageUpdate(ConfigWizard *parent);
|
PageUpdate(ConfigWizard *parent);
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace DownloaderUtils {
|
|
||||||
wxString get_downloads_path();
|
|
||||||
|
|
||||||
class Worker : public wxBoxSizer
|
|
||||||
{
|
|
||||||
wxWindow* m_parent {nullptr};
|
|
||||||
wxTextCtrl* m_input_path {nullptr};
|
|
||||||
bool downloader_checked {false};
|
|
||||||
#ifdef __linux__
|
|
||||||
bool perform_registration_linux { false };
|
|
||||||
#endif // __linux__
|
|
||||||
|
|
||||||
void deregister();
|
|
||||||
|
|
||||||
public:
|
|
||||||
Worker(wxWindow* parent);
|
|
||||||
~Worker(){}
|
|
||||||
|
|
||||||
void allow(bool allow_) { downloader_checked = allow_; }
|
|
||||||
bool is_checked() const { return downloader_checked; }
|
|
||||||
wxString path_name() const { return m_input_path ? m_input_path->GetValue() : wxString(); }
|
|
||||||
|
|
||||||
void set_path_name(wxString name);
|
|
||||||
void set_path_name(const std::string& name);
|
|
||||||
|
|
||||||
bool on_finish();
|
|
||||||
bool perform_register(const std::string& path_override = {});
|
|
||||||
#ifdef __linux__
|
|
||||||
bool get_perform_registration_linux() { return perform_registration_linux; }
|
|
||||||
#endif // __linux__
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struct PageDownloader : ConfigWizardPage
|
struct PageDownloader : ConfigWizardPage
|
||||||
{
|
{
|
||||||
DownloaderUtils::Worker* downloader{ nullptr };
|
DownloaderUtils::Worker* m_downloader { nullptr };
|
||||||
|
|
||||||
PageDownloader(ConfigWizard* parent);
|
PageDownloader(ConfigWizard* parent);
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,6 @@
|
||||||
#include "DesktopIntegrationDialog.hpp"
|
#include "DesktopIntegrationDialog.hpp"
|
||||||
#include "SendSystemInfoDialog.hpp"
|
#include "SendSystemInfoDialog.hpp"
|
||||||
#include "Downloader.hpp"
|
#include "Downloader.hpp"
|
||||||
#include "ConfigWizard_private.hpp"
|
|
||||||
|
|
||||||
#include "BitmapCache.hpp"
|
#include "BitmapCache.hpp"
|
||||||
#include "Notebook.hpp"
|
#include "Notebook.hpp"
|
||||||
|
@ -3081,8 +3080,8 @@ void GUI_App::show_downloader_registration_dialog()
|
||||||
), SLIC3R_APP_NAME, SLIC3R_VERSION)
|
), SLIC3R_APP_NAME, SLIC3R_VERSION)
|
||||||
, true, wxYES_NO);
|
, true, wxYES_NO);
|
||||||
if (msg.ShowModal() == wxID_YES) {
|
if (msg.ShowModal() == wxID_YES) {
|
||||||
auto downloader = new DownloaderUtils::Worker(nullptr);
|
auto downloader_worker = new DownloaderUtils::Worker(nullptr);
|
||||||
downloader->perform_register(app_config->get("url_downloader_dest"));
|
downloader_worker->perform_register(app_config->get("url_downloader_dest"));
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
if (downloader->get_perform_registration_linux())
|
if (downloader->get_perform_registration_linux())
|
||||||
DesktopIntegrationDialog::perform_desktop_integration(true);
|
DesktopIntegrationDialog::perform_desktop_integration(true);
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include "ButtonsDescription.hpp"
|
#include "ButtonsDescription.hpp"
|
||||||
#include "OG_CustomCtrl.hpp"
|
#include "OG_CustomCtrl.hpp"
|
||||||
#include "GLCanvas3D.hpp"
|
#include "GLCanvas3D.hpp"
|
||||||
#include "ConfigWizard_private.hpp"
|
#include "ConfigWizard.hpp"
|
||||||
|
|
||||||
#include <boost/dll/runtime_symbol_info.hpp>
|
#include <boost/dll/runtime_symbol_info.hpp>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue