From 88e23fe50959ccc3e0321fa5983cb8b40bd804af Mon Sep 17 00:00:00 2001 From: ache Date: Thu, 14 Feb 2019 02:25:10 +0100 Subject: Runtime help --- main.c | 5 ++++- main.h | 47 ++++++++++++++++++++++++++++++++++++++++++----- wind.c | 25 ++++++++++++++++++++++--- wind.h | 1 + 4 files changed, 69 insertions(+), 9 deletions(-) diff --git a/main.c b/main.c index d846674..6f97326 100644 --- a/main.c +++ b/main.c @@ -351,6 +351,10 @@ int main(int argc, char* argv[]){ showContactListW(); } break; + case 'h': + runtimeHelp(); + resize(); + break; case 'i': case 's': { char* number = NULL; @@ -416,7 +420,6 @@ edit: unlink( fileName ); resize(); } - } } diff --git a/main.h b/main.h index a11916a..462095d 100644 --- a/main.h +++ b/main.h @@ -48,15 +48,52 @@ void fail_exit(const char *msg); _a > _b ? _a : _b; }) -#define VERSION_MESMS "Alpha" -#define HELP_STRING_MESMS "Utilisation : mesms [OPTION]..." "\n"\ - "Gestionnaire de SMS" "\n"\ +#define VERSION_MESMS "Beta" +#define HELP_STRING_MESMS "Usage : mesms [OPTION]..." "\n"\ + "SMS Manager" "\n"\ "Options :" "\n"\ - "\t\t--help -h Affiche l'aide simple" "\n"\ - "\t\t--version -v Affiche la version" "\n"\ + "\t\t--help -h Show this help mesage\n"\ + "\t\t--version -v Print the version \n"\ + "\t\t[--contact NUMBER_OR_NAME] [-c NUMBER_OR_NAME] Retrive a contact \n"\ "\n" "\n"\ + "Examples :" "\n"\ + " $ mesms -c +5555 will retrive the name of the contact with number +5555 \n"\ + " Alexis " "\n"\ + " $ mesms -c Alexis will do the contrary" "\n"\ + " +5555" "\n"\ + "\n" "\n"\ + " $ mesms will launch the main program" "\n"\ + "\n" "\n"\ + "Note : type 'h' in the main program to get help" "\n"\ "" +#define RUNTIME_HELP_STRING \ + " Will in the main program, you can manage contact, display SMS and send SMS. \n"\ + " Just type the letter associated with the action." "\n"\ + "" "\n"\ + " 'a' to Add a contact, you will be asked for some information" "\n"\ + "" "\n"\ + " 'd' to Delete a contact, you will be asked for confirmation" "\n"\ + "" "\n"\ + " 'q' to exit the program" "\n"\ + "" "\n"\ + " '/' to search for a contact, you will be asked for a name" "\n"\ + "" "\n"\ + " 'n' to toogle display number option" "\n"\ + "" "\n"\ + " 'jk' Vim's equivalent of arrow keys, to select a contact" "\n"\ + " When a conversation is selected, navigate througth the SMS" "\n"\ + "" "\n"\ + " 'e' to Edit a contact" "\n"\ + "" "\n"\ + " '\t' Tab key, toogle selection of a the conversion (SMSs)" "\n"\ + " with the highlighted contact" "\n"\ + "" "\n"\ + " 's' to send a SMS to the highlighted contact, you will be asked" "\n"\ + " for confirmation." "\n"\ + "" "\n"\ + " 'i' to send a SMS. Identical to 's' but a Vim shortcut" "\n"\ + "" #endif diff --git a/wind.c b/wind.c index 2c42d60..20f6bdc 100644 --- a/wind.c +++ b/wind.c @@ -36,6 +36,28 @@ void resize() { CHECK(doupdate); move(LINES-1, 1); } +void runtimeHelp(void) { + int x = COLS/8; + int y = LINES/7; + + int w = COLS*2/7; + int h = LINES/7; + + clear(); + move(y,x); + printw("This is the help"); + y+=2; + move(y,0); + printw(RUNTIME_HELP_STRING); + + + move(LINES*6/7,x); + printw("Type h or q to exit"); + int c = 0; + while( (c = getch()) && c != EOF && !strchr("hHqQ", c) ) ; + + clear(); +} int confirmSend(char* txt, char* autheur) { int x = COLS/6; int y = LINES/3; @@ -73,14 +95,11 @@ int confirmSend(char* txt, char* autheur) { } } - - int c = 0; while( (c = getch()) && c != EOF && !strchr("oyneqOYNEQ", c) ) ; clear(); return (c == 'e' || c =='E') ? 2 : (!!strchr("yYoO", c)) ; - } diff --git a/wind.h b/wind.h index 763e861..92eb281 100644 --- a/wind.h +++ b/wind.h @@ -11,6 +11,7 @@ void resize(); int confirmSend(char*,char*); +void runtimeHelp(void); #endif -- cgit v1.2.3