From 35502834423049b319fde41ff305b48de67d2d51 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Fri, 31 Jul 2020 22:45:10 -0400 Subject: Add open_plugin to core open_plugin allows arbitrary plugins to be called in hotkey and start screen replaces PictureFlow Integration shortcuts menu plays plugins now too rather than store paths and parameters in the settings that reside in memory instead entries in a file are searched by hash. after all, the plugin has to be loaded from disk anyways ---------------------------------------------------------------------------- shortcut_viewer.rock-- can now call plugins rather than taking you to them in the browser ----------------------------------------------------------------------------- Added a new option to menus: F_CB_ON_SELECT_ONLY instead of option callback every time a item is accessed F_CB_ON_SELECT_ONLY fires callback only when item is selected ----------------------------------------------------------------------------- Added manual entries ----------------------------------------------------------------------------- Change-Id: I078b57b1d2b4dd633c89212c1082fcbc1b516e6a --- apps/settings_list.c | 54 ++++++++++++++++++++++------------------------------ 1 file changed, 23 insertions(+), 31 deletions(-) (limited to 'apps/settings_list.c') diff --git a/apps/settings_list.c b/apps/settings_list.c index 1c33f3dc86..a38ebc639c 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -38,6 +38,7 @@ #include "power.h" #include "powermgmt.h" #include "kernel.h" +#include "open_plugin.h" #ifdef HAVE_REMOTE_LCD #include "lcd-remote.h" #endif @@ -680,6 +681,11 @@ static void tsc_set_default(void* setting, void* defaultval) } #endif #ifdef HAVE_HOTKEY +static void hotkey_callback(int var) +{ + if (get_hotkey_lang_id(var) == LANG_OPEN_PLUGIN) + open_plugin_browse(ID2P(LANG_HOTKEY_WPS)); +} static const char* hotkey_formatter(char* buffer, size_t buffer_size, int value, const char* unit) { @@ -695,6 +701,12 @@ static int32_t hotkey_getlang(int value, int unit) } #endif /* HAVE_HOTKEY */ +static void start_in_callback(int var) +{ + if (var - 2 == GO_TO_PLUGIN) + open_plugin_browse(ID2P(LANG_START_SCREEN)); +} + /* volume limiter */ static void volume_limit_load_from_cfg(void* var, char*value) { @@ -1872,7 +1884,7 @@ const struct settings_list settings[] = { UNIT_SEC, formatter_time_unit_0_is_skip_track, getlang_time_unit_0_is_skip_track, NULL, 25, timeout_sec_common), - CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1, + CHOICE_SETTING(F_CB_ON_SELECT_ONLY, start_in_screen, LANG_START_SCREEN, 1, "start in screen", "previous,root,files," #ifdef HAVE_TAGCACHE #define START_DB_COUNT 1 @@ -1893,15 +1905,10 @@ const struct settings_list settings[] = { #else #define START_TUNER_COUNT 0 #endif - "bookmarks" -#ifdef HAVE_PICTUREFLOW_INTEGRATION -#define START_PF_COUNT 1 - ",pictureflow" -#else -#define START_PF_COUNT 0 -#endif - , NULL, - (6 + START_DB_COUNT + START_REC_COUNT + START_TUNER_COUNT + START_PF_COUNT), + "bookmarks," + "plugin" + , start_in_callback, + (7 + START_DB_COUNT + START_REC_COUNT + START_TUNER_COUNT), ID2P(LANG_PREVIOUS_SCREEN), ID2P(LANG_MAIN_MENU), ID2P(LANG_DIR_BROWSER), #ifdef HAVE_TAGCACHE @@ -1914,10 +1921,8 @@ const struct settings_list settings[] = { #if CONFIG_TUNER ID2P(LANG_FM_RADIO), #endif - ID2P(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS) -#ifdef HAVE_PICTUREFLOW_INTEGRATION - ,ID2P(LANG_ONPLAY_PICTUREFLOW) -#endif + ID2P(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS), + ID2P(LANG_OPEN_PLUGIN) ), SYSTEM_SETTING(NVRAM(1),last_screen,-1), #if defined(HAVE_RTC_ALARM) && \ @@ -2098,25 +2103,12 @@ const struct settings_list settings[] = { #endif #ifdef HAVE_HOTKEY - TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_wps, + TABLE_SETTING(F_ALLOW_ARBITRARY_VALS | F_CB_ON_SELECT_ONLY, hotkey_wps, LANG_HOTKEY_WPS, HOTKEY_VIEW_PLAYLIST, "hotkey wps", - "off,view playlist,show track info,pitchscreen,open with,delete,bookmark" -#ifdef HAVE_PICTUREFLOW_INTEGRATION - ",pictureflow" -#endif - ,UNIT_INT, hotkey_formatter, hotkey_getlang, NULL, -#ifdef HAVE_PICTUREFLOW_INTEGRATION - 8, -#else - 7, -#endif - HOTKEY_OFF, + "off,view playlist,show track info,pitchscreen,open with,delete,bookmark,plugin" + ,UNIT_INT, hotkey_formatter, hotkey_getlang, hotkey_callback,8, HOTKEY_OFF, HOTKEY_VIEW_PLAYLIST, HOTKEY_SHOW_TRACK_INFO, HOTKEY_PITCHSCREEN, - HOTKEY_OPEN_WITH, HOTKEY_DELETE, HOTKEY_BOOKMARK -#ifdef HAVE_PICTUREFLOW_INTEGRATION - , HOTKEY_PICTUREFLOW -#endif - ), + HOTKEY_OPEN_WITH, HOTKEY_DELETE, HOTKEY_BOOKMARK, HOTKEY_PLUGIN), TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_tree, LANG_HOTKEY_FILE_BROWSER, HOTKEY_OFF, "hotkey tree", "off,open with,delete,insert,insert shuffled", -- cgit v1.2.3