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
This commit is contained in:
William Wilgus 2020-07-31 22:45:10 -04:00
parent d553bb1149
commit 3550283442
25 changed files with 540 additions and 93 deletions

View file

@ -357,7 +357,8 @@ int ft_load(struct tree_context* c, const char* tempdir)
(*c->dirfilter == SHOW_LNG && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_LNG) ||
(*c->dirfilter == SHOW_MOD && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_MOD) ||
(*c->dirfilter == SHOW_PLUGINS && (dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_ROCK &&
(dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_LUA) ||
(dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_LUA &&
(dptr->attr & FILE_ATTR_MASK) != FILE_ATTR_OPX) ||
(callback_show_item && !callback_show_item(entry->d_name, dptr->attr, c)))
{
continue;
@ -625,6 +626,7 @@ int ft_enter(struct tree_context* c)
/* plugin file */
case FILE_ATTR_ROCK:
case FILE_ATTR_LUA:
case FILE_ATTR_OPX:
{
char *plugin = buf, *argument = NULL, lua_path[MAX_PATH];
int ret;
@ -634,6 +636,11 @@ int ft_enter(struct tree_context* c)
plugin = lua_path;
argument = buf;
}
else if ((file_attr & FILE_ATTR_MASK) == FILE_ATTR_OPX) {
snprintf(lua_path, sizeof(lua_path)-1, "%s/open_plugins.rock", VIEWERS_DIR); /* Use a #define here ? */
plugin = lua_path;
argument = buf;
}
if (global_settings.party_mode && audio_status()) {
splash(HZ, ID2P(LANG_PARTY_MODE));
@ -645,6 +652,9 @@ int ft_enter(struct tree_context* c)
case PLUGIN_GOTO_WPS:
play = true;
break;
case PLUGIN_GOTO_PLUGIN:
rc = GO_TO_PLUGIN;
break;
case PLUGIN_USB_CONNECTED:
if(*c->dirfilter > NUM_FILTER_MODES)
/* leave sub-browsers after usb, doing
@ -690,6 +700,9 @@ int ft_enter(struct tree_context* c)
case PLUGIN_USB_CONNECTED:
rc = GO_TO_FILEBROWSER;
break;
case PLUGIN_GOTO_PLUGIN:
rc = GO_TO_PLUGIN;
break;
case PLUGIN_GOTO_WPS:
rc = GO_TO_WPS;
break;