ENH: add publish to makerworld menuitem and remove the original button

jira: new

Change-Id: I253018cf93d8379de1eaff146420103c0d876e16
This commit is contained in:
liz.li 2024-08-27 16:27:07 +08:00 committed by Lane.Wei
parent e3b774c9de
commit 5dbc61737a
3 changed files with 21 additions and 37 deletions

View File

@ -3212,8 +3212,6 @@ void GUI_App::update_label_colours_from_appconfig()
void GUI_App::update_publish_status()
{
mainframe->show_publish_button(has_model_mall());
mainframe->m_webview->ResetWholePage();
}

View File

@ -951,12 +951,6 @@ void MainFrame::update_title()
return;
}
void MainFrame::show_publish_button(bool show)
{
m_publish_btn->Show(show);
Layout();
}
void MainFrame::show_calibration_button(bool show)
{
#ifdef __APPLE__
@ -1562,17 +1556,14 @@ wxBoxSizer* MainFrame::create_side_tools()
m_slice_select = eSlicePlate;
m_print_select = ePrintPlate;
m_publish_btn = new Button(this, _L("Upload"), "bar_publish", 0, FromDIP(16));
m_slice_btn = new SideButton(this, _L("Slice plate"), "");
m_slice_option_btn = new SideButton(this, "", "sidebutton_dropdown", 0, FromDIP(14));
m_print_btn = new SideButton(this, _L("Print plate"), "");
m_print_option_btn = new SideButton(this, "", "sidebutton_dropdown", 0, FromDIP(14));
update_side_button_style();
m_publish_btn->Hide();
m_slice_option_btn->Enable();
m_print_option_btn->Enable();
sizer->Add(m_publish_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
sizer->Add(FromDIP(15), 0, 0, 0, 0);
sizer->Add(m_slice_option_btn, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
sizer->Add(m_slice_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(1));
@ -1583,23 +1574,6 @@ wxBoxSizer* MainFrame::create_side_tools()
sizer->Layout();
m_publish_btn->Bind(wxEVT_BUTTON, [this](auto& e) {
CallAfter([this] {
wxGetApp().open_publish_page_dialog();
if (!wxGetApp().getAgent()) {
BOOST_LOG_TRIVIAL(info) << "publish: no agent";
return;
}
// record
json j;
NetworkAgent* agent = GUI::wxGetApp().getAgent();
if (agent)
agent->track_event("enter_model_mall", j.dump());
});
});
m_slice_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event)
{
//this->m_plater->select_view_3D("Preview");
@ -1989,13 +1963,6 @@ void MainFrame::update_side_button_style()
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Normal)
);
m_publish_btn->SetMinSize(wxSize(FromDIP(125), FromDIP(24)));
m_publish_btn->SetCornerRadius(FromDIP(12));
m_publish_btn->SetBackgroundColor(m_btn_bg_enable);
m_publish_btn->SetBorderColor(m_btn_bg_enable);
m_publish_btn->SetBackgroundColour(wxColour(59,68,70));
m_publish_btn->SetTextColor(StateColor::darkModeColorFor("#FFFFFE"));
m_slice_btn->SetTextLayout(SideButton::EHorizontalOrientation::HO_Left, FromDIP(15));
m_slice_btn->SetCornerRadius(FromDIP(12));
m_slice_btn->SetExtraSize(wxSize(FromDIP(38), FromDIP(10)));
@ -2419,6 +2386,27 @@ void MainFrame::init_menubar_as_editor()
append_submenu(fileMenu, export_menu, wxID_ANY, _L("Export"), "");
// Publish to MakerWorld
append_menu_item(
fileMenu, wxID_ANY, _L("Publish to MakerWorld"), _L("Publish to MakerWorld"),
[this](wxCommandEvent &) {
CallAfter([this] {
wxGetApp().open_publish_page_dialog();
if (!wxGetApp().getAgent()) {
BOOST_LOG_TRIVIAL(info) << "publish: no agent";
return;
}
// record
json j;
NetworkAgent *agent = GUI::wxGetApp().getAgent();
if (agent) agent->track_event("enter_model_mall", j.dump());
});
},
"", nullptr,
[this](){ return wxGetApp().has_model_mall(); }, this);
fileMenu->AppendSeparator();
#ifndef __APPLE__

View File

@ -257,7 +257,6 @@ public:
void update_title();
void set_max_recent_count(int max);
void show_publish_button(bool show);
void show_calibration_button(bool show);
void update_title_colour_after_set_title();
@ -385,7 +384,6 @@ public:
// BBS
mutable int m_print_select{ ePrintAll };
mutable int m_slice_select{ eSliceAll };
Button* m_publish_btn{ nullptr };
SideButton* m_slice_btn{ nullptr };
SideButton* m_slice_option_btn{ nullptr };
SideButton* m_print_btn{ nullptr };