Merge branch 'lm_moonraker_rename' (PR #10255)

This commit is contained in:
Lukas Matena 2023-06-07 16:38:49 +02:00
commit 341857ab9b
6 changed files with 26 additions and 23 deletions

View File

@ -68,7 +68,7 @@ static const t_config_enum_values s_keys_map_PrintHostType {
{ "prusalink", htPrusaLink },
{ "prusaconnect", htPrusaConnect },
{ "octoprint", htOctoPrint },
{ "mainsail", htMainSail },
{ "moonraker", htMoonraker },
{ "duet", htDuet },
{ "flashair", htFlashAir },
{ "astrobox", htAstroBox },
@ -1953,7 +1953,7 @@ void PrintConfigDef::init_fff_params()
{ "prusalink", "PrusaLink" },
{ "prusaconnect", "PrusaConnect" },
{ "octoprint", "OctoPrint" },
{ "mainsail", "Mainsail/Fluidd" },
{ "moonraker", "Klipper (via Moonraker)" },
{ "duet", "Duet" },
{ "flashair", "FlashAir" },
{ "astrobox", "AstroBox" },
@ -4214,6 +4214,9 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
else if (value == "marlinfirmware")
// the "new" marlin firmware flavor used to be called "marlinfirmware" for some time during PrusaSlicer 2.4.0-alpha development.
value = "marlin2";
} else if (opt_key == "host_type" && value == "mainsail") {
// the "mainsail" key (introduced in 2.6.0-alpha6) was renamed to "moonraker" (in 2.6.0-rc1).
value = "moonraker";
} else if (opt_key == "fill_density" && value.find("%") == std::string::npos) {
try {
// fill_density was turned into a percent value

View File

@ -44,7 +44,7 @@ enum class MachineLimitsUsage {
};
enum PrintHostType {
htPrusaLink, htPrusaConnect, htOctoPrint, htMainSail, htDuet, htFlashAir, htAstroBox, htRepetier, htMKS
htPrusaLink, htPrusaConnect, htOctoPrint, htMoonraker, htDuet, htFlashAir, htAstroBox, htRepetier, htMKS
};
enum AuthorizationType {

View File

@ -251,8 +251,8 @@ set(SLIC3R_GUI_SOURCES
Utils/Http.hpp
Utils/FixModelByWin10.cpp
Utils/FixModelByWin10.hpp
Utils/Mainsail.cpp
Utils/Mainsail.hpp
Utils/Moonraker.cpp
Utils/Moonraker.hpp
Utils/OctoPrint.cpp
Utils/OctoPrint.hpp
Utils/Duet.cpp

View File

@ -1,4 +1,4 @@
#include "Mainsail.hpp"
#include "Moonraker.hpp"
#include <algorithm>
#include <sstream>
@ -63,28 +63,28 @@ std::string substitute_host(const std::string& orig_addr, std::string sub_addr)
}
#endif
}
Mainsail::Mainsail(DynamicPrintConfig *config) :
Moonraker::Moonraker(DynamicPrintConfig *config) :
m_host(config->opt_string("print_host")),
m_apikey(config->opt_string("printhost_apikey")),
m_cafile(config->opt_string("printhost_cafile")),
m_ssl_revoke_best_effort(config->opt_bool("printhost_ssl_ignore_revoke"))
{}
const char* Mainsail::get_name() const { return "Mainsail"; }
const char* Moonraker::get_name() const { return "Moonraker"; }
wxString Mainsail::get_test_ok_msg () const
wxString Moonraker::get_test_ok_msg () const
{
return _(L("Connection to Mainsail works correctly."));
return _(L("Connection to Moonraker works correctly."));
}
wxString Mainsail::get_test_failed_msg (wxString &msg) const
wxString Moonraker::get_test_failed_msg (wxString &msg) const
{
return GUI::format_wxstr("%s: %s"
, _L("Could not connect to Mainsail")
, _L("Could not connect to Moonraker")
, msg);
}
bool Mainsail::test(wxString& msg) const
bool Moonraker::test(wxString& msg) const
{
// GET /server/info
@ -142,7 +142,7 @@ bool Mainsail::test(wxString& msg) const
return res;
}
bool Mainsail::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn, InfoFn info_fn) const
bool Moonraker::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, ErrorFn error_fn, InfoFn info_fn) const
{
// POST /server/files/upload
@ -232,7 +232,7 @@ bool Mainsail::upload(PrintHostUpload upload_data, ProgressFn prorgess_fn, Error
return res;
}
void Mainsail::set_auth(Http &http) const
void Moonraker::set_auth(Http &http) const
{
if (!m_apikey.empty())
http.header("X-Api-Key", m_apikey);
@ -240,7 +240,7 @@ void Mainsail::set_auth(Http &http) const
http.ca_file(m_cafile);
}
std::string Mainsail::make_url(const std::string &path) const
std::string Moonraker::make_url(const std::string &path) const
{
if (m_host.find("http://") == 0 || m_host.find("https://") == 0) {
if (m_host.back() == '/') {

View File

@ -1,5 +1,5 @@
#ifndef slic3r_Mainsail_hpp_
#define slic3r_Mainsail_hpp_
#ifndef slic3r_Moonraker_hpp_
#define slic3r_Moonraker_hpp_
#include <string>
#include <wx/string.h>
@ -16,11 +16,11 @@ class DynamicPrintConfig;
class Http;
// https://moonraker.readthedocs.io/en/latest/web_api
class Mainsail : public PrintHost
class Moonraker : public PrintHost
{
public:
Mainsail(DynamicPrintConfig *config);
~Mainsail() override = default;
Moonraker(DynamicPrintConfig *config);
~Moonraker() override = default;
const char* get_name() const override;

View File

@ -19,7 +19,7 @@
#include "AstroBox.hpp"
#include "Repetier.hpp"
#include "MKS.hpp"
#include "Mainsail.hpp"
#include "Moonraker.hpp"
#include "../GUI/PrintHostDialogs.hpp"
namespace fs = boost::filesystem;
@ -55,7 +55,7 @@ PrintHost* PrintHost::get_print_host(DynamicPrintConfig *config)
case htPrusaLink: return new PrusaLink(config);
case htPrusaConnect: return new PrusaConnect(config);
case htMKS: return new MKS(config);
case htMainSail: return new Mainsail(config);
case htMoonraker: return new Moonraker(config);
default: return nullptr;
}
} else {