mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-13 13:19:05 +08:00
TopBar: Added user name to "Login" button
+ Deleted unused names for mode button
This commit is contained in:
parent
7011322f62
commit
946c0caf78
@ -904,6 +904,12 @@ void MainFrame::set_monitor_tab_url(const wxString& url)
|
||||
m_monitor_webview->load_default_url();
|
||||
}
|
||||
|
||||
void Slic3r::GUI::MainFrame::refresh_auth_menu()
|
||||
{
|
||||
// Update User name in TopBar
|
||||
dynamic_cast<TopBar*>(m_tabpanel)->GetTopBarItemsCtrl()->UpdateAuthMenu();
|
||||
}
|
||||
|
||||
void MainFrame::add_created_tab(Tab* panel, const std::string& bmp_name /*= ""*/)
|
||||
{
|
||||
panel->create_preset_tab();
|
||||
|
@ -223,6 +223,8 @@ public:
|
||||
void set_monitor_tab_url(const wxString& url);
|
||||
bool get_monitor_tab_added() const { return m_monitor_webview_added; }
|
||||
|
||||
void refresh_auth_menu();
|
||||
|
||||
PrintHostQueueDialog* printhost_queue_dlg() { return m_printhost_queue_dlg; }
|
||||
|
||||
Plater* m_plater { nullptr };
|
||||
|
@ -901,6 +901,9 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
||||
std::string text = format(_u8L("Logged as %1%."), username);
|
||||
this->notification_manager->close_notification_of_type(NotificationType::PrusaAuthUserID);
|
||||
this->notification_manager->push_notification(NotificationType::PrusaAuthUserID, NotificationManager::NotificationLevel::ImportantNotificationLevel, text);
|
||||
|
||||
// Update User name in TopBar
|
||||
this->main_frame->refresh_auth_menu();
|
||||
} else {
|
||||
// TODO
|
||||
}
|
||||
|
@ -128,10 +128,7 @@ void TopBarItemsCtrl::ButtonWithPopup::SetLabel(const wxString& label)
|
||||
static wxString get_workspace_name(Slic3r::ConfigOptionMode mode)
|
||||
{
|
||||
return mode == Slic3r::ConfigOptionMode::comSimple ? _L("Beginners") :
|
||||
mode == Slic3r::ConfigOptionMode::comAdvanced ? _L("Regulars") : _L("Josef Prusa");
|
||||
|
||||
return mode == Slic3r::ConfigOptionMode::comSimple ? _L("Beginner workspace") :
|
||||
mode == Slic3r::ConfigOptionMode::comAdvanced ? _L("Regular workspace") : _L("Josef Prusa's workspace");
|
||||
mode == Slic3r::ConfigOptionMode::comAdvanced ? _L("Regulars") : _L("Experts");
|
||||
}
|
||||
|
||||
void TopBarItemsCtrl::ApplyWorkspacesMenu()
|
||||
@ -189,8 +186,14 @@ void TopBarItemsCtrl::UpdateAuthMenu()
|
||||
m_login_menu_item->SetBitmap(user_account->is_logged() ? *get_bmp_bundle("logout", 16) : *get_bmp_bundle("login", 16));
|
||||
}
|
||||
|
||||
const wxString user_name = user_account->is_logged() ? from_u8(user_account->get_username()) : _L("Anonymus");
|
||||
if (m_user_menu_item)
|
||||
m_user_menu_item->SetItemLabel(user_account->is_logged() ? from_u8(user_account->get_username()) : _L("Anonymus"));
|
||||
m_user_menu_item->SetItemLabel(user_name);
|
||||
|
||||
m_auth_btn->SetLabel(user_name);
|
||||
m_auth_btn->SetBitmapMargins(0, 0);
|
||||
// m_auth_btn->SetBitmap_("icon_name");
|
||||
m_auth_btn->Refresh();
|
||||
}
|
||||
|
||||
void TopBarItemsCtrl::CreateSearch()
|
||||
@ -264,7 +267,8 @@ TopBarItemsCtrl::TopBarItemsCtrl(wxWindow *parent) :
|
||||
// create Auth menu
|
||||
CreateAuthMenu();
|
||||
|
||||
m_auth_btn = new ButtonWithPopup(this, "user", 35);
|
||||
// m_auth_btn = new ButtonWithPopup(this, "user", 35);
|
||||
m_auth_btn = new ButtonWithPopup(this, _L("Anonymus"), "user");
|
||||
right_sizer->Add(m_auth_btn, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxRIGHT | wxLEFT, m_btn_margin);
|
||||
|
||||
m_auth_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user