mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 22:13:02 +01:00
Show self connection type and small UI makeover
Connection type is now separated from status in the top status bar
This commit is contained in:
parent
50a074ed22
commit
1cba726bb8
60
src/chat.c
60
src/chat.c
@ -1287,33 +1287,61 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
|||||||
StatusBar *statusbar = self->stb;
|
StatusBar *statusbar = self->stb;
|
||||||
wmove(statusbar->topline, 0, 0);
|
wmove(statusbar->topline, 0, 0);
|
||||||
|
|
||||||
/* Draw name, status and note in statusbar */
|
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||||
if (statusbar->connection != TOX_CONNECTION_NONE) {
|
wprintw(statusbar->topline, " [");
|
||||||
int colour = MAGENTA;
|
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||||
Tox_User_Status status = statusbar->status;
|
|
||||||
|
|
||||||
switch (status) {
|
switch (statusbar->connection) {
|
||||||
case TOX_USER_STATUS_NONE:
|
case TOX_CONNECTION_TCP:
|
||||||
colour = STATUS_ONLINE;
|
wattron(statusbar->topline, A_BOLD | COLOR_PAIR(STATUS_ONLINE));
|
||||||
|
wprintw(statusbar->topline, "TCP");
|
||||||
|
wattroff(statusbar->topline, A_BOLD | COLOR_PAIR(STATUS_ONLINE));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TOX_CONNECTION_UDP:
|
||||||
|
wattron(statusbar->topline, A_BOLD | COLOR_PAIR(STATUS_ONLINE));
|
||||||
|
wprintw(statusbar->topline, "UDP");
|
||||||
|
wattroff(statusbar->topline, A_BOLD | COLOR_PAIR(STATUS_ONLINE));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||||
|
wprintw(statusbar->topline, "Offline");
|
||||||
|
wattroff(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||||
|
wprintw(statusbar->topline, "]");
|
||||||
|
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||||
|
|
||||||
|
Tox_User_Status status = statusbar->status;
|
||||||
|
|
||||||
|
if (status != TOX_USER_STATUS_NONE) {
|
||||||
|
const char *status_text = "ERROR";
|
||||||
|
int colour = MAGENTA;
|
||||||
|
|
||||||
|
switch (status) {
|
||||||
case TOX_USER_STATUS_AWAY:
|
case TOX_USER_STATUS_AWAY:
|
||||||
colour = STATUS_AWAY;
|
colour = STATUS_AWAY;
|
||||||
|
status_text = "Away";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOX_USER_STATUS_BUSY:
|
case TOX_USER_STATUS_BUSY:
|
||||||
colour = STATUS_BUSY;
|
colour = STATUS_BUSY;
|
||||||
|
status_text = "Busy";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *connection_status_s = statusbar->connection == TOX_CONNECTION_TCP ? "TCP" : "UDP";
|
|
||||||
|
|
||||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||||
wprintw(statusbar->topline, " [");
|
wprintw(statusbar->topline, " [");
|
||||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||||
|
|
||||||
wattron(statusbar->topline, COLOR_PAIR(colour) | A_BOLD);
|
wattron(statusbar->topline, COLOR_PAIR(colour) | A_BOLD);
|
||||||
wprintw(statusbar->topline, "%s", connection_status_s);
|
wprintw(statusbar->topline, "%s", status_text);
|
||||||
wattroff(statusbar->topline, COLOR_PAIR(colour) | A_BOLD);
|
wattroff(statusbar->topline, COLOR_PAIR(colour) | A_BOLD);
|
||||||
|
|
||||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||||
@ -1338,18 +1366,6 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
|||||||
wattroff(statusbar->topline, A_BOLD | COLOR_PAIR(BAR_TEXT));
|
wattroff(statusbar->topline, A_BOLD | COLOR_PAIR(BAR_TEXT));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
|
||||||
wprintw(statusbar->topline, " [");
|
|
||||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
|
||||||
|
|
||||||
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
|
||||||
wprintw(statusbar->topline, "Offline");
|
|
||||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
|
||||||
|
|
||||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
|
||||||
wprintw(statusbar->topline, "] ");
|
|
||||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
|
||||||
|
|
||||||
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||||
wprintw(statusbar->topline, " %s", statusbar->nick);
|
wprintw(statusbar->topline, " %s", statusbar->nick);
|
||||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
wattroff(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||||
|
54
src/prompt.c
54
src/prompt.c
@ -340,24 +340,50 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
|
|||||||
Tox_User_Status status = statusbar->status;
|
Tox_User_Status status = statusbar->status;
|
||||||
pthread_mutex_unlock(&Winthread.lock);
|
pthread_mutex_unlock(&Winthread.lock);
|
||||||
|
|
||||||
if (connection != TOX_CONNECTION_NONE) {
|
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||||
|
wprintw(statusbar->topline, " [");
|
||||||
|
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||||
|
|
||||||
|
switch (connection) {
|
||||||
|
case TOX_CONNECTION_TCP:
|
||||||
|
wattron(statusbar->topline, A_BOLD | COLOR_PAIR(STATUS_ONLINE));
|
||||||
|
wprintw(statusbar->topline, "TCP");
|
||||||
|
wattroff(statusbar->topline, A_BOLD | COLOR_PAIR(STATUS_ONLINE));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case TOX_CONNECTION_UDP:
|
||||||
|
wattron(statusbar->topline, A_BOLD | COLOR_PAIR(STATUS_ONLINE));
|
||||||
|
wprintw(statusbar->topline, "UDP");
|
||||||
|
wattroff(statusbar->topline, A_BOLD | COLOR_PAIR(STATUS_ONLINE));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||||
|
wprintw(statusbar->topline, "Offline");
|
||||||
|
wattroff(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||||
|
wprintw(statusbar->topline, "]");
|
||||||
|
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||||
|
|
||||||
|
if (status != TOX_USER_STATUS_NONE) {
|
||||||
int colour = MAGENTA;
|
int colour = MAGENTA;
|
||||||
const char *status_text = "ERROR";
|
const char *status_text = "ERROR";
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case TOX_USER_STATUS_NONE:
|
|
||||||
status_text = "Online";
|
|
||||||
colour = STATUS_ONLINE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TOX_USER_STATUS_AWAY:
|
case TOX_USER_STATUS_AWAY:
|
||||||
status_text = "Away";
|
|
||||||
colour = STATUS_AWAY;
|
colour = STATUS_AWAY;
|
||||||
|
status_text = "Away";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TOX_USER_STATUS_BUSY:
|
case TOX_USER_STATUS_BUSY:
|
||||||
status_text = "Busy";
|
|
||||||
colour = STATUS_BUSY;
|
colour = STATUS_BUSY;
|
||||||
|
status_text = "Busy";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,18 +405,6 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
|
|||||||
wprintw(statusbar->topline, " %s", statusbar->nick);
|
wprintw(statusbar->topline, " %s", statusbar->nick);
|
||||||
pthread_mutex_unlock(&Winthread.lock);
|
pthread_mutex_unlock(&Winthread.lock);
|
||||||
} else {
|
} else {
|
||||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
|
||||||
wprintw(statusbar->topline, " [");
|
|
||||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
|
||||||
|
|
||||||
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
|
||||||
wprintw(statusbar->topline, "Offline");
|
|
||||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
|
||||||
|
|
||||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
|
||||||
wprintw(statusbar->topline, "]");
|
|
||||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
|
||||||
|
|
||||||
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
wattron(statusbar->topline, COLOR_PAIR(BAR_TEXT));
|
||||||
|
|
||||||
pthread_mutex_lock(&Winthread.lock);
|
pthread_mutex_lock(&Winthread.lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user