mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-22 12:33:01 +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
62
src/chat.c
62
src/chat.c
@ -1287,33 +1287,61 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
||||
StatusBar *statusbar = self->stb;
|
||||
wmove(statusbar->topline, 0, 0);
|
||||
|
||||
/* Draw name, status and note in statusbar */
|
||||
if (statusbar->connection != TOX_CONNECTION_NONE) {
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(statusbar->topline, " [");
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
|
||||
switch (statusbar->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));
|
||||
|
||||
Tox_User_Status status = statusbar->status;
|
||||
|
||||
if (status != TOX_USER_STATUS_NONE) {
|
||||
const char *status_text = "ERROR";
|
||||
int colour = MAGENTA;
|
||||
Tox_User_Status status = statusbar->status;
|
||||
|
||||
switch (status) {
|
||||
case TOX_USER_STATUS_NONE:
|
||||
colour = STATUS_ONLINE;
|
||||
break;
|
||||
|
||||
case TOX_USER_STATUS_AWAY:
|
||||
colour = STATUS_AWAY;
|
||||
status_text = "Away";
|
||||
break;
|
||||
|
||||
case TOX_USER_STATUS_BUSY:
|
||||
colour = STATUS_BUSY;
|
||||
status_text = "Busy";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
const char *connection_status_s = statusbar->connection == TOX_CONNECTION_TCP ? "TCP" : "UDP";
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
wprintw(statusbar->topline, " [");
|
||||
wattroff(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
|
||||
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);
|
||||
|
||||
wattron(statusbar->topline, COLOR_PAIR(BAR_ACCENT));
|
||||
@ -1338,20 +1366,8 @@ static void chat_onDraw(ToxWindow *self, Tox *m)
|
||||
wattroff(statusbar->topline, A_BOLD | COLOR_PAIR(BAR_TEXT));
|
||||
}
|
||||
} 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));
|
||||
wprintw(statusbar->topline, "%s", statusbar->nick);
|
||||
wprintw(statusbar->topline, " %s", statusbar->nick);
|
||||
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;
|
||||
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;
|
||||
const char *status_text = "ERROR";
|
||||
|
||||
switch (status) {
|
||||
case TOX_USER_STATUS_NONE:
|
||||
status_text = "Online";
|
||||
colour = STATUS_ONLINE;
|
||||
break;
|
||||
|
||||
case TOX_USER_STATUS_AWAY:
|
||||
status_text = "Away";
|
||||
colour = STATUS_AWAY;
|
||||
status_text = "Away";
|
||||
break;
|
||||
|
||||
case TOX_USER_STATUS_BUSY:
|
||||
status_text = "Busy";
|
||||
colour = STATUS_BUSY;
|
||||
status_text = "Busy";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -379,18 +405,6 @@ static void prompt_onDraw(ToxWindow *self, Tox *m)
|
||||
wprintw(statusbar->topline, " %s", statusbar->nick);
|
||||
pthread_mutex_unlock(&Winthread.lock);
|
||||
} 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));
|
||||
|
||||
pthread_mutex_lock(&Winthread.lock);
|
||||
|
Loading…
Reference in New Issue
Block a user