ENH:update the entrance for model upload

Change-Id: I59a4a9d4802b31871601259c3a5766d789fc3b94
This commit is contained in:
tao wang 2023-06-19 15:52:37 +08:00 committed by Lane.Wei
parent 8e878ae92a
commit cbb69c415a
4 changed files with 43 additions and 26 deletions

View File

@ -0,0 +1,3 @@
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.7212 3.81468L7.23212 1.3256C7.10398 1.19746 6.89622 1.19746 6.76808 1.3256L4.27899 3.81468C4.21746 3.87622 4.18289 3.95968 4.18289 4.0467C4.18289 4.22792 4.32979 4.37483 4.51101 4.37483L6.34377 4.37424L6.34385 8.96858L6.34826 9.04511C6.38617 9.37149 6.66355 9.62483 7.0001 9.62483C7.36253 9.62483 7.65635 9.33102 7.65635 8.96858L7.65627 4.37424L9.48918 4.37483C9.57621 4.37483 9.65967 4.34026 9.7212 4.27872C9.84934 4.15058 9.84934 3.94283 9.7212 3.81468ZM12.869 7.61875C12.869 7.27693 12.5919 6.99983 12.2501 6.99983C11.8924 6.99983 11.5914 7.26785 11.5501 7.62317L11.5306 7.76392C11.1667 9.9373 9.27683 11.5936 7.0001 11.5936C4.75084 11.5936 2.87915 9.97704 2.48345 7.84238L2.47787 7.81098L2.45226 7.62633C2.41148 7.26938 2.10937 6.99983 1.7501 6.99983L1.69071 7.00269C1.35085 7.03549 1.10193 7.33758 1.13474 7.67744L1.15 7.81514L1.18603 8.04498C1.67947 10.8084 4.09481 12.9061 7.0001 12.9061C9.97945 12.9061 12.4436 10.7001 12.8481 7.83235L12.8661 7.67925L12.869 7.61875Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -2993,18 +2993,10 @@ void GUI_App::update_label_colours_from_appconfig()
void GUI_App::update_publish_status()
{
if (app_config->get_country_code() == "CN") {
#ifdef __WINDOWS__
mainframe->m_topbar->show_publish_button(false);
#else
mainframe->show_publish_button(false);
#endif
}
else {
#ifdef __WINDOWS__
mainframe->m_topbar->show_publish_button(true);
#else
mainframe->show_publish_button(true);
#endif
}
}

View File

@ -864,19 +864,7 @@ void MainFrame::update_title()
void MainFrame::show_publish_button(bool show)
{
if (!m_menubar) return;
wxMenu* menu = m_menubar->GetMenu(3);
auto title = menu->GetTitle();
if (show) {
if (title != wxString::Format("&%s", _L("3D Models"))) {
m_menubar->Insert(3, publishMenu, wxString::Format("&%s", _L("3D Models")));
}
}
else {
m_menubar->Remove(3);
}
m_publish_btn->Show(show);
}
void MainFrame::update_title_colour_after_set_title()
@ -1443,14 +1431,18 @@ 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));
sizer->Add(FromDIP(15), 0, 0, 0, 0);
@ -1460,6 +1452,23 @@ 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");
@ -1817,6 +1826,18 @@ void MainFrame::update_side_button_style()
m_slice_btn->SetCornerRadius(FromDIP(12));
m_slice_btn->SetExtraSize(wxSize(FromDIP(38), FromDIP(10)));
m_slice_btn->SetBottomColour(wxColour(0x3B4446));*/
StateColor m_btn_bg_enable = StateColor(
std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed),
std::pair<wxColour, int>(wxColour(48, 221, 112), StateColor::Hovered),
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));
@ -2435,11 +2456,11 @@ void MainFrame::init_menubar_as_editor()
//publish menu
if (m_plater) {
/*if (m_plater) {
publishMenu = new wxMenu();
add_common_publish_menu_items(publishMenu, this);
publishMenu->AppendSeparator();
}
}*/
// View menu
wxMenu* viewMenu = nullptr;
@ -2725,8 +2746,8 @@ void MainFrame::init_menubar_as_editor()
m_menubar->Append(editMenu, wxString::Format("&%s", _L("Edit")));
if (viewMenu)
m_menubar->Append(viewMenu, wxString::Format("&%s", _L("View")));
if (publishMenu)
m_menubar->Append(publishMenu, wxString::Format("&%s", _L("3D Models")));
//if (publishMenu)
// m_menubar->Append(publishMenu, wxString::Format("&%s", _L("3D Models")));
if (helpMenu)
m_menubar->Append(helpMenu, wxString::Format("&%s", _L("Help")));
SetMenuBar(m_menubar);

View File

@ -94,7 +94,7 @@ class MainFrame : public DPIFrame
wxString m_last_config = wxEmptyString;
wxMenuBar* m_menubar{ nullptr };
wxMenu* publishMenu{ nullptr };
//wxMenu* publishMenu{ nullptr };
#if 0
wxMenuItem* m_menu_item_repeat { nullptr }; // doesn't used now
@ -373,6 +373,7 @@ 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 };