diff options
author | TheJackiMonster <thejackimonster@gmail.com> | 2022-09-09 20:33:51 +0200 |
---|---|---|
committer | TheJackiMonster <thejackimonster@gmail.com> | 2022-09-09 20:33:51 +0200 |
commit | 969f1536918e342bb331acfb042bf906c307978c (patch) | |
tree | e2fe73c95ac3d09c3bf2533eb25621257dce6695 | |
parent | 18d12007e147e7520e188dac91918ce1a94da409 (diff) | |
download | messenger-cli-969f1536918e342bb331acfb042bf906c307978c.tar.gz messenger-cli-969f1536918e342bb331acfb042bf906c307978c.zip |
Added documentation comments to the functions
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
-rw-r--r-- | src/application.h | 37 | ||||
-rw-r--r-- | src/chat.h | 34 | ||||
-rw-r--r-- | src/ui/account_create_dialog.c | 3 | ||||
-rw-r--r-- | src/ui/account_create_dialog.h | 20 | ||||
-rw-r--r-- | src/ui/accounts.c | 2 | ||||
-rw-r--r-- | src/ui/accounts.h | 19 | ||||
-rw-r--r-- | src/ui/chat.h | 3 | ||||
-rw-r--r-- | src/ui/chat_open_dialog.c | 3 | ||||
-rw-r--r-- | src/ui/chat_open_dialog.h | 20 | ||||
-rw-r--r-- | src/ui/chats.c | 6 | ||||
-rw-r--r-- | src/ui/chats.h | 19 | ||||
-rw-r--r-- | src/ui/list_input.h | 16 | ||||
-rw-r--r-- | src/ui/lobby_create_dialog.c | 3 | ||||
-rw-r--r-- | src/ui/lobby_create_dialog.h | 20 | ||||
-rw-r--r-- | src/ui/lobby_enter_dialog.c | 3 | ||||
-rw-r--r-- | src/ui/lobby_enter_dialog.h | 20 | ||||
-rw-r--r-- | src/ui/members.h | 44 | ||||
-rw-r--r-- | src/ui/messages.h | 43 | ||||
-rw-r--r-- | src/ui/text_input.h | 4 | ||||
-rw-r--r-- | src/util.h | 6 |
20 files changed, 305 insertions, 20 deletions
diff --git a/src/application.h b/src/application.h index 75bf336..ea248e0 100644 --- a/src/application.h +++ b/src/application.h | |||
@@ -35,6 +35,9 @@ | |||
35 | #include "ui/chat.h" | 35 | #include "ui/chat.h" |
36 | #include "ui/chats.h" | 36 | #include "ui/chats.h" |
37 | 37 | ||
38 | /** | ||
39 | * @struct MESSENGER_Application | ||
40 | */ | ||
38 | typedef struct MESSENGER_Application | 41 | typedef struct MESSENGER_Application |
39 | { | 42 | { |
40 | char **argv; | 43 | char **argv; |
@@ -58,20 +61,54 @@ typedef struct MESSENGER_Application | |||
58 | UI_CHAT_Handle current; | 61 | UI_CHAT_Handle current; |
59 | } MESSENGER_Application; | 62 | } MESSENGER_Application; |
60 | 63 | ||
64 | /** | ||
65 | * Clears the application handle to reset all views | ||
66 | * which might have been in use. | ||
67 | * | ||
68 | * @param[out] app Application handle | ||
69 | */ | ||
61 | void | 70 | void |
62 | application_clear(MESSENGER_Application *app); | 71 | application_clear(MESSENGER_Application *app); |
63 | 72 | ||
73 | /** | ||
74 | * Initializes the application handle with the program | ||
75 | * arguments provided from the main function. | ||
76 | * | ||
77 | * @param[out] app Application handle | ||
78 | * @param[in] argc Argument count | ||
79 | * @param[in] argv Argument array | ||
80 | */ | ||
64 | void | 81 | void |
65 | application_init(MESSENGER_Application *app, | 82 | application_init(MESSENGER_Application *app, |
66 | int argc, | 83 | int argc, |
67 | char **argv); | 84 | char **argv); |
68 | 85 | ||
86 | /** | ||
87 | * Refreshes the application handle freeing all temporary | ||
88 | * WINDOW handles to manage the different views which | ||
89 | * were used. | ||
90 | * | ||
91 | * @param[out] app Application handle | ||
92 | */ | ||
69 | void | 93 | void |
70 | application_refresh(MESSENGER_Application *app); | 94 | application_refresh(MESSENGER_Application *app); |
71 | 95 | ||
96 | /** | ||
97 | * Starts the main loop of the application which will | ||
98 | * be processed via GNUnet and its callback management. | ||
99 | * | ||
100 | * @param[in,out] app Application handle | ||
101 | */ | ||
72 | void | 102 | void |
73 | application_run(MESSENGER_Application *app); | 103 | application_run(MESSENGER_Application *app); |
74 | 104 | ||
105 | /** | ||
106 | * Returns the status code by the given application | ||
107 | * at current state. | ||
108 | * | ||
109 | * @param[in] app Application handle | ||
110 | * @return #EXIT_FAILURE on failure, otherwise #EXIT_SUCCESS | ||
111 | */ | ||
75 | int | 112 | int |
76 | application_status(MESSENGER_Application *app); | 113 | application_status(MESSENGER_Application *app); |
77 | 114 | ||
@@ -31,6 +31,9 @@ | |||
31 | 31 | ||
32 | struct MESSENGER_Application; | 32 | struct MESSENGER_Application; |
33 | 33 | ||
34 | /** | ||
35 | * @struct MESSENGER_Chat | ||
36 | */ | ||
34 | typedef struct MESSENGER_Chat | 37 | typedef struct MESSENGER_Chat |
35 | { | 38 | { |
36 | struct GNUNET_CHAT_Handle *handle; | 39 | struct GNUNET_CHAT_Handle *handle; |
@@ -42,18 +45,49 @@ typedef struct MESSENGER_Chat | |||
42 | bool quit; | 45 | bool quit; |
43 | } MESSENGER_Chat; | 46 | } MESSENGER_Chat; |
44 | 47 | ||
48 | /** | ||
49 | * Starts the processing of the given applications | ||
50 | * chat handle. | ||
51 | * | ||
52 | * @param[out] chat Application chat handle | ||
53 | * @param[in,out] app Application handle | ||
54 | * @param[in] cfg Configuration | ||
55 | */ | ||
45 | void | 56 | void |
46 | chat_start(MESSENGER_Chat *chat, | 57 | chat_start(MESSENGER_Chat *chat, |
47 | struct MESSENGER_Application *app, | 58 | struct MESSENGER_Application *app, |
48 | const struct GNUNET_CONFIGURATION_Handle *cfg); | 59 | const struct GNUNET_CONFIGURATION_Handle *cfg); |
49 | 60 | ||
61 | /** | ||
62 | * Stops the processing of the given applications | ||
63 | * chat handle. | ||
64 | * | ||
65 | * @param[in,out] chat Application chat handle | ||
66 | */ | ||
50 | void | 67 | void |
51 | chat_stop(MESSENGER_Chat *chat); | 68 | chat_stop(MESSENGER_Chat *chat); |
52 | 69 | ||
70 | /** | ||
71 | * Updates the layout of the applications views depending | ||
72 | * on the main windows resolution and the current state | ||
73 | * of the applications chat handle. | ||
74 | * | ||
75 | * @param[in] chat Application chat handle | ||
76 | * @param[out] app Application handle | ||
77 | */ | ||
53 | void | 78 | void |
54 | chat_update_layout(MESSENGER_Chat *chat, | 79 | chat_update_layout(MESSENGER_Chat *chat, |
55 | struct MESSENGER_Application *app); | 80 | struct MESSENGER_Application *app); |
56 | 81 | ||
82 | /** | ||
83 | * Processes a chat message to update the list of | ||
84 | * required resources to handle visual representation | ||
85 | * of current members in a chat or the messages. | ||
86 | * | ||
87 | * @param[in,out] chat Application chat handle | ||
88 | * @param[in] context Chat context of the message | ||
89 | * @param[in] message Chat message | ||
90 | */ | ||
57 | void | 91 | void |
58 | chat_process_message(MESSENGER_Chat *chat, | 92 | chat_process_message(MESSENGER_Chat *chat, |
59 | struct GNUNET_CHAT_Context *context, | 93 | struct GNUNET_CHAT_Context *context, |
diff --git a/src/ui/account_create_dialog.c b/src/ui/account_create_dialog.c index f3c9394..1ef6568 100644 --- a/src/ui/account_create_dialog.c +++ b/src/ui/account_create_dialog.c | |||
@@ -59,8 +59,7 @@ account_create_dialog_event(UI_ACCOUNT_CREATE_DIALOG_Handle *create_dialog, | |||
59 | } | 59 | } |
60 | 60 | ||
61 | void | 61 | void |
62 | account_create_dialog_print(UI_ACCOUNT_CREATE_DIALOG_Handle *create_dialog, | 62 | account_create_dialog_print(UI_ACCOUNT_CREATE_DIALOG_Handle *create_dialog) |
63 | UNUSED struct MESSENGER_Application *app) | ||
64 | { | 63 | { |
65 | if (!(create_dialog->window)) | 64 | if (!(create_dialog->window)) |
66 | return; | 65 | return; |
diff --git a/src/ui/account_create_dialog.h b/src/ui/account_create_dialog.h index d42fef2..93c8318 100644 --- a/src/ui/account_create_dialog.h +++ b/src/ui/account_create_dialog.h | |||
@@ -30,6 +30,9 @@ | |||
30 | 30 | ||
31 | struct MESSENGER_Application; | 31 | struct MESSENGER_Application; |
32 | 32 | ||
33 | /** | ||
34 | * @struct UI_ACCOUNT_CREATE_DIALOG_Handle | ||
35 | */ | ||
33 | typedef struct UI_ACCOUNT_CREATE_DIALOG_Handle | 36 | typedef struct UI_ACCOUNT_CREATE_DIALOG_Handle |
34 | { | 37 | { |
35 | WINDOW **window; | 38 | WINDOW **window; |
@@ -39,13 +42,26 @@ typedef struct UI_ACCOUNT_CREATE_DIALOG_Handle | |||
39 | int name_pos; | 42 | int name_pos; |
40 | } UI_ACCOUNT_CREATE_DIALOG_Handle; | 43 | } UI_ACCOUNT_CREATE_DIALOG_Handle; |
41 | 44 | ||
45 | /** | ||
46 | * Processes the current key event by the dialog | ||
47 | * to create a new account. | ||
48 | * | ||
49 | * @param[in,out] create_dialog Account creation dialog | ||
50 | * @param[in,out] app Application handle | ||
51 | * @param[in] key Key | ||
52 | */ | ||
42 | void | 53 | void |
43 | account_create_dialog_event(UI_ACCOUNT_CREATE_DIALOG_Handle *create_dialog, | 54 | account_create_dialog_event(UI_ACCOUNT_CREATE_DIALOG_Handle *create_dialog, |
44 | struct MESSENGER_Application *app, | 55 | struct MESSENGER_Application *app, |
45 | int key); | 56 | int key); |
46 | 57 | ||
58 | /** | ||
59 | * Prints the content of the dialog to create a new | ||
60 | * account to its selected window view. | ||
61 | * | ||
62 | * @param[in] create_dialog Account creation dialog | ||
63 | */ | ||
47 | void | 64 | void |
48 | account_create_dialog_print(UI_ACCOUNT_CREATE_DIALOG_Handle *create_dialog, | 65 | account_create_dialog_print(UI_ACCOUNT_CREATE_DIALOG_Handle *create_dialog); |
49 | struct MESSENGER_Application *app); | ||
50 | 66 | ||
51 | #endif /* UI_ACCOUNT_CREATE_DIALOG_H_ */ | 67 | #endif /* UI_ACCOUNT_CREATE_DIALOG_H_ */ |
diff --git a/src/ui/accounts.c b/src/ui/accounts.c index 380506d..bdc5086 100644 --- a/src/ui/accounts.c +++ b/src/ui/accounts.c | |||
@@ -114,7 +114,7 @@ accounts_print(UI_ACCOUNTS_Handle *accounts, | |||
114 | { | 114 | { |
115 | if (accounts->create_dialog.window) | 115 | if (accounts->create_dialog.window) |
116 | { | 116 | { |
117 | account_create_dialog_print(&(accounts->create_dialog), app); | 117 | account_create_dialog_print(&(accounts->create_dialog)); |
118 | return; | 118 | return; |
119 | } | 119 | } |
120 | 120 | ||
diff --git a/src/ui/accounts.h b/src/ui/accounts.h index 4e278d5..2566e78 100644 --- a/src/ui/accounts.h +++ b/src/ui/accounts.h | |||
@@ -36,6 +36,9 @@ | |||
36 | 36 | ||
37 | struct MESSENGER_Application; | 37 | struct MESSENGER_Application; |
38 | 38 | ||
39 | /** | ||
40 | * @struct UI_ACCOUNTS_Handle | ||
41 | */ | ||
39 | typedef struct UI_ACCOUNTS_Handle | 42 | typedef struct UI_ACCOUNTS_Handle |
40 | { | 43 | { |
41 | WINDOW *window; | 44 | WINDOW *window; |
@@ -55,11 +58,27 @@ typedef struct UI_ACCOUNTS_Handle | |||
55 | #define UI_ACCOUNTS_ROWS_MIN 5 | 58 | #define UI_ACCOUNTS_ROWS_MIN 5 |
56 | #define UI_ACCOUNTS_COLS_MIN 30 | 59 | #define UI_ACCOUNTS_COLS_MIN 30 |
57 | 60 | ||
61 | /** | ||
62 | * Processes the current key event by the view | ||
63 | * to show the list of chat accounts. | ||
64 | * | ||
65 | * @param[in,out] accounts Chat accounts view | ||
66 | * @param[in,out] app Application handle | ||
67 | * @param[in] key Key | ||
68 | */ | ||
58 | void | 69 | void |
59 | accounts_event(UI_ACCOUNTS_Handle *accounts, | 70 | accounts_event(UI_ACCOUNTS_Handle *accounts, |
60 | struct MESSENGER_Application *app, | 71 | struct MESSENGER_Application *app, |
61 | int key); | 72 | int key); |
62 | 73 | ||
74 | /** | ||
75 | * Prints the content of the view to show | ||
76 | * the list of chat accounts to its selected | ||
77 | * window view on screen. | ||
78 | * | ||
79 | * @param[in,out] accounts Chat accounts view | ||
80 | * @param[in] app Application handle | ||
81 | */ | ||
63 | void | 82 | void |
64 | accounts_print(UI_ACCOUNTS_Handle *accounts, | 83 | accounts_print(UI_ACCOUNTS_Handle *accounts, |
65 | struct MESSENGER_Application *app); | 84 | struct MESSENGER_Application *app); |
diff --git a/src/ui/chat.h b/src/ui/chat.h index b8febf4..582ba66 100644 --- a/src/ui/chat.h +++ b/src/ui/chat.h | |||
@@ -28,6 +28,9 @@ | |||
28 | #include "members.h" | 28 | #include "members.h" |
29 | #include "messages.h" | 29 | #include "messages.h" |
30 | 30 | ||
31 | /** | ||
32 | * @struct UI_CHAT_Handle | ||
33 | */ | ||
31 | typedef struct UI_CHAT_Handle | 34 | typedef struct UI_CHAT_Handle |
32 | { | 35 | { |
33 | UI_MEMBERS_Handle members; | 36 | UI_MEMBERS_Handle members; |
diff --git a/src/ui/chat_open_dialog.c b/src/ui/chat_open_dialog.c index 5b641d6..cd98401 100644 --- a/src/ui/chat_open_dialog.c +++ b/src/ui/chat_open_dialog.c | |||
@@ -59,8 +59,7 @@ chat_open_dialog_event(UI_CHAT_OPEN_DIALOG_Handle *open_dialog, | |||
59 | } | 59 | } |
60 | 60 | ||
61 | void | 61 | void |
62 | chat_open_dialog_print(UI_CHAT_OPEN_DIALOG_Handle *open_dialog, | 62 | chat_open_dialog_print(UI_CHAT_OPEN_DIALOG_Handle *open_dialog) |
63 | UNUSED struct MESSENGER_Application *app) | ||
64 | { | 63 | { |
65 | if (!(open_dialog->window)) | 64 | if (!(open_dialog->window)) |
66 | return; | 65 | return; |
diff --git a/src/ui/chat_open_dialog.h b/src/ui/chat_open_dialog.h index 0367abc..413d15e 100644 --- a/src/ui/chat_open_dialog.h +++ b/src/ui/chat_open_dialog.h | |||
@@ -30,6 +30,9 @@ | |||
30 | 30 | ||
31 | struct MESSENGER_Application; | 31 | struct MESSENGER_Application; |
32 | 32 | ||
33 | /** | ||
34 | * @struct UI_CHAT_OPEN_DIALOG_Handle | ||
35 | */ | ||
33 | typedef struct UI_CHAT_OPEN_DIALOG_Handle | 36 | typedef struct UI_CHAT_OPEN_DIALOG_Handle |
34 | { | 37 | { |
35 | WINDOW **window; | 38 | WINDOW **window; |
@@ -39,13 +42,26 @@ typedef struct UI_CHAT_OPEN_DIALOG_Handle | |||
39 | int topic_pos; | 42 | int topic_pos; |
40 | } UI_CHAT_OPEN_DIALOG_Handle; | 43 | } UI_CHAT_OPEN_DIALOG_Handle; |
41 | 44 | ||
45 | /** | ||
46 | * Processes the current key event by the dialog | ||
47 | * to open a chat. | ||
48 | * | ||
49 | * @param[in,out] open_dialog Chat opening dialog | ||
50 | * @param[in,out] app Application handle | ||
51 | * @param[in] key Key | ||
52 | */ | ||
42 | void | 53 | void |
43 | chat_open_dialog_event(UI_CHAT_OPEN_DIALOG_Handle *open_dialog, | 54 | chat_open_dialog_event(UI_CHAT_OPEN_DIALOG_Handle *open_dialog, |
44 | struct MESSENGER_Application *app, | 55 | struct MESSENGER_Application *app, |
45 | int key); | 56 | int key); |
46 | 57 | ||
58 | /** | ||
59 | * Prints the content of the dialog to open a | ||
60 | * chat to its selected window view. | ||
61 | * | ||
62 | * @param[in] open_dialog Chat opening dialog | ||
63 | */ | ||
47 | void | 64 | void |
48 | chat_open_dialog_print(UI_CHAT_OPEN_DIALOG_Handle *open_dialog, | 65 | chat_open_dialog_print(UI_CHAT_OPEN_DIALOG_Handle *open_dialog); |
49 | struct MESSENGER_Application *app); | ||
50 | 66 | ||
51 | #endif /* UI_CHAT_OPEN_DIALOG_H_ */ | 67 | #endif /* UI_CHAT_OPEN_DIALOG_H_ */ |
diff --git a/src/ui/chats.c b/src/ui/chats.c index c2cc2ae..55e08df 100644 --- a/src/ui/chats.c +++ b/src/ui/chats.c | |||
@@ -191,17 +191,17 @@ chats_print(UI_CHATS_Handle *chats, | |||
191 | { | 191 | { |
192 | if (chats->open_dialog.window) | 192 | if (chats->open_dialog.window) |
193 | { | 193 | { |
194 | chat_open_dialog_print(&(chats->open_dialog), app); | 194 | chat_open_dialog_print(&(chats->open_dialog)); |
195 | return; | 195 | return; |
196 | } | 196 | } |
197 | else if (chats->create_dialog.win) | 197 | else if (chats->create_dialog.win) |
198 | { | 198 | { |
199 | lobby_create_dialog_print(&(chats->create_dialog), app); | 199 | lobby_create_dialog_print(&(chats->create_dialog)); |
200 | return; | 200 | return; |
201 | } | 201 | } |
202 | else if (chats->enter_dialog.window) | 202 | else if (chats->enter_dialog.window) |
203 | { | 203 | { |
204 | lobby_enter_dialog_print(&(chats->enter_dialog), app); | 204 | lobby_enter_dialog_print(&(chats->enter_dialog)); |
205 | return; | 205 | return; |
206 | } | 206 | } |
207 | 207 | ||
diff --git a/src/ui/chats.h b/src/ui/chats.h index 8e836bd..7ab64d5 100644 --- a/src/ui/chats.h +++ b/src/ui/chats.h | |||
@@ -38,6 +38,9 @@ | |||
38 | 38 | ||
39 | struct MESSENGER_Application; | 39 | struct MESSENGER_Application; |
40 | 40 | ||
41 | /** | ||
42 | * @struct UI_CHATS_Handle | ||
43 | */ | ||
41 | typedef struct UI_CHATS_Handle | 44 | typedef struct UI_CHATS_Handle |
42 | { | 45 | { |
43 | WINDOW *window; | 46 | WINDOW *window; |
@@ -59,11 +62,27 @@ typedef struct UI_CHATS_Handle | |||
59 | #define UI_CHATS_ROWS_MIN 8 | 62 | #define UI_CHATS_ROWS_MIN 8 |
60 | #define UI_CHATS_COLS_MIN 30 | 63 | #define UI_CHATS_COLS_MIN 30 |
61 | 64 | ||
65 | /** | ||
66 | * Processes the current key event by the view | ||
67 | * to show the list of available chats. | ||
68 | * | ||
69 | * @param[in,out] chats Chats view | ||
70 | * @param[in,out] app Application handle | ||
71 | * @param[in] key Key | ||
72 | */ | ||
62 | void | 73 | void |
63 | chats_event(UI_CHATS_Handle *chats, | 74 | chats_event(UI_CHATS_Handle *chats, |
64 | struct MESSENGER_Application *app, | 75 | struct MESSENGER_Application *app, |
65 | int key); | 76 | int key); |
66 | 77 | ||
78 | /** | ||
79 | * Prints the content of the view to show | ||
80 | * the list of available chats to its selected | ||
81 | * window view on screen. | ||
82 | * | ||
83 | * @param[in,out] chats Chats view | ||
84 | * @param[in] app Application handle | ||
85 | */ | ||
67 | void | 86 | void |
68 | chats_print(UI_CHATS_Handle *chats, | 87 | chats_print(UI_CHATS_Handle *chats, |
69 | struct MESSENGER_Application *app); | 88 | struct MESSENGER_Application *app); |
diff --git a/src/ui/list_input.h b/src/ui/list_input.h index 717e1ba..4fea1f4 100644 --- a/src/ui/list_input.h +++ b/src/ui/list_input.h | |||
@@ -28,6 +28,9 @@ | |||
28 | #include <stdbool.h> | 28 | #include <stdbool.h> |
29 | #include <stdlib.h> | 29 | #include <stdlib.h> |
30 | 30 | ||
31 | /** | ||
32 | * Resets the list controls. | ||
33 | */ | ||
31 | #define list_input_reset(list) { \ | 34 | #define list_input_reset(list) { \ |
32 | (list)->line_prev = 0; \ | 35 | (list)->line_prev = 0; \ |
33 | (list)->line_next = 0; \ | 36 | (list)->line_next = 0; \ |
@@ -35,6 +38,10 @@ | |||
35 | (list)->selected = 0; \ | 38 | (list)->selected = 0; \ |
36 | } | 39 | } |
37 | 40 | ||
41 | /** | ||
42 | * Handles the list controls selection and | ||
43 | * indices to move the selection via events. | ||
44 | */ | ||
38 | #define list_input_select(list, line_width, item) { \ | 45 | #define list_input_select(list, line_width, item) { \ |
39 | const bool selected = ( \ | 46 | const bool selected = ( \ |
40 | ((list)->line_selected >= (list)->line_index) && \ | 47 | ((list)->line_selected >= (list)->line_index) && \ |
@@ -52,6 +59,10 @@ | |||
52 | } \ | 59 | } \ |
53 | } | 60 | } |
54 | 61 | ||
62 | /** | ||
63 | * Handles the key event to move the selection | ||
64 | * of list controls and adjust its view area. | ||
65 | */ | ||
55 | #define list_input_event(list, key) { \ | 66 | #define list_input_event(list, key) { \ |
56 | int count = (list)->line_index; \ | 67 | int count = (list)->line_index; \ |
57 | \ | 68 | \ |
@@ -93,6 +104,11 @@ | |||
93 | } \ | 104 | } \ |
94 | } | 105 | } |
95 | 106 | ||
107 | /** | ||
108 | * Prepares for printing an item in list controls | ||
109 | * as well as providing its selection and its | ||
110 | * y location in the current view. | ||
111 | */ | ||
96 | #define list_input_print_(list, line_width, yes_res, no_res) \ | 112 | #define list_input_print_(list, line_width, yes_res, no_res) \ |
97 | const bool selected = ( \ | 113 | const bool selected = ( \ |
98 | ((list)->line_selected >= (list)->line_index) && \ | 114 | ((list)->line_selected >= (list)->line_index) && \ |
diff --git a/src/ui/lobby_create_dialog.c b/src/ui/lobby_create_dialog.c index f294391..61c1a4c 100644 --- a/src/ui/lobby_create_dialog.c +++ b/src/ui/lobby_create_dialog.c | |||
@@ -121,8 +121,7 @@ _lobby_iterate_print(UI_LOBBY_CREATE_DIALOG_Handle *create_dialog, | |||
121 | } | 121 | } |
122 | 122 | ||
123 | void | 123 | void |
124 | lobby_create_dialog_print(UI_LOBBY_CREATE_DIALOG_Handle *create_dialog, | 124 | lobby_create_dialog_print(UI_LOBBY_CREATE_DIALOG_Handle *create_dialog) |
125 | UNUSED struct MESSENGER_Application *app) | ||
126 | { | 125 | { |
127 | if (!(create_dialog->win)) | 126 | if (!(create_dialog->win)) |
128 | return; | 127 | return; |
diff --git a/src/ui/lobby_create_dialog.h b/src/ui/lobby_create_dialog.h index 1497255..42d06fc 100644 --- a/src/ui/lobby_create_dialog.h +++ b/src/ui/lobby_create_dialog.h | |||
@@ -34,6 +34,9 @@ | |||
34 | 34 | ||
35 | struct MESSENGER_Application; | 35 | struct MESSENGER_Application; |
36 | 36 | ||
37 | /** | ||
38 | * @struct UI_LOBBY_CREATE_DIALOG_Handle | ||
39 | */ | ||
37 | typedef struct UI_LOBBY_CREATE_DIALOG_Handle | 40 | typedef struct UI_LOBBY_CREATE_DIALOG_Handle |
38 | { | 41 | { |
39 | WINDOW *window; | 42 | WINDOW *window; |
@@ -52,13 +55,26 @@ typedef struct UI_LOBBY_CREATE_DIALOG_Handle | |||
52 | char *uri; | 55 | char *uri; |
53 | } UI_LOBBY_CREATE_DIALOG_Handle; | 56 | } UI_LOBBY_CREATE_DIALOG_Handle; |
54 | 57 | ||
58 | /** | ||
59 | * Processes the current key event by the dialog | ||
60 | * to create a lobby. | ||
61 | * | ||
62 | * @param[in,out] create_dialog Lobby creation dialog | ||
63 | * @param[in,out] app Application handle | ||
64 | * @param[in] key Key | ||
65 | */ | ||
55 | void | 66 | void |
56 | lobby_create_dialog_event(UI_LOBBY_CREATE_DIALOG_Handle *create_dialog, | 67 | lobby_create_dialog_event(UI_LOBBY_CREATE_DIALOG_Handle *create_dialog, |
57 | struct MESSENGER_Application *app, | 68 | struct MESSENGER_Application *app, |
58 | int key); | 69 | int key); |
59 | 70 | ||
71 | /** | ||
72 | * Prints the content of the dialog to create a | ||
73 | * lobby to its selected window view. | ||
74 | * | ||
75 | * @param[in] create_dialog Lobby creation dialog | ||
76 | */ | ||
60 | void | 77 | void |
61 | lobby_create_dialog_print(UI_LOBBY_CREATE_DIALOG_Handle *create_dialog, | 78 | lobby_create_dialog_print(UI_LOBBY_CREATE_DIALOG_Handle *create_dialog); |
62 | struct MESSENGER_Application *app); | ||
63 | 79 | ||
64 | #endif /* UI_LOBBY_CREATE_DIALOG_H_ */ | 80 | #endif /* UI_LOBBY_CREATE_DIALOG_H_ */ |
diff --git a/src/ui/lobby_enter_dialog.c b/src/ui/lobby_enter_dialog.c index 6de4d1c..0ae9018 100644 --- a/src/ui/lobby_enter_dialog.c +++ b/src/ui/lobby_enter_dialog.c | |||
@@ -78,8 +78,7 @@ lobby_enter_dialog_event(UI_LOBBY_ENTER_DIALOG_Handle *enter_dialog, | |||
78 | } | 78 | } |
79 | 79 | ||
80 | void | 80 | void |
81 | lobby_enter_dialog_print(UI_LOBBY_ENTER_DIALOG_Handle *enter_dialog, | 81 | lobby_enter_dialog_print(UI_LOBBY_ENTER_DIALOG_Handle *enter_dialog) |
82 | UNUSED struct MESSENGER_Application *app) | ||
83 | { | 82 | { |
84 | if (!(enter_dialog->window)) | 83 | if (!(enter_dialog->window)) |
85 | return; | 84 | return; |
diff --git a/src/ui/lobby_enter_dialog.h b/src/ui/lobby_enter_dialog.h index 81ddeac..8e7cc05 100644 --- a/src/ui/lobby_enter_dialog.h +++ b/src/ui/lobby_enter_dialog.h | |||
@@ -30,6 +30,9 @@ | |||
30 | 30 | ||
31 | struct MESSENGER_Application; | 31 | struct MESSENGER_Application; |
32 | 32 | ||
33 | /** | ||
34 | * @struct UI_LOBBY_ENTER_DIALOG_Handle | ||
35 | */ | ||
33 | typedef struct UI_LOBBY_ENTER_DIALOG_Handle | 36 | typedef struct UI_LOBBY_ENTER_DIALOG_Handle |
34 | { | 37 | { |
35 | WINDOW **window; | 38 | WINDOW **window; |
@@ -41,13 +44,26 @@ typedef struct UI_LOBBY_ENTER_DIALOG_Handle | |||
41 | int uri_pos; | 44 | int uri_pos; |
42 | } UI_LOBBY_ENTER_DIALOG_Handle; | 45 | } UI_LOBBY_ENTER_DIALOG_Handle; |
43 | 46 | ||
47 | /** | ||
48 | * Processes the current key event by the dialog | ||
49 | * to enter a lobby. | ||
50 | * | ||
51 | * @param[in,out] enter_dialog Lobby entry dialog | ||
52 | * @param[in,out] app Application handle | ||
53 | * @param[in] key Key | ||
54 | */ | ||
44 | void | 55 | void |
45 | lobby_enter_dialog_event(UI_LOBBY_ENTER_DIALOG_Handle *enter_dialog, | 56 | lobby_enter_dialog_event(UI_LOBBY_ENTER_DIALOG_Handle *enter_dialog, |
46 | struct MESSENGER_Application *app, | 57 | struct MESSENGER_Application *app, |
47 | int key); | 58 | int key); |
48 | 59 | ||
60 | /** | ||
61 | * Prints the content of the dialog to enter a | ||
62 | * lobby to its selected window view. | ||
63 | * | ||
64 | * @param[in] enter_dialog Lobby entry dialog | ||
65 | */ | ||
49 | void | 66 | void |
50 | lobby_enter_dialog_print(UI_LOBBY_ENTER_DIALOG_Handle *enter_dialog, | 67 | lobby_enter_dialog_print(UI_LOBBY_ENTER_DIALOG_Handle *enter_dialog); |
51 | struct MESSENGER_Application *app); | ||
52 | 68 | ||
53 | #endif /* UI_LOBBY_ENTER_DIALOG_H_ */ | 69 | #endif /* UI_LOBBY_ENTER_DIALOG_H_ */ |
diff --git a/src/ui/members.h b/src/ui/members.h index 62c564f..7769e74 100644 --- a/src/ui/members.h +++ b/src/ui/members.h | |||
@@ -35,6 +35,9 @@ | |||
35 | 35 | ||
36 | struct MESSENGER_Application; | 36 | struct MESSENGER_Application; |
37 | 37 | ||
38 | /** | ||
39 | * @struct UI_MEMBERS_List | ||
40 | */ | ||
38 | typedef struct UI_MEMBERS_List | 41 | typedef struct UI_MEMBERS_List |
39 | { | 42 | { |
40 | struct GNUNET_CHAT_Contact *contact; | 43 | struct GNUNET_CHAT_Contact *contact; |
@@ -43,6 +46,9 @@ typedef struct UI_MEMBERS_List | |||
43 | struct UI_MEMBERS_List *next; | 46 | struct UI_MEMBERS_List *next; |
44 | } UI_MEMBERS_List; | 47 | } UI_MEMBERS_List; |
45 | 48 | ||
49 | /** | ||
50 | * @struct UI_MEMBERS_Handle | ||
51 | */ | ||
46 | typedef struct UI_MEMBERS_Handle | 52 | typedef struct UI_MEMBERS_Handle |
47 | { | 53 | { |
48 | WINDOW *window; | 54 | WINDOW *window; |
@@ -62,21 +68,59 @@ typedef struct UI_MEMBERS_Handle | |||
62 | 68 | ||
63 | #define UI_MEMBERS_COLS_MIN 30 | 69 | #define UI_MEMBERS_COLS_MIN 30 |
64 | 70 | ||
71 | /** | ||
72 | * Processes the current key event by the view | ||
73 | * to show a chats list of members. | ||
74 | * | ||
75 | * @param[in,out] members Chat members view | ||
76 | * @param[in,out] app Application handle | ||
77 | * @param[in] key Key | ||
78 | */ | ||
65 | void | 79 | void |
66 | members_event(UI_MEMBERS_Handle *members, | 80 | members_event(UI_MEMBERS_Handle *members, |
67 | struct MESSENGER_Application *app, | 81 | struct MESSENGER_Application *app, |
68 | int key); | 82 | int key); |
69 | 83 | ||
84 | /** | ||
85 | * Prints the content of the view to show | ||
86 | * a chats list of members to its selected | ||
87 | * window view on screen. | ||
88 | * | ||
89 | * @param[in,out] members Chat members view | ||
90 | */ | ||
70 | void | 91 | void |
71 | members_print(UI_MEMBERS_Handle *members); | 92 | members_print(UI_MEMBERS_Handle *members); |
72 | 93 | ||
94 | /** | ||
95 | * Clears the list of members the view | ||
96 | * would print to the screen. | ||
97 | * | ||
98 | * @param[out] members Chat members view | ||
99 | */ | ||
73 | void | 100 | void |
74 | members_clear(UI_MEMBERS_Handle *members); | 101 | members_clear(UI_MEMBERS_Handle *members); |
75 | 102 | ||
103 | /** | ||
104 | * Adds a new chat contact to the list of | ||
105 | * members the view will print to the | ||
106 | * screen. | ||
107 | * | ||
108 | * @param[in,out] members Chat members view | ||
109 | * @param[in] contact Chat contact | ||
110 | * @return #TRUE if the member is new, otherwise #FALSE | ||
111 | */ | ||
76 | bool | 112 | bool |
77 | members_add(UI_MEMBERS_Handle *members, | 113 | members_add(UI_MEMBERS_Handle *members, |
78 | struct GNUNET_CHAT_Contact *contact); | 114 | struct GNUNET_CHAT_Contact *contact); |
79 | 115 | ||
116 | /** | ||
117 | * Removes a chat contact from the list of | ||
118 | * members the view would print to the | ||
119 | * screen. | ||
120 | * | ||
121 | * @param[in,out] members Chat members view | ||
122 | * @param[in] contact Chat contact | ||
123 | */ | ||
80 | void | 124 | void |
81 | members_remove(UI_MEMBERS_Handle *members, | 125 | members_remove(UI_MEMBERS_Handle *members, |
82 | const struct GNUNET_CHAT_Contact *contact); | 126 | const struct GNUNET_CHAT_Contact *contact); |
diff --git a/src/ui/messages.h b/src/ui/messages.h index edc3192..3d509db 100644 --- a/src/ui/messages.h +++ b/src/ui/messages.h | |||
@@ -34,6 +34,9 @@ | |||
34 | 34 | ||
35 | struct MESSENGER_Application; | 35 | struct MESSENGER_Application; |
36 | 36 | ||
37 | /** | ||
38 | * @struct UI_MESSAGES_List | ||
39 | */ | ||
37 | typedef struct UI_MESSAGES_List | 40 | typedef struct UI_MESSAGES_List |
38 | { | 41 | { |
39 | time_t timestamp; | 42 | time_t timestamp; |
@@ -46,6 +49,9 @@ typedef struct UI_MESSAGES_List | |||
46 | 49 | ||
47 | #define TEXT_LEN_MAX 1024 | 50 | #define TEXT_LEN_MAX 1024 |
48 | 51 | ||
52 | /** | ||
53 | * @struct UI_MESSAGES_Handle | ||
54 | */ | ||
49 | typedef struct UI_MESSAGES_Handle | 55 | typedef struct UI_MESSAGES_Handle |
50 | { | 56 | { |
51 | WINDOW *window; | 57 | WINDOW *window; |
@@ -73,21 +79,58 @@ typedef struct UI_MESSAGES_Handle | |||
73 | #define UI_MESSAGES_FILE_PREFIX "file:" | 79 | #define UI_MESSAGES_FILE_PREFIX "file:" |
74 | #define UI_MESSAGES_FILE_PREFIX_LEN 5 | 80 | #define UI_MESSAGES_FILE_PREFIX_LEN 5 |
75 | 81 | ||
82 | /** | ||
83 | * Processes the current key event by the view | ||
84 | * to show a chats list of messages. | ||
85 | * | ||
86 | * @param[in,out] messages Chat messages view | ||
87 | * @param[in,out] app Application handle | ||
88 | * @param[in] key Key | ||
89 | */ | ||
76 | void | 90 | void |
77 | messages_event(UI_MESSAGES_Handle *messages, | 91 | messages_event(UI_MESSAGES_Handle *messages, |
78 | struct MESSENGER_Application *app, | 92 | struct MESSENGER_Application *app, |
79 | int key); | 93 | int key); |
80 | 94 | ||
95 | /** | ||
96 | * Prints the content of the view to show | ||
97 | * a chats list of messages to its selected | ||
98 | * window view on screen. | ||
99 | * | ||
100 | * @param[in,out] messages Chat messages view | ||
101 | */ | ||
81 | void | 102 | void |
82 | messages_print(UI_MESSAGES_Handle *messages); | 103 | messages_print(UI_MESSAGES_Handle *messages); |
83 | 104 | ||
105 | /** | ||
106 | * Clears the list of messages the view | ||
107 | * would print to the screen. | ||
108 | * | ||
109 | * @param[out] messages Chat messages view | ||
110 | */ | ||
84 | void | 111 | void |
85 | messages_clear(UI_MESSAGES_Handle *messages); | 112 | messages_clear(UI_MESSAGES_Handle *messages); |
86 | 113 | ||
114 | /** | ||
115 | * Adds a new chat message to the list of | ||
116 | * messages the view will print to the | ||
117 | * screen. | ||
118 | * | ||
119 | * @param[in,out] messages Chat messages view | ||
120 | * @param[in] message Chat message | ||
121 | */ | ||
87 | void | 122 | void |
88 | messages_add(UI_MESSAGES_Handle *messages, | 123 | messages_add(UI_MESSAGES_Handle *messages, |
89 | const struct GNUNET_CHAT_Message *message); | 124 | const struct GNUNET_CHAT_Message *message); |
90 | 125 | ||
126 | /** | ||
127 | * Removes a chat message from the list of | ||
128 | * messages the view would print to the | ||
129 | * screen. | ||
130 | * | ||
131 | * @param[in,out] messages Chat messages view | ||
132 | * @param[in] message Chat message | ||
133 | */ | ||
91 | void | 134 | void |
92 | messages_remove(UI_MESSAGES_Handle *messages, | 135 | messages_remove(UI_MESSAGES_Handle *messages, |
93 | const struct GNUNET_CHAT_Message *message); | 136 | const struct GNUNET_CHAT_Message *message); |
diff --git a/src/ui/text_input.h b/src/ui/text_input.h index 8dc416f..ec04ed5 100644 --- a/src/ui/text_input.h +++ b/src/ui/text_input.h | |||
@@ -27,6 +27,10 @@ | |||
27 | 27 | ||
28 | #include <ctype.h> | 28 | #include <ctype.h> |
29 | 29 | ||
30 | /** | ||
31 | * Handles the key event to move the cursor | ||
32 | * and adjust the content of text controls. | ||
33 | */ | ||
30 | #define text_input_event(text, key) { \ | 34 | #define text_input_event(text, key) { \ |
31 | switch (key) \ | 35 | switch (key) \ |
32 | { \ | 36 | { \ |
@@ -34,6 +34,12 @@ | |||
34 | #define UTIL_LOGO_ROWS 10 | 34 | #define UTIL_LOGO_ROWS 10 |
35 | #define UTIL_LOGO_COLS 28 | 35 | #define UTIL_LOGO_COLS 28 |
36 | 36 | ||
37 | /** | ||
38 | * Prints the main logo of the application | ||
39 | * onto a specified view. | ||
40 | * | ||
41 | * @param[in,out] window Window view | ||
42 | */ | ||
37 | void | 43 | void |
38 | util_print_logo(WINDOW *window); | 44 | util_print_logo(WINDOW *window); |
39 | 45 | ||