Allow port entry in address field.

This commit is contained in:
Bartosz Taudul 2020-03-08 15:02:20 +01:00
parent ff37ab7bc6
commit a6deabaeee

View File

@ -541,7 +541,8 @@ static void DrawContents()
connectClicked |= ImGui::Button( ICON_FA_WIFI " Connect" );
if( connectClicked && *addr && !loadThread.joinable() )
{
std::string addrStr( addr );
const auto addrLen = strlen( addr );
std::string addrStr( addr, addr+addrLen );
auto it = connHistMap.find( addrStr );
if( it != connHistMap.end() )
{
@ -553,8 +554,19 @@ static void DrawContents()
}
connHistVec = RebuildConnectionHistory( connHistMap );
auto ptr = addr + addrLen - 1;
while( ptr > addr && *ptr != ':' ) ptr--;
if( *ptr == ':' )
{
std::string addrPart = std::string( addr, ptr );
uint32_t portPart = atoi( ptr+1 );
view = std::make_unique<tracy::View>( addrPart.c_str(), portPart, fixedWidth, smallFont, bigFont, SetWindowTitleCallback );
}
else
{
view = std::make_unique<tracy::View>( addr, port, fixedWidth, smallFont, bigFont, SetWindowTitleCallback );
}
}
ImGui::SameLine( 0, ImGui::GetFontSize() * 2 );
if( ImGui::Button( ICON_FA_FOLDER_OPEN " Open saved trace" ) && !loadThread.joinable() )
{