FIX:hide publish in the Chinese region

Change-Id: I39e6d96ab6fa14f25a284a5eaf9988dd37a42b6a
This commit is contained in:
tao wang 2023-04-19 19:59:07 +08:00 committed by Lane.Wei
parent b6005e957c
commit 2dbd2bcef9
7 changed files with 53 additions and 1 deletions

View file

@ -254,7 +254,7 @@ void BBLTopbar::Init(wxFrame* parent)
m_publish_item = this->AddTool(ID_PUBLISH, "", m_publish_bitmap);
m_publish_disable_bitmap = create_scaled_bitmap("topbar_publish_disable", nullptr, TOPBAR_ICON_SIZE);
m_publish_item->SetDisabledBitmap(m_publish_disable_bitmap);
this->EnableTool(m_publish_item->GetId(), true);
this->EnableTool(m_publish_item->GetId(), false);
this->AddSpacer(FromDIP(4));
/*wxBitmap model_store_bitmap = create_scaled_bitmap("topbar_store", nullptr, TOPBAR_ICON_SIZE);
@ -324,6 +324,12 @@ void BBLTopbar::OnOpenProject(wxAuiToolBarEvent& event)
plater->load_project();
}
void BBLTopbar::show_publish_button(bool show)
{
this->EnableTool(m_publish_item->GetId(), show);
Refresh();
}
void BBLTopbar::OnSaveProject(wxAuiToolBarEvent& event)
{
MainFrame* main_frame = dynamic_cast<MainFrame*>(m_frame);

View file

@ -30,6 +30,7 @@ public:
void OnMouseCaptureLost(wxMouseCaptureLostEvent& event);
void OnMenuClose(wxMenuEvent& event);
void OnOpenProject(wxAuiToolBarEvent& event);
void show_publish_button(bool show);
void OnSaveProject(wxAuiToolBarEvent& event);
void OnUndo(wxAuiToolBarEvent& event);
void OnRedo(wxAuiToolBarEvent& event);

View file

@ -2673,6 +2673,9 @@ bool GUI_App::on_init_inner()
request_model_download(m_download_file_url);
m_download_file_url = "";
}
update_publish_status();
}
});
@ -2911,6 +2914,24 @@ 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
}
}
void GUI_App::update_label_colours()
{
for (Tab* tab : tabs_list)
@ -3279,6 +3300,9 @@ void GUI_App::recreate_GUI(const wxString& msg_name)
// config_wizard_startup(true);
// });
update_publish_status();
m_is_recreating_gui = false;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "recreate_GUI exit";

View file

@ -332,6 +332,7 @@ public:
const wxColour get_label_default_clr_modified();
void init_label_colours();
void update_label_colours_from_appconfig();
void update_publish_status();
void update_label_colours();
// update color mode for window
void UpdateDarkUI(wxWindow *window, bool highlited = false, bool just_font = false);

View file

@ -846,6 +846,23 @@ void MainFrame::update_title()
return;
}
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);
}
}
void MainFrame::update_title_colour_after_set_title()
{
#ifdef __APPLE__

View file

@ -246,6 +246,8 @@ public:
void update_title();
void set_max_recent_count(int max);
void show_publish_button(bool show);
void update_title_colour_after_set_title();
void show_option(bool show);
void init_tabpanel();

View file

@ -280,6 +280,7 @@ wxBoxSizer *PreferencesDialog::create_item_region_combobox(wxString title, wxWin
config->set("region", region.ToStdString());
}
wxGetApp().update_publish_status();
e.Skip();
});