-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup to language menu, better wifi timeout, screensaver bug.
- Loading branch information
Showing
15 changed files
with
249 additions
and
136 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
{ | ||
"CHART": "DIAG", | ||
"STOP": "STOPPEN", | ||
"AUTO": "AUTO", | ||
"Manual": "Manuell", | ||
"Pres: %s": "Drük: %s", | ||
"Sens: %s": "Empf: %s", | ||
"Denied": "Bestritten", | ||
"Edging Settings": "Kanteneinstellungen", | ||
"Orgasm Settings": "Orgasmus-Einstellungen", | ||
"UI Settings": "UI-Einstellungen", | ||
"User Profiles": "Benutzerprofil", | ||
"Networking": "Netzwerk", | ||
"Update": "Aktualisieren", | ||
"System Info": "Systeminformationen", | ||
"BACK": "ZURÜCK", | ||
"ENTER": "EINGEBEN" | ||
"language": "Deutsch", | ||
"code": "DE", | ||
"keys": { | ||
"CHART": "DIAG", | ||
"STOP": "STOPPEN", | ||
"AUTO": "AUTO", | ||
"Manual": "Manuell", | ||
"Pres: %s": "Drük: %s", | ||
"Sens: %s": "Empf: %s", | ||
"Denied": "Bestritten", | ||
"Edging Settings": "Kanteneinstellungen", | ||
"Orgasm Settings": "Orgasmus-Einstellungen", | ||
"UI Settings": "UI-Einstellungen", | ||
"User Profiles": "Benutzerprofil", | ||
"Networking": "Netzwerk", | ||
"Update": "Aktualisieren", | ||
"System Info": "Systeminformationen", | ||
"BACK": "ZURÜCK", | ||
"ENTER": "EINGEBEN" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
{ | ||
"CHART": "CUADRO", | ||
"STOP": "DETENER", | ||
"AUTO": "AUTO", | ||
"Manual": "Manual", | ||
"Pres: %s": "Pres: %s", | ||
"Sens: %s": "Sens: %s", | ||
"Denied": "Denegado", | ||
"Edging Settings": "Conf de Bordes", | ||
"Orgasm Settings": "Conf del Orgasmo", | ||
"UI Settings": "Conf de UI", | ||
"User Profiles": "Perfiles de Usuario", | ||
"Networking": "Redes", | ||
"Update": "Actualizar", | ||
"System Info": "Información del Sistema", | ||
"BACK": "ATRÁS", | ||
"ENTER": "INGRESAR" | ||
"language": "Español", | ||
"code": "ES", | ||
"keys": { | ||
"CHART": "CUADRO", | ||
"STOP": "DETENER", | ||
"AUTO": "AUTO", | ||
"Manual": "Manual", | ||
"Pres: %s": "Pres: %s", | ||
"Sens: %s": "Sens: %s", | ||
"Denied": "Denegado", | ||
"Edging Settings": "Conf de Bordes", | ||
"Orgasm Settings": "Conf del Orgasmo", | ||
"UI Settings": "Conf de UI", | ||
"User Profiles": "Perfiles de Usuario", | ||
"Networking": "Redes", | ||
"Update": "Actualizar", | ||
"System Info": "Información del Sistema", | ||
"BACK": "ATRÁS", | ||
"ENTER": "INGRESAR" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
{ | ||
"CHART": "GRAPHIQUE", | ||
"STOP": "ARRÊT", | ||
"AUTO": "AUTO", | ||
"Manual": "Manuel", | ||
"Pres: %s": "Presse", | ||
"Sens: %s": "Détection : %s", | ||
"Denied": "Refusé", | ||
"Edging Settings": "Paramètres de bordure", | ||
"Orgasm Settings": "Paramètres d'orgasme", | ||
"UI Settings": "Paramètres de l'interface utilisateur", | ||
"User Profiles": "Des profils d'utilisateurs", | ||
"Networking": "La mise en réseau", | ||
"Update": "Mise à jour", | ||
"System Info": "Information système", | ||
"BACK": "DOS", | ||
"ENTER": "ENTRER" | ||
"language": "Français", | ||
"code": "FR", | ||
"keys": { | ||
"CHART": "GRAPHIQUE", | ||
"STOP": "ARRÊT", | ||
"AUTO": "AUTO", | ||
"Manual": "Manuel", | ||
"Pres: %s": "Presse", | ||
"Sens: %s": "Détection : %s", | ||
"Denied": "Refusé", | ||
"Edging Settings": "Paramètres de bordure", | ||
"Orgasm Settings": "Paramètres d'orgasme", | ||
"UI Settings": "Paramètres de l'interface utilisateur", | ||
"User Profiles": "Des profils d'utilisateurs", | ||
"Networking": "La mise en réseau", | ||
"Update": "Mise à jour", | ||
"System Info": "Information système", | ||
"BACK": "DOS", | ||
"ENTER": "ENTRER" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
{ | ||
"CHART": "チャート", | ||
"STOP": "ストップ", | ||
"AUTO": "自動", | ||
"Manual": "マニュアル", | ||
"Pres: %s": "プレス: %s", | ||
"Sens: %s": "センス: %s", | ||
"Denied": "拒否された", | ||
"Edging Settings": "縁取り設定", | ||
"Orgasm Settings": "オーガズム設定", | ||
"UI Settings": "UI 設定", | ||
"User Profiles": "ユーザープロファイル", | ||
"Networking": "ネットワーキング", | ||
"Update": "アップデート", | ||
"System Info": "システム情報", | ||
"BACK": "戻る", | ||
"ENTER": "入力" | ||
"language": "日本語", | ||
"code": "JA", | ||
"keys": { | ||
"CHART": "チャート", | ||
"STOP": "ストップ", | ||
"AUTO": "自動", | ||
"Manual": "マニュアル", | ||
"Pres: %s": "プレス: %s", | ||
"Sens: %s": "センス: %s", | ||
"Denied": "拒否された", | ||
"Edging Settings": "縁取り設定", | ||
"Orgasm Settings": "オーガズム設定", | ||
"UI Settings": "UI 設定", | ||
"User Profiles": "ユーザープロファイル", | ||
"Networking": "ネットワーキング", | ||
"Update": "アップデート", | ||
"System Info": "システム情報", | ||
"BACK": "戻る", | ||
"ENTER": "入力" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
{ | ||
"CHART": "ДИАГРАММА", | ||
"STOP": "ОСТАНАВЛИВАТЬСЯ", | ||
"AUTO": "АВТО", | ||
"Manual": "Руководство", | ||
"Pres: %s": "Нажимать", | ||
"Sens: %s": "Чувствительность: %s", | ||
"Denied": "Отклонен", | ||
"Edging Settings": "Настройки окантовки", | ||
"Orgasm Settings": "Настройки оргазма", | ||
"UI Settings": "Настройки пользовательского интерфейса", | ||
"User Profiles": "Профили пользователей", | ||
"Networking": "Сеть", | ||
"Update": "Обновлять", | ||
"System Info": "Системная информация", | ||
"BACK": "НАЗАД", | ||
"ENTER": "ВХОДИТЬ" | ||
"language": "Русский", | ||
"code": "RU", | ||
"keys": { | ||
"CHART": "ДИАГРАММА", | ||
"STOP": "ОСТАНАВЛИВАТЬСЯ", | ||
"AUTO": "АВТО", | ||
"Manual": "Руководство", | ||
"Pres: %s": "Нажимать", | ||
"Sens: %s": "Чувствительность: %s", | ||
"Denied": "Отклонен", | ||
"Edging Settings": "Настройки окантовки", | ||
"Orgasm Settings": "Настройки оргазма", | ||
"UI Settings": "Настройки пользовательского интерфейса", | ||
"User Profiles": "Профили пользователей", | ||
"Networking": "Сеть", | ||
"Update": "Обновлять", | ||
"System Info": "Системная информация", | ||
"BACK": "НАЗАД", | ||
"ENTER": "ВХОДИТЬ" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#include "cJSON.h" | ||
#include "config.h" | ||
#include "esp_log.h" | ||
#include "ui/toast.h" | ||
#include "ui/ui.h" | ||
#include "util/fs.h" | ||
#include "util/i18n.h" | ||
#include <string.h> | ||
|
||
static const char* TAG = "menu:ui_language"; | ||
|
||
static void on_language_select( | ||
const struct ui_menu* m, const struct ui_menu_item* item, UI_MENU_ARG_TYPE menu_arg | ||
) { | ||
ui_toast_blocking(_("Saving...")); | ||
const char* language = (const char*)item->arg; | ||
strlcpy(Config.language_file_name, language == NULL ? "" : language, CONFIG_PATH_MAX); | ||
config_enqueue_save(0); | ||
i18n_deinit(); | ||
|
||
esp_err_t err = i18n_init(); | ||
|
||
if (err != ESP_OK) { | ||
ui_toast("Invalid language file."); | ||
} else { | ||
ui_toast(_("Saved!")); | ||
} | ||
} | ||
|
||
struct dir_result_arg { | ||
const char* path; | ||
int depth; | ||
const ui_menu_t* menu; | ||
}; | ||
|
||
static void _dir_result(const char* path, struct dirent* dir, void* argp) { | ||
if (argp == NULL || path == NULL || dir == NULL) return; | ||
struct dir_result_arg* arg = (struct dir_result_arg*)argp; | ||
char full_path[CONFIG_PATH_MAX + 1]; | ||
|
||
snprintf(full_path, CONFIG_PATH_MAX, "%s/%s", arg->path, path); | ||
|
||
if (dir->d_type == DT_DIR) { | ||
if (arg->depth > 1) return; | ||
ESP_LOGI(TAG, "Read Directory Recursive: %s/", full_path); | ||
|
||
struct dir_result_arg dir_arg = { | ||
.path = full_path, | ||
.depth = arg->depth + 1, | ||
.menu = arg->menu, | ||
}; | ||
|
||
fs_read_dir(full_path, _dir_result, FS_READ_NO_HIDDEN | FS_READ_NO_FREE, &dir_arg); | ||
return; | ||
} | ||
|
||
ESP_LOGI(TAG, "Read File: %s", full_path); | ||
if (fs_strcmp_ext(dir->d_name, ".json")) return; | ||
|
||
// Validate language: | ||
|
||
char* buffer = fs_read_file(full_path); | ||
if (buffer == NULL) return; | ||
|
||
cJSON* root = cJSON_Parse(buffer); | ||
free(buffer); | ||
|
||
if (cJSON_IsObject(root)) { | ||
cJSON* lang = cJSON_GetObjectItem(root, "language"); | ||
|
||
if (lang != NULL) { | ||
char* lang_file = NULL; | ||
// Dynamically allocate so we can add it as a menu arg, but also, skip the SD root to | ||
// save space. | ||
asiprintf(&lang_file, "%s", full_path + strlen(fs_sd_root()) + 1); | ||
|
||
if (lang_file != NULL) { | ||
ESP_LOGI(TAG, "Adding language: %s", lang->valuestring); | ||
|
||
ui_menu_item_t* item = ui_menu_add_item( | ||
arg->menu, lang->valuestring, on_language_select, (void*)lang_file | ||
); | ||
|
||
item->freer = free; | ||
} | ||
} | ||
} | ||
|
||
cJSON_Delete(root); | ||
} | ||
|
||
static void on_language_open(const ui_menu_t* m, UI_MENU_ARG_TYPE arg) { | ||
ui_menu_add_item(m, "English", on_language_select, NULL); | ||
|
||
struct dir_result_arg dir_arg = { .menu = m, .path = fs_sd_root(), .depth = 0 }; | ||
|
||
fs_read_dir(fs_sd_root(), _dir_result, FS_READ_NO_HIDDEN | FS_READ_NO_FREE, &dir_arg); | ||
} | ||
|
||
DYNAMIC_MENU(UI_LANGUAGE_MENU, "Language", on_language_open); |
Oops, something went wrong.