diff options
author | James Booth <boothj5@gmail.com> | 2016-01-21 00:50:55 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2016-01-21 00:50:55 +0000 |
commit | adb470c454338fd6e52528c22d44a26eb246732d (patch) | |
tree | b64c8b82726188c43de574b509aea5788291be6e | |
parent | 5bccee93cc0c8c2426d5f5acc462dca15467cb08 (diff) | |
download | profani-tty-adb470c454338fd6e52528c22d44a26eb246732d.tar.gz |
WIP: Add /theme properties command
-rw-r--r-- | src/command/command.c | 7 | ||||
-rw-r--r-- | src/command/commands.c | 2 | ||||
-rw-r--r-- | src/ui/console.c | 100 | ||||
-rw-r--r-- | src/ui/ui.h | 1 | ||||
-rw-r--r-- | src/ui/window.c | 4 | ||||
-rw-r--r-- | tests/unittests/ui/stub_ui.c | 1 | ||||
-rw-r--r-- | themes/bios | 125 | ||||
-rw-r--r-- | themes/boothj5 | 2 |
8 files changed, 239 insertions, 3 deletions
diff --git a/src/command/command.c b/src/command/command.c index 8bda6d4b..3f4e4a7d 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -1727,13 +1727,15 @@ static struct cmd_t command_defs[] = CMD_SYN( "/theme list", "/theme load <theme>", - "/theme colours") + "/theme colours", + "/theme properties") CMD_DESC( "Load a theme, includes colours and UI options.") CMD_ARGS( { "list", "List all available themes." }, { "load <theme>", "Load the specified theme. 'default' will reset to the default theme." }, - { "colours", "Show the colour values as rendered by the terminal." }) + { "colours", "Show the colour values as rendered by the terminal." }, + { "properties", "Show each themed property." }) CMD_EXAMPLES( "/theme list", "/theme load forest") @@ -2106,6 +2108,7 @@ cmd_init(void) autocomplete_add(theme_ac, "load"); autocomplete_add(theme_ac, "list"); autocomplete_add(theme_ac, "colours"); + autocomplete_add(theme_ac, "properties"); disco_ac = autocomplete_new(); autocomplete_add(disco_ac, "info"); diff --git a/src/command/commands.c b/src/command/commands.c index ba84b4bc..7679acb4 100644 --- a/src/command/commands.c +++ b/src/command/commands.c @@ -1401,6 +1401,8 @@ cmd_theme(ProfWin *window, const char *const command, gchar **args) // show colours } else if (g_strcmp0(args[0], "colours") == 0) { cons_theme_colours(); + } else if (g_strcmp0(args[0], "properties") == 0) { + cons_theme_properties(); } else { cons_bad_cmd_usage(command); } diff --git a/src/ui/console.c b/src/ui/console.c index 39de1ae7..f4cf3d44 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -2004,6 +2004,106 @@ cons_get_string(ProfConsoleWin *conswin) } void +cons_theme_properties(void) +{ + ProfWin *console = wins_get_console(); + cons_show("Title bar:"); + win_print(console, '-', 0, NULL, NO_EOL, THEME_TITLE_TEXT, "", "titlebar.text "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_TITLE_BRACKET, "", "titlebar.brackets"); + win_print(console, '-', 0, NULL, NO_DATE, THEME_TEXT, "", ""); + + win_print(console, '-', 0, NULL, NO_EOL, THEME_TITLE_UNENCRYPTED, "", "titlebar.unencrypted "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_TITLE_ENCRYPTED, "", "titlebar.encrypted "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_TITLE_UNTRUSTED, "", "titlebar.untrusted "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_TITLE_TRUSTED, "", "titlebar.trusted"); + win_print(console, '-', 0, NULL, NO_DATE, THEME_TEXT, "", ""); + + win_print(console, '-', 0, NULL, NO_EOL, THEME_TITLE_CHAT, "", "titlebar.chat "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_TITLE_ONLINE, "", "titlebar.online "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_TITLE_AWAY, "", "titlebar.away "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_TITLE_XA, "", "titlebar.xa "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_TITLE_DND, "", "titlebar.dnd "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_TITLE_OFFLINE, "", "titlebar.offline"); + win_print(console, '-', 0, NULL, NO_DATE, THEME_TEXT, "", ""); + + cons_show(""); + cons_show("Status bar:"); + win_print(console, '-', 0, NULL, NO_EOL, THEME_STATUS_TEXT, "", "statusbar.text "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_STATUS_BRACKET, "", "statusbar.brackets "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_STATUS_ACTIVE, "", "statusbar.active "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_STATUS_NEW, "", "statusbar.new"); + win_print(console, '-', 0, NULL, NO_DATE, THEME_TEXT, "", ""); + + cons_show(""); + cons_show("Main text:"); + win_print(console, '-', 0, NULL, NO_EOL, THEME_TIME, "", "main.time "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_TEXT, "", "main.text "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_SPLASH, "", "main.splash "); + win_print(console, '-', 0, NULL, NO_DATE, THEME_ERROR, "", "error"); + win_print(console, '-', 0, NULL, NO_EOL, THEME_OTR_STARTED_TRUSTED, "", "otr.started.trusted "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_OTR_STARTED_UNTRUSTED, "", "otr.started.untrusted "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_OTR_ENDED, "", "otr.ended "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_OTR_TRUSTED, "", "otr.trusted "); + win_print(console, '-', 0, NULL, NO_DATE, THEME_OTR_UNTRUSTED, "", "otr.untrusted"); + + cons_show(""); + cons_show("Messages:"); + win_print(console, '-', 0, NULL, NO_EOL, THEME_ME, "", "me "); + win_print(console, '-', 0, NULL, NO_DATE, THEME_TEXT_ME, "", "main.text.me"); + win_print(console, '-', 0, NULL, NO_EOL, THEME_THEM, "", "them "); + win_print(console, '-', 0, NULL, NO_DATE, THEME_TEXT_THEM, "", "main.text.them"); + + cons_show(""); + cons_show("Presence:"); + win_print(console, '-', 0, NULL, NO_EOL, THEME_CHAT, "", "chat "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_ONLINE, "", "online "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_AWAY, "", "away "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_XA, "", "xa "); + win_print(console, '-', 0, NULL, NO_DATE | NO_EOL, THEME_DND, "", "dnd "); + win_print(console, '-', 0, NULL, NO_DATE, THEME_OFFLINE, "", "offline"); + win_print(console, '-', 0, NULL, NO_EOL, THEME_SUBSCRIBED, "", "subscribed "); + win_print(console, '-', 0, NULL, NO_DATE, THEME_UNSUBSCRIBED, "", "unsubscribed"); + + cons_show(""); + win_print(console, '-', 0, NULL, 0, THEME_INCOMING, "", "incoming"); + win_print(console, '-', 0, NULL, 0, THEME_TYPING, "", "typing"); + win_print(console, '-', 0, NULL, 0, THEME_GONE, "", "gone"); + + win_print(console, '-', 0, NULL, 0, THEME_ROOMINFO, "", "roominfo"); + win_print(console, '-', 0, NULL, 0, THEME_ROOMMENTION, "", "roommention"); + + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_HEADER, "", "roster.header"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_CHAT, "", "roster.chat"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_ONLINE, "", "roster.online"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_AWAY, "", "roster.away"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_XA, "", "roster.xa"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_DND, "", "roster.dnd"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_OFFLINE, "", "roster.offline"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_CHAT_ACTIVE, "", "roster.chat.active"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_ONLINE_ACTIVE, "", "roster.online.active"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_AWAY_ACTIVE, "", "roster.away.active"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_XA_ACTIVE, "", "roster.xa.active"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_DND_ACTIVE, "", "roster.dnd.active"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_OFFLINE_ACTIVE, "", "roster.offline.active"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_CHAT_UNREAD, "", "roster.chat.unread"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_ONLINE_UNREAD, "", "roster.online.unread"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_AWAY_UNREAD, "", "roster.away.unread"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_XA_UNREAD, "", "roster.xa.unread"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_DND_UNREAD, "", "roster.dnd.unread"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_OFFLINE_UNREAD, "", "roster.offline.unread"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_ROOM, "", "roster.room"); + win_print(console, '-', 0, NULL, 0, THEME_ROSTER_ROOM_UNREAD, "", "roster.room.unread"); + + win_print(console, '-', 0, NULL, 0, THEME_OCCUPANTS_HEADER, "", "occupants.header"); + + win_print(console, '-', 0, NULL, 0, THEME_RECEIPT_SENT, "", "receipt.sent"); + + win_print(console, '-', 0, NULL, 0, THEME_INPUT_TEXT, "", "input.text"); + + cons_show(""); +} + +void cons_theme_colours(void) { /* diff --git a/src/ui/ui.h b/src/ui/ui.h index 6398381d..8fea6eb1 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -301,6 +301,7 @@ void cons_autoconnect_setting(void); void cons_inpblock_setting(void); void cons_show_contact_online(PContact contact, Resource *resource, GDateTime *last_activity); void cons_show_contact_offline(PContact contact, char *resource, char *status); +void cons_theme_properties(void); void cons_theme_colours(void); void cons_show_tlscert(TLSCertificate *cert); void cons_show_tlscert_summary(TLSCertificate *cert); diff --git a/src/ui/window.c b/src/ui/window.c index 33db89c6..d749ac84 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -1086,6 +1086,7 @@ _win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim if ((flags & NO_DATE) == 0) { if (date_fmt && strlen(date_fmt)) { if ((flags & NO_COLOUR_DATE) == 0) { + wbkgdset(window->layout->win, theme_attrs(THEME_TIME)); wattron(window->layout->win, theme_attrs(THEME_TIME)); } wprintw(window->layout->win, "%s %c ", date_fmt, show_char); @@ -1108,6 +1109,7 @@ _win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim colour = theme_attrs(THEME_RECEIPT_SENT); } + wbkgdset(window->layout->win, colour); wattron(window->layout->win, colour); if (strncmp(message, "/me ", 4) == 0) { wprintw(window->layout->win, "*%s ", from); @@ -1121,8 +1123,10 @@ _win_print(ProfWin *window, const char show_char, int pad_indent, GDateTime *tim if (!me_message) { if (receipt && !receipt->received) { + wbkgdset(window->layout->win, theme_attrs(THEME_RECEIPT_SENT)); wattron(window->layout->win, theme_attrs(THEME_RECEIPT_SENT)); } else { + wbkgdset(window->layout->win, theme_attrs(theme_item)); wattron(window->layout->win, theme_attrs(theme_item)); } } diff --git a/tests/unittests/ui/stub_ui.c b/tests/unittests/ui/stub_ui.c index 019ea84e..4235e10f 100644 --- a/tests/unittests/ui/stub_ui.c +++ b/tests/unittests/ui/stub_ui.c @@ -444,6 +444,7 @@ void cons_show_contact_online(PContact contact, Resource *resource, GDateTime *l void cons_show_contact_offline(PContact contact, char *resource, char *status) {} void cons_theme_colours(void) {} +void cons_theme_properties(void) {} // title bar void title_bar_set_presence(contact_presence_t presence) {} diff --git a/themes/bios b/themes/bios new file mode 100644 index 00000000..28239599 --- /dev/null +++ b/themes/bios @@ -0,0 +1,125 @@ +[colours] +bkgnd=blue +titlebar=white +titlebar.text=black +titlebar.brackets=black +titlebar.unencrypted=black +titlebar.encrypted=black +titlebar.untrusted=black +titlebar.trusted=black +titlebar.online=black +titlebar.offline=black +titlebar.away=black +titlebar.xa=black +titlebar.dnd=black +titlebar.chat=black +statusbar=white +statusbar.text=black +statusbar.brackets=black +statusbar.active=black +statusbar.new=black +main.text=white +main.text.me=cyan +main.text.them=bold_white +main.splash=bold_green +main.time=bold_cyan +input.text=bold_white +subscribed=bold_green +unsubscribed=red +otr.started.trusted=green +otr.started.untrusted=yellow +otr.ended=red +otr.trusted=green +otr.untrusted=yellow +online=bold_green +away=bold_cyan +chat=bold_white +dnd=magenta +xa=bold_blue +offline=red +incoming=bold_yellow +typing=yellow +gone=red +error=red +roominfo=yellow +roommention=bold_red +me=blue +them=bold_green +roster.header=bold_yellow +roster.chat=white +roster.online=green +roster.away=cyan +roster.xa=blue +roster.dnd=magenta +roster.offline=red +roster.chat.active=white +roster.online.active=green +roster.away.active=cyan +roster.xa.active=blue +roster.dnd.active=magenta +roster.offline.active=red +roster.chat.unread=bold_white +roster.online.unread=bold_green +roster.away.unread=bold_cyan +roster.xa.unread=bold_blue +roster.dnd.unread=bold_magenta +roster.offline.unread=bold_red +roster.room=green +roster.room.unread=bold_green +occupants.header=bold_yellow +receipt.sent=bold_black + +[ui] +beep=false +flash=false +splash=true +wrap=true +time.console=%H:%M:%S +time.chat=%d/%m/%y %H:%M:%S +time.muc=%d/%m/%y %H:%M:%S +time.mucconfig=off +time.private=%d/%m/%y %H:%M:%S +time.xml=%H:%M:%S +time.statusbar=%H:%M:%S +time.lastactivity=%d/%m/%y %H:%M:%S +privileges=true +presence=true +intype=true +enc.warn=true +resource.title=true +resource.message=true +statuses.console=all +statuses.chat=all +statuses.muc=none +roster=true +roster.offline=true +roster.empty=false +roster.by=group +roster.order=presence +roster.unread=before +roster.count=true +roster.priority=false +roster.size=25 +roster.wrap=true +roster.header.char=@ +roster.contact.indent=1 +roster.resource=true +roster.resource.char=/ +roster.resource.indent=1 +roster.resource.join=true +roster.presence=true +roster.presence.indent=-1 +roster.status=true +roster.contacts=true +roster.rooms=true +roster.rooms.order=name +roster.rooms.unread=before +roster.rooms.pos=last +occupants=true +occupants.size=15 +occupants.jid=false +wins.autotidy=true +otr.char=@ +pgp.char=% +tls.show=true +console.muc=first diff --git a/themes/boothj5 b/themes/boothj5 index 0576fc91..54f186b3 100644 --- a/themes/boothj5 +++ b/themes/boothj5 @@ -1,7 +1,7 @@ [colours] bkgnd=default titlebar=blue -titlebar.text=bold_white +titlebar.text=white titlebar.brackets=white titlebar.unencrypted=bold_red titlebar.encrypted=bold_white |