diff options
author | William Wilgus <wilgus.william@gmail.com> | 2020-07-31 22:45:10 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2020-08-17 10:15:14 -0400 |
commit | 35502834423049b319fde41ff305b48de67d2d51 (patch) | |
tree | 00d638d9348cd38f15cf6d341e700bc36153b3f8 /apps/settings_list.c | |
parent | d553bb1149800daf16dcb92bc0608fe6248e1dab (diff) | |
download | rockbox-35502834423049b319fde41ff305b48de67d2d51.tar.gz rockbox-35502834423049b319fde41ff305b48de67d2d51.zip |
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
Diffstat (limited to 'apps/settings_list.c')
-rw-r--r-- | apps/settings_list.c | 54 |
1 files changed, 23 insertions, 31 deletions
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 @@ | |||
38 | #include "power.h" | 38 | #include "power.h" |
39 | #include "powermgmt.h" | 39 | #include "powermgmt.h" |
40 | #include "kernel.h" | 40 | #include "kernel.h" |
41 | #include "open_plugin.h" | ||
41 | #ifdef HAVE_REMOTE_LCD | 42 | #ifdef HAVE_REMOTE_LCD |
42 | #include "lcd-remote.h" | 43 | #include "lcd-remote.h" |
43 | #endif | 44 | #endif |
@@ -680,6 +681,11 @@ static void tsc_set_default(void* setting, void* defaultval) | |||
680 | } | 681 | } |
681 | #endif | 682 | #endif |
682 | #ifdef HAVE_HOTKEY | 683 | #ifdef HAVE_HOTKEY |
684 | static void hotkey_callback(int var) | ||
685 | { | ||
686 | if (get_hotkey_lang_id(var) == LANG_OPEN_PLUGIN) | ||
687 | open_plugin_browse(ID2P(LANG_HOTKEY_WPS)); | ||
688 | } | ||
683 | static const char* hotkey_formatter(char* buffer, size_t buffer_size, int value, | 689 | static const char* hotkey_formatter(char* buffer, size_t buffer_size, int value, |
684 | const char* unit) | 690 | const char* unit) |
685 | { | 691 | { |
@@ -695,6 +701,12 @@ static int32_t hotkey_getlang(int value, int unit) | |||
695 | } | 701 | } |
696 | #endif /* HAVE_HOTKEY */ | 702 | #endif /* HAVE_HOTKEY */ |
697 | 703 | ||
704 | static void start_in_callback(int var) | ||
705 | { | ||
706 | if (var - 2 == GO_TO_PLUGIN) | ||
707 | open_plugin_browse(ID2P(LANG_START_SCREEN)); | ||
708 | } | ||
709 | |||
698 | /* volume limiter */ | 710 | /* volume limiter */ |
699 | static void volume_limit_load_from_cfg(void* var, char*value) | 711 | static void volume_limit_load_from_cfg(void* var, char*value) |
700 | { | 712 | { |
@@ -1872,7 +1884,7 @@ const struct settings_list settings[] = { | |||
1872 | UNIT_SEC, formatter_time_unit_0_is_skip_track, | 1884 | UNIT_SEC, formatter_time_unit_0_is_skip_track, |
1873 | getlang_time_unit_0_is_skip_track, NULL, | 1885 | getlang_time_unit_0_is_skip_track, NULL, |
1874 | 25, timeout_sec_common), | 1886 | 25, timeout_sec_common), |
1875 | CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1, | 1887 | CHOICE_SETTING(F_CB_ON_SELECT_ONLY, start_in_screen, LANG_START_SCREEN, 1, |
1876 | "start in screen", "previous,root,files," | 1888 | "start in screen", "previous,root,files," |
1877 | #ifdef HAVE_TAGCACHE | 1889 | #ifdef HAVE_TAGCACHE |
1878 | #define START_DB_COUNT 1 | 1890 | #define START_DB_COUNT 1 |
@@ -1893,15 +1905,10 @@ const struct settings_list settings[] = { | |||
1893 | #else | 1905 | #else |
1894 | #define START_TUNER_COUNT 0 | 1906 | #define START_TUNER_COUNT 0 |
1895 | #endif | 1907 | #endif |
1896 | "bookmarks" | 1908 | "bookmarks," |
1897 | #ifdef HAVE_PICTUREFLOW_INTEGRATION | 1909 | "plugin" |
1898 | #define START_PF_COUNT 1 | 1910 | , start_in_callback, |
1899 | ",pictureflow" | 1911 | (7 + START_DB_COUNT + START_REC_COUNT + START_TUNER_COUNT), |
1900 | #else | ||
1901 | #define START_PF_COUNT 0 | ||
1902 | #endif | ||
1903 | , NULL, | ||
1904 | (6 + START_DB_COUNT + START_REC_COUNT + START_TUNER_COUNT + START_PF_COUNT), | ||
1905 | ID2P(LANG_PREVIOUS_SCREEN), ID2P(LANG_MAIN_MENU), | 1912 | ID2P(LANG_PREVIOUS_SCREEN), ID2P(LANG_MAIN_MENU), |
1906 | ID2P(LANG_DIR_BROWSER), | 1913 | ID2P(LANG_DIR_BROWSER), |
1907 | #ifdef HAVE_TAGCACHE | 1914 | #ifdef HAVE_TAGCACHE |
@@ -1914,10 +1921,8 @@ const struct settings_list settings[] = { | |||
1914 | #if CONFIG_TUNER | 1921 | #if CONFIG_TUNER |
1915 | ID2P(LANG_FM_RADIO), | 1922 | ID2P(LANG_FM_RADIO), |
1916 | #endif | 1923 | #endif |
1917 | ID2P(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS) | 1924 | ID2P(LANG_BOOKMARK_MENU_RECENT_BOOKMARKS), |
1918 | #ifdef HAVE_PICTUREFLOW_INTEGRATION | 1925 | ID2P(LANG_OPEN_PLUGIN) |
1919 | ,ID2P(LANG_ONPLAY_PICTUREFLOW) | ||
1920 | #endif | ||
1921 | ), | 1926 | ), |
1922 | SYSTEM_SETTING(NVRAM(1),last_screen,-1), | 1927 | SYSTEM_SETTING(NVRAM(1),last_screen,-1), |
1923 | #if defined(HAVE_RTC_ALARM) && \ | 1928 | #if defined(HAVE_RTC_ALARM) && \ |
@@ -2098,25 +2103,12 @@ const struct settings_list settings[] = { | |||
2098 | #endif | 2103 | #endif |
2099 | 2104 | ||
2100 | #ifdef HAVE_HOTKEY | 2105 | #ifdef HAVE_HOTKEY |
2101 | TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_wps, | 2106 | TABLE_SETTING(F_ALLOW_ARBITRARY_VALS | F_CB_ON_SELECT_ONLY, hotkey_wps, |
2102 | LANG_HOTKEY_WPS, HOTKEY_VIEW_PLAYLIST, "hotkey wps", | 2107 | LANG_HOTKEY_WPS, HOTKEY_VIEW_PLAYLIST, "hotkey wps", |
2103 | "off,view playlist,show track info,pitchscreen,open with,delete,bookmark" | 2108 | "off,view playlist,show track info,pitchscreen,open with,delete,bookmark,plugin" |
2104 | #ifdef HAVE_PICTUREFLOW_INTEGRATION | 2109 | ,UNIT_INT, hotkey_formatter, hotkey_getlang, hotkey_callback,8, HOTKEY_OFF, |
2105 | ",pictureflow" | ||
2106 | #endif | ||
2107 | ,UNIT_INT, hotkey_formatter, hotkey_getlang, NULL, | ||
2108 | #ifdef HAVE_PICTUREFLOW_INTEGRATION | ||
2109 | 8, | ||
2110 | #else | ||
2111 | 7, | ||
2112 | #endif | ||
2113 | HOTKEY_OFF, | ||
2114 | HOTKEY_VIEW_PLAYLIST, HOTKEY_SHOW_TRACK_INFO, HOTKEY_PITCHSCREEN, | 2110 | HOTKEY_VIEW_PLAYLIST, HOTKEY_SHOW_TRACK_INFO, HOTKEY_PITCHSCREEN, |
2115 | HOTKEY_OPEN_WITH, HOTKEY_DELETE, HOTKEY_BOOKMARK | 2111 | HOTKEY_OPEN_WITH, HOTKEY_DELETE, HOTKEY_BOOKMARK, HOTKEY_PLUGIN), |
2116 | #ifdef HAVE_PICTUREFLOW_INTEGRATION | ||
2117 | , HOTKEY_PICTUREFLOW | ||
2118 | #endif | ||
2119 | ), | ||
2120 | TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_tree, | 2112 | TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, hotkey_tree, |
2121 | LANG_HOTKEY_FILE_BROWSER, HOTKEY_OFF, "hotkey tree", | 2113 | LANG_HOTKEY_FILE_BROWSER, HOTKEY_OFF, "hotkey tree", |
2122 | "off,open with,delete,insert,insert shuffled", | 2114 | "off,open with,delete,insert,insert shuffled", |