Show connection status in the statusbar

This commit is contained in:
Daniel Collin 2012-11-10 13:27:13 +01:00
parent 95c27ca5a8
commit 893d4c0467
3 changed files with 21 additions and 2 deletions

View File

@ -115,7 +115,9 @@ static char s_endRow[64] = "10000";
static int drawConnectionStatus(int posX, int sizeY)
{
char conStatus[64] = "Not Connected";
char* conStatus;
RemoteConnection_getConnectionStatus(&conStatus);
Emgui_drawBorder(Emgui_color32(10, 10, 10, 255), Emgui_color32(10, 10, 10, 255), posX, sizeY - 17, 200, 15);
Emgui_drawText(conStatus, posX + 4, sizeY - 15, Emgui_color32(160, 160, 160, 255));

View File

@ -39,6 +39,7 @@ static int s_clientIndex;
int s_socket = INVALID_SOCKET;
int s_serverSocket = INVALID_SOCKET;
static bool s_paused = true;
static char s_connectionName[256];
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -219,7 +220,8 @@ void RemoteConnection_updateListner()
if (INVALID_SOCKET != clientSocket)
{
rlog(R_INFO, "Connected to %s\n", inet_ntoa(client.sin_addr));
snprintf(s_connectionName, sizeof(s_connectionName), "Connected to %s", inet_ntoa(client.sin_addr));
rlog(R_INFO, "%s\n", s_connectionName);
s_socket = clientSocket;
s_clientIndex = 0;
RemoteConnection_sendPauseCommand(true);
@ -407,6 +409,19 @@ bool RemoteConnection_isPaused()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void RemoteConnection_getConnectionStatus(char** status)
{
if (!RemoteConnection_connected())
{
*status = "Not Connected";
return;
}
*status = s_connectionName;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void RemoteConnection_sendKeyFrames(const char* name, struct sync_track* track)
{
int i, track_id = findTrack(name);

View File

@ -31,3 +31,5 @@ void RemoteConnection_sendSaveCommand();
void RemoteConnection_sendKeyFrames(const char* name, struct sync_track* track);
void RemoteConnection_mapTrackName(const char* name);
void RemoteConnection_getConnectionStatus(char** status);