summaryrefslogtreecommitdiffstats
path: root/apps/plugins/stats.c
diff options
context:
space:
mode:
authorJean-Louis Biasini <jlbiasini@gmail.com>2012-02-09 14:18:46 +0100
committerThomas Martitz <kugel@rockbox.org>2012-02-22 09:15:50 +0100
commitd8fd988cf2f18d900accecc5f07f12ec71c48e73 (patch)
treeef161bcfb6c5fe61e8fde5c8a32f576da77da71d /apps/plugins/stats.c
parent164cb21fe5964a8bc3a78f9acbccea0ab7295ccf (diff)
downloadrockbox-d8fd988cf2f18d900accecc5f07f12ec71c48e73.tar.gz
rockbox-d8fd988cf2f18d900accecc5f07f12ec71c48e73.tar.bz2
rockbox-d8fd988cf2f18d900accecc5f07f12ec71c48e73.zip
stats's plugin PLA integration (main code + manual)
1) this patch replace all keymaps with PLA ones. It also clean some optionnal compiling that are not needed anymore througt PLA 2) the patch also made required change to the manual in order to match code's change. 3) it also add an alternative exit button (PLA_EXIT or PLA_CANCEL) TO TEST: I'm not sure if remote control works anymore and cannot test it. I'm not sure about the way PLA handle those so if that doesn't work let me know ;) Change-Id: I3fb81e75ef6e4d49e19be24f09c0413599ed0c9c Reviewed-on: http://gerrit.rockbox.org/90 Tested-by: Thomas Martitz <kugel@rockbox.org> Reviewed-by: Thomas Martitz <kugel@rockbox.org>
Diffstat (limited to 'apps/plugins/stats.c')
-rw-r--r--apps/plugins/stats.c115
1 files changed, 13 insertions, 102 deletions
diff --git a/apps/plugins/stats.c b/apps/plugins/stats.c
index da231b772c..ff23911336 100644
--- a/apps/plugins/stats.c
+++ b/apps/plugins/stats.c
@@ -19,105 +19,19 @@
*
****************************************************************************/
#include "plugin.h"
-
+#include "lib/pluginlib_actions.h"
static int files, dirs, audiofiles, m3ufiles, imagefiles, videofiles, largestdir;
static int lasttick;
static bool cancel;
-#if CONFIG_KEYPAD == PLAYER_PAD
-#define STATS_STOP BUTTON_STOP
-
-#elif (CONFIG_KEYPAD == RECORDER_PAD) \
- || (CONFIG_KEYPAD == ONDIO_PAD) \
- || (CONFIG_KEYPAD == ARCHOS_AV300_PAD)
-#define STATS_STOP BUTTON_OFF
-
-#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) \
- || (CONFIG_KEYPAD == IRIVER_H300_PAD)
-#define STATS_STOP BUTTON_OFF
-#define STATS_STOP_REMOTE BUTTON_RC_STOP
-
-#elif (CONFIG_KEYPAD == IPOD_4G_PAD) || \
- (CONFIG_KEYPAD == IPOD_3G_PAD) || \
- (CONFIG_KEYPAD == IPOD_1G2G_PAD)
-#define STATS_STOP BUTTON_MENU
-
-#elif (CONFIG_KEYPAD == IRIVER_IFP7XX_PAD) || \
- (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
-#define STATS_STOP BUTTON_PLAY
-
-#elif CONFIG_KEYPAD == IAUDIO_X5M5_PAD
-#define STATS_STOP BUTTON_POWER
-#define STATS_STOP_REMOTE BUTTON_RC_PLAY
-
-#elif CONFIG_KEYPAD == GIGABEAT_PAD
-#define STATS_STOP BUTTON_POWER
-
-#elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \
-(CONFIG_KEYPAD == SANSA_C200_PAD) || \
-(CONFIG_KEYPAD == SANSA_CLIP_PAD) || \
-(CONFIG_KEYPAD == SANSA_M200_PAD) || \
-(CONFIG_KEYPAD == SANSA_CONNECT_PAD)
-#define STATS_STOP BUTTON_POWER
-
-#elif (CONFIG_KEYPAD == SANSA_FUZE_PAD)
-#define STATS_STOP BUTTON_HOME
-
-#elif CONFIG_KEYPAD == IRIVER_H10_PAD
-#define STATS_STOP BUTTON_POWER
-
-#elif CONFIG_KEYPAD == MROBE500_PAD
-#define STATS_STOP BUTTON_POWER
-#define STATS_STOP_REMOTE BUTTON_RC_DOWN
-
-#elif CONFIG_KEYPAD == GIGABEAT_S_PAD || \
- CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
-#define STATS_STOP BUTTON_BACK
-
-#elif CONFIG_KEYPAD == MROBE100_PAD
-#define STATS_STOP BUTTON_POWER
-#define STATS_STOP_REMOTE BUTTON_RC_DOWN
-
-#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
-#define STATS_STOP BUTTON_REC
-#define STATS_STOP_REMOTE BUTTON_RC_REC
-
-#elif CONFIG_KEYPAD == COWON_D2_PAD
-#define STATS_STOP BUTTON_POWER
-#elif CONFIG_KEYPAD == IAUDIO67_PAD
-#define STATS_STOP BUTTON_POWER
-
-#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
-#define STATS_STOP BUTTON_BACK
-
-#elif (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD) || \
-(CONFIG_KEYPAD == PHILIPS_HDD6330_PAD) || \
-(CONFIG_KEYPAD == PHILIPS_SA9200_PAD)
-#define STATS_STOP BUTTON_POWER
-
-#elif CONFIG_KEYPAD == ONDAVX747_PAD
-#define STATS_STOP BUTTON_POWER
-#elif CONFIG_KEYPAD == ONDAVX777_PAD
-#define STATS_STOP BUTTON_POWER
-
-#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
-#define STATS_STOP BUTTON_REC
-
-#elif CONFIG_KEYPAD == MPIO_HD200_PAD
-#define STATS_STOP BUTTON_REC
-
-#elif CONFIG_KEYPAD == MPIO_HD300_PAD
-#define STATS_STOP BUTTON_REC
-
-#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
-#define STATS_STOP BUTTON_BACK
-
-#else
-#error No keymap defined!
-#endif
+/* we use PLA */
+#define STATS_STOP PLA_EXIT
+#define STATS_STOP2 PLA_CANCEL
+/* this set the context to use with PLA */
+static const struct button_mapping *plugin_contexts[] = { pla_main_ctx };
/* we don't have yet a filetype attribute for image files */
static const char *image_exts[] = {"bmp","jpg","jpe","jpeg","png","ppm"};
@@ -240,12 +154,9 @@ static void traversedir(char* location, char* name)
if (*rb->current_tick - lasttick > (HZ/2)) {
update_screen();
lasttick = *rb->current_tick;
- button = rb->button_get(false);
- if (button == STATS_STOP
-#ifdef HAVE_REMOTE_LCD
- || button == STATS_STOP_REMOTE
-#endif
- ) {
+ button = pluginlib_getaction(TIMEOUT_NOBLOCK, plugin_contexts,
+ ARRAYLEN(plugin_contexts));
+ if (button == STATS_STOP) {
cancel = true;
break;
}
@@ -292,12 +203,12 @@ enum plugin_status plugin_start(const void* parameter)
rb->splash(HZ, "Done");
update_screen();
while (1) {
- button = rb->button_get(true);
+
+ button = pluginlib_getaction(TIMEOUT_BLOCK, plugin_contexts,
+ ARRAYLEN(plugin_contexts));
switch (button) {
-#ifdef HAVE_REMOTE_LCD
- case STATS_STOP_REMOTE:
-#endif
case STATS_STOP:
+ case STATS_STOP2:
return PLUGIN_OK;
break;
default: