1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-06-18 15:17:46 +02:00

Example conf updated

This commit is contained in:
matt 2014-07-28 22:47:33 +01:00
parent 18610668b8
commit 8960eb98f4
5 changed files with 38 additions and 79 deletions

View File

@ -22,6 +22,7 @@ LIBS = libtoxcore ncursesw libconfig
CFLAGS = -std=gnu99 -pthread -Wall -g
CFLAGS += -DTOXICVER="\"$(VERSION)\"" -DHAVE_WIDECHAR -D_XOPEN_SOURCE_EXTENDED
CFLAGS += -DPACKAGE_DATADIR="\"$(abspath $(DATADIR))\""
CFLAGS += -fdiagnostics-color
CFLAGS += $(USER_CFLAGS)
LDFLAGS = $(USER_LDFLAGS)

View File

@ -1,5 +1,3 @@
// SAMPLE TOXIC CONFIGURATION
// USES LIBCONFIG-ACCEPTED SYNTAX
ui = {
// true to enable timestamps, false to disable
@ -10,43 +8,22 @@ ui = {
// true to use native terminal colours, false to use toxic default colour theme
native_colors:false;
// true to enable autologging, false to disable
autolog:false;
// 24 or 12 hour time
time_format=24;
// maximum lines for chat window history
history_size=700;
time_format=24;
autolog:false;
};
audio = {
// preferred audio input device; numbers correspond to /lsdev in
input_device=2;
// preferred audio output device; numbers correspond to /lsdev out
output_device=0;
// default VAD treshold; float (recommended values are around 40)
VAD_treshold=40.0;
//Only Ctrl modified keys and Tab supported right now
//All printable keys register as input anyway
keys = {
next_tab="Ctrl+P";
//next_tab="Tab";
prev_tab="Ctrl+O";
scroll_line_up="PAGEUP";
scroll_line_down="PAGEDOWN";
half_page_up="Ctrl+F";
half_page_down="Ctrl+V";
page_bottom="Ctrl+H";
peer_list_up="Ctrl+[";
peer_list_down="Ctrl+]";
};
tox = {
// where to store received files
// download_path="/home/USERNAME/Downloads/";
};
// To disable a sound set the path to "silent"
sounds = {
error="__DATADIR__/sounds/Error.wav";
self_log_in="__DATADIR__/sounds/LogIn.wav";
self_log_out="__DATADIR__/sounds/LogOut.wav";
user_log_in="__DATADIR__/sounds/ContactLogsIn.wav";
user_log_out="__DATADIR__/sounds/ContactLogsOut.wav";
call_incoming="__DATADIR__/sounds/IncomingCall.wav";
call_outgoing="__DATADIR__/sounds/OutgoingCall.wav";
generic_message="__DATADIR__/sounds/NewMessage.wav";
transfer_pending="__DATADIR__/sounds/TransferPending.wav";
transfer_completed="__DATADIR__/sounds/TransferComplete.wav";
};

View File

@ -201,8 +201,6 @@ int settings_load(struct user_settings *s, const char *patharg)
}
if (!config_read_file(cfg, path)) {
char* chk = config_error_text(cfg);
int lin = config_error_line(cfg);
config_destroy(cfg);
return -1;
}
@ -226,15 +224,16 @@ int settings_load(struct user_settings *s, const char *patharg)
}
/* keys */
if((setting = config_lookup(cfg, key_strings.self)) != NULL) {
config_setting_lookup_int(setting, key_strings.next_tab, &s->key_next_tab);
config_setting_lookup_int(setting, key_strings.prev_tab, &s->key_prev_tab);
config_setting_lookup_int(setting, key_strings.scroll_line_up, &s->key_scroll_line_up);
config_setting_lookup_int(setting, key_strings.scroll_line_down, &s->key_scroll_line_down);
config_setting_lookup_int(setting, key_strings.half_page_up, &s->key_half_page_up);
config_setting_lookup_int(setting, key_strings.half_page_down, &s->key_half_page_down);
config_setting_lookup_int(setting, key_strings.page_bottom, &s->key_page_bottom);
config_setting_lookup_int(setting, key_strings.peer_list_up, &s->key_peer_list_up);
config_setting_lookup_int(setting, key_strings.peer_list_down, &s->key_peer_list_down);
const char* tmp = NULL;
if(config_setting_lookup_string(setting, key_strings.next_tab, &tmp)) s->key_next_tab = key_parse(&tmp);
if(config_setting_lookup_string(setting, key_strings.prev_tab, &tmp)) s->key_prev_tab = key_parse(&tmp);
if(config_setting_lookup_string(setting, key_strings.scroll_line_up, &tmp)) s->key_scroll_line_up = key_parse(&tmp);
if(config_setting_lookup_string(setting, key_strings.scroll_line_down, &tmp)) s->key_scroll_line_down= key_parse(&tmp);
if(config_setting_lookup_string(setting, key_strings.half_page_up, &tmp)) s->key_half_page_up = key_parse(&tmp);
if(config_setting_lookup_string(setting, key_strings.half_page_down, &tmp)) s->key_half_page_down = key_parse(&tmp);
if(config_setting_lookup_string(setting, key_strings.page_bottom, &tmp)) s->key_page_bottom = key_parse(&tmp);
if(config_setting_lookup_string(setting, key_strings.peer_list_up, &tmp)) s->key_peer_list_up = key_parse(&tmp);
if(config_setting_lookup_string(setting, key_strings.peer_list_down, &tmp)) s->key_peer_list_down = key_parse(&tmp);
}
#ifdef _AUDIO
@ -328,3 +327,14 @@ int settings_load(struct user_settings *s, const char *patharg)
config_destroy(cfg);
return 0;
}
int key_parse(const char** bind){
if(strlen(*bind) > 5){
if(strncmp(*bind,"Ctrl+", 5)==0) return bind[0][5]-'A'+1;
}
if(strncmp(*bind,"Tab",3)==0) return 9;
if(strncmp(*bind,"PAGE",4==0)) {
if(strlen(*bind) == 6) return 0523;
return 0522;
}
return -1;
}

View File

@ -69,5 +69,5 @@ enum {
} settings_values;
int settings_load(struct user_settings *s, const char *patharg);
int key_parse(const char** bind);
#endif /* #define _settings_h */

View File

@ -1,29 +0,0 @@
ui = {
// true to enable timestamps, false to disable
timestamps:true;
// true to enable terminal alerts on messages, false to disable
alerts:true;
// true to use native terminal colours, false to use toxic default colour theme
native_colors:false;
time_format=24;
autolog:false;
};
//Only Ctrl modified keys and Tab supported right now
//All printable keys register as input anyway
keys = {
next_tab="Ctrl+P";
//next_tab="Tab";
prev_tab="Ctrl+O";
scroll_line_up="PAGEUP";
scroll_line_down="PAGEDOWN";
half_page_up="Ctrl+F";
half_page_down="Ctrl+V";
page_bottom="Ctrl+H";
peer_list_up="Ctrl+[";
peer_list_down="Ctrl+]";
};