From 3ce6e179a94e6000d8dc08650a3614a13a8f29f4 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Mon, 21 Mar 2011 12:46:56 +0100 Subject: Initial station manager Not functional yet. --- src/settings.h | 3 ++- src/ui_act.c | 42 ++++++++++++++++++++++++++++++++++++++++++ src/ui_act.h | 1 + src/ui_dispatch.h | 2 ++ 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/settings.h b/src/settings.h index 58ff3d1..90691db 100644 --- a/src/settings.h +++ b/src/settings.h @@ -53,8 +53,9 @@ typedef enum { BAR_KS_BOOKMARK = 21, BAR_KS_VOLDOWN = 22, BAR_KS_VOLUP = 23, + BAR_KS_MANAGESTATION = 24, /* insert new shortcuts _before_ this element and increase its value */ - BAR_KS_COUNT = 24, + BAR_KS_COUNT = 25, } BarKeyShortcutId_t; #define BAR_KS_DISABLED '\x00' diff --git a/src/ui_act.c b/src/ui_act.c index 096daa1..fc45775 100644 --- a/src/ui_act.c +++ b/src/ui_act.c @@ -528,3 +528,45 @@ BarUiActCallback(BarUiActVolUp) { app->player.scale = BarPlayerCalcScale (app->player.gain + app->settings.volume); } +/* manage station (remove seeds or feedback) + */ +BarUiActCallback(BarUiActManageStation) { + PianoReturn_t pRet; + WaitressReturn_t wRet; + PianoRequestDataGetStationInfo_t reqData; + char selectBuf[2]; + + memset (&reqData, 0, sizeof (reqData)); + reqData.station = selStation; + + BarUiMsg (MSG_INFO, "Fetching station info... "); + BarUiActDefaultPianoCall (PIANO_REQUEST_GET_STATION_INFO, &reqData); + BarUiActDefaultEventcmd ("stationfetchinfo"); + + BarUiMsg (MSG_QUESTION, "Delete [a]rtist/[s]ong seeds or [f]eedback? "); + if (BarReadline (selectBuf, sizeof (selectBuf), "asf", &app->input, + BAR_RL_FULLRETURN, -1)) { + if (selectBuf[0] == 'a') { + PianoArtist_t *artist = BarUiSelectArtist (reqData.info.artistSeeds, + &app->input); + if (artist != NULL) { + BarUiMsg (MSG_INFO, "Deleting artist %s\n", artist->name); + } + } else if (selectBuf[0] == 's') { + PianoSong_t *song = BarUiSelectSong (&app->settings, + reqData.info.songSeeds, &app->input); + if (song != NULL) { + BarUiMsg (MSG_INFO, "Deleting seed %s\n", song->title); + } + } else if (selectBuf[0] == 'f') { + PianoSong_t *song = BarUiSelectSong (&app->settings, + reqData.info.feedback, &app->input); + if (song != NULL) { + BarUiMsg (MSG_INFO, "Deleting feedback for %s\n", song->title); + } + } + } + + PianoDestroyStationInfo (&reqData.info); +} + diff --git a/src/ui_act.h b/src/ui_act.h index ca67c63..4173b75 100644 --- a/src/ui_act.h +++ b/src/ui_act.h @@ -57,5 +57,6 @@ BarUiActCallback(BarUiActHistory); BarUiActCallback(BarUiActBookmark); BarUiActCallback(BarUiActVolDown); BarUiActCallback(BarUiActVolUp); +BarUiActCallback(BarUiActManageStation); #endif /* _UI_ACT_H */ diff --git a/src/ui_dispatch.h b/src/ui_dispatch.h index c5aecc5..b2b5a36 100644 --- a/src/ui_dispatch.h +++ b/src/ui_dispatch.h @@ -92,6 +92,8 @@ static const BarUiDispatchAction_t dispatchActions[BAR_KS_COUNT] = { "act_voldown"}, {BAR_DC_GLOBAL, BarUiActVolUp, "increase volume", ')', "act_volup"}, + {BAR_DC_STATION, BarUiActManageStation, "delete seeds/feedback", '=', + "act_managestation"}, }; #include -- cgit v1.2.3