Skip to content

Commit 216fc35

Browse files
committed
MyFrameMain: adapt notebook page label display
re #200
1 parent d548abd commit 216fc35

File tree

1 file changed

+37
-14
lines changed

1 file changed

+37
-14
lines changed

src/gui/MyFrameMain.cpp

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -340,12 +340,23 @@ void MyFrameMain::onVNCConnInitNotify(wxCommandEvent& event)
340340
switch(event.GetInt()) {
341341
case VNCConn::InitState::CONNECT_SUCCESS:
342342
// update page label
343-
if (!c->getRepeaterId().IsEmpty())
344-
notebook_connections->SetPageText(index, wxString::Format(_("Connected to %s, waiting for peer %s"),
345-
c->getServerHost(),
346-
c->getRepeaterId()));
347-
else
348-
notebook_connections->SetPageText(index, wxString::Format(_("Connected to %s"),c->getServerHost()));
343+
{
344+
wxString label;
345+
if (c->getSshHost().IsEmpty()) {
346+
if (c->getRepeaterId().IsEmpty()) {
347+
label = wxString::Format(_("Connected to %s"),c->getServerHost());
348+
} else {
349+
label = wxString::Format(_("Connected to %s, waiting for peer %s"), c->getServerHost(), c->getRepeaterId());
350+
}
351+
} else {
352+
if (c->getRepeaterId().IsEmpty()) {
353+
label = wxString::Format(_("Connected to %s via %s"),c->getServerHost(), c->getSshHost());
354+
} else {
355+
label = wxString::Format(_("Connected to %s via %s, waiting for peer %s"), c->getSshHost(), c->getServerHost(), c->getRepeaterId());
356+
}
357+
}
358+
notebook_connections->SetPageText(index, label);
359+
}
349360
break;
350361
case VNCConn::InitState::CONNECT_FAIL:
351362
case VNCConn::InitState::INITIALISE_FAIL:
@@ -1050,14 +1061,26 @@ void MyFrameMain::conn_setup(VNCConn *c) {
10501061
c->doStats(true);
10511062

10521063
// set page label
1053-
if(!c->getListenPort().IsEmpty())
1054-
notebook_connections->SetPageText(index, c->getDesktopName() + " " + _("(Reverse Connection)"));
1055-
else if (!c->getRepeaterId().IsEmpty())
1056-
notebook_connections->SetPageText(index, c->getDesktopName() + " " + wxString::Format(_("(peer %s on %s)"),
1057-
c->getRepeaterId(),
1058-
c->getServerHost()));
1059-
else
1060-
notebook_connections->SetPageText(index, c->getDesktopName() + wxT(" (") + c->getServerHost() + wxT(")"));
1064+
wxString label;
1065+
if(!c->getListenPort().IsEmpty()) {
1066+
label = c->getDesktopName() + " " + _("(Reverse Connection)");
1067+
} else {
1068+
if (c->getSshHost().IsEmpty()) {
1069+
if (c->getRepeaterId().IsEmpty()) {
1070+
label = wxString::Format("%s (%s)", c->getDesktopName(), c->getServerHost());
1071+
} else {
1072+
label = wxString::Format(_("%s (peer %s on %s)"), c->getDesktopName(), c->getRepeaterId(), c->getServerHost());
1073+
}
1074+
} else {
1075+
if (c->getRepeaterId().IsEmpty()) {
1076+
label = wxString::Format(_("%s (%s via %s)"), c->getDesktopName(), c->getServerHost(), c->getSshHost());
1077+
} else {
1078+
label = wxString::Format(_("%s (peer %s on %s via %s)"), c->getDesktopName(), c->getRepeaterId(), c->getServerHost(), c->getSshHost());
1079+
}
1080+
}
1081+
}
1082+
notebook_connections->SetPageText(index, label);
1083+
10611084

10621085
if(c->isMulticast())
10631086
notebook_connections->SetPageImage(index, 1);

0 commit comments

Comments
 (0)