Insert "Connect" tab to position next to "Printer" tab

This commit is contained in:
YuSanka 2024-04-23 12:44:30 +02:00 committed by Lukas Matena
parent 0848fecb02
commit 835c24cfc1

View File

@ -742,10 +742,12 @@ void MainFrame::add_connect_webview_tab()
{ {
if (m_connect_webview_added) { if (m_connect_webview_added) {
return; return;
} // parameters of InsertNewPage (to prevent ambigous overloaded function) }
// insert to positon 4, if physical printer is already added, it moves to 5 // parameters of InsertNewPage (to prevent ambigous overloaded function)
// insert "Connect" tab to position next to "Printer" tab
// order of tabs: Plater - Print Settings - Filaments - Printers - Prusa Connect - Prusa Link // order of tabs: Plater - Print Settings - Filaments - Printers - Prusa Connect - Prusa Link
size_t n = 4;
int n = m_tabpanel->FindPage(wxGetApp().get_tab(Preset::TYPE_PRINTER)) + 1;
wxWindow* page = m_connect_webview; wxWindow* page = m_connect_webview;
const wxString text(L"Prusa Connect"); const wxString text(L"Prusa Connect");
const std::string bmp_name = ""; const std::string bmp_name = "";
@ -759,10 +761,10 @@ void MainFrame::remove_connect_webview_tab()
if (!m_connect_webview_added) { if (!m_connect_webview_added) {
return; return;
} }
// connect tab should always be at position 4 int n = m_tabpanel->FindPage(m_connect_webview);
if (m_tabpanel->GetSelection() == 4) if (m_tabpanel->GetSelection() == n)
m_tabpanel->SetSelection(0); m_tabpanel->SetSelection(0);
m_tabpanel->RemovePage(4); m_tabpanel->RemovePage(size_t(n));
m_connect_webview_added = false; m_connect_webview_added = false;
m_connect_webview->logout(); m_connect_webview->logout();
} }