summaryrefslogtreecommitdiffstats
path: root/apps/gui/quickscreen.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui/quickscreen.c')
-rw-r--r--apps/gui/quickscreen.c122
1 files changed, 55 insertions, 67 deletions
diff --git a/apps/gui/quickscreen.c b/apps/gui/quickscreen.c
index b2f5050ab3..109414336f 100644
--- a/apps/gui/quickscreen.c
+++ b/apps/gui/quickscreen.c
@@ -39,6 +39,9 @@
#include "option_select.h"
#include "debug.h"
#include "shortcuts.h"
+#ifdef HAVE_ALBUMART
+#include "playback.h"
+#endif
/* 1 top, 1 bottom, 2 on either side, 1 for the icons
* if enough space, top and bottom have 2 lines */
@@ -285,14 +288,22 @@ static bool gui_quickscreen_do_button(struct gui_quickscreen * qs, int button)
static int quickscreen_touchscreen_button(void)
{
short x,y;
- /* only hitting the text counts, everything else is exit */
if (action_get_touchscreen_press(&x, &y) != BUTTON_REL)
return ACTION_NONE;
enum { left=1, right=2, top=4, bottom=8 };
- int bits = (x < LCD_WIDTH/3 ? left : (x > 2*LCD_WIDTH/3 ? 2 : right)) |
- (y < LCD_WIDTH/3 ? top : (y > 2*LCD_WIDTH/3 ? 8 : bottom));
+ int bits = 0;
+
+ if(x < LCD_WIDTH/3)
+ bits |= left;
+ else if(x > 2*LCD_WIDTH/3)
+ bits |= right;
+
+ if(y < LCD_HEIGHT/3)
+ bits |= top;
+ else if(y > 2*LCD_HEIGHT/3)
+ bits |= bottom;
switch(bits) {
case top:
@@ -309,13 +320,13 @@ static int quickscreen_touchscreen_button(void)
}
#endif
-static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter, bool *usb)
+static int gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_enter, bool *usb)
{
int button;
struct viewport parent[NB_SCREENS];
struct viewport vps[NB_SCREENS][QUICKSCREEN_ITEM_COUNT];
struct viewport vp_icons[NB_SCREENS];
- bool changed = false;
+ int ret = QUICKSCREEN_OK;
/* To quit we need either :
* - a second press on the button that made us enter
* - an action taken while pressing the enter button,
@@ -356,7 +367,7 @@ static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_ente
}
if (gui_quickscreen_do_button(qs, button))
{
- changed = true;
+ ret |= QUICKSCREEN_CHANGED;
can_quit = true;
FOR_NB_SCREENS(i)
gui_quickscreen_draw(qs, &screens[i], &parent[i],
@@ -367,17 +378,20 @@ static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_ente
else if (button == button_enter)
can_quit = true;
else if (button == ACTION_QS_VOLUP) {
- global_settings.volume += sound_steps(SOUND_VOLUME);
- setvol();
+ adjust_volume(1);
FOR_NB_SCREENS(i)
skin_update(CUSTOM_STATUSBAR, i, SKIN_REFRESH_NON_STATIC);
}
else if (button == ACTION_QS_VOLDOWN) {
- global_settings.volume -= sound_steps(SOUND_VOLUME);
- setvol();
+ adjust_volume(-1);
FOR_NB_SCREENS(i)
skin_update(CUSTOM_STATUSBAR, i, SKIN_REFRESH_NON_STATIC);
}
+ else if (button == ACTION_STD_CONTEXT)
+ {
+ ret |= QUICKSCREEN_GOTO_SHORTCUTS_MENU;
+ break;
+ }
if ((button == button_enter) && can_quit)
break;
@@ -390,73 +404,60 @@ static bool gui_syncquickscreen_run(struct gui_quickscreen * qs, int button_ente
{ /* stop scrolling before exiting */
for (int j = 0; j < QUICKSCREEN_ITEM_COUNT; j++)
screens[i].scroll_stop_viewport(&vps[i][j]);
- viewportmanager_theme_undo(i, true);
+ viewportmanager_theme_undo(i, !(ret & QUICKSCREEN_GOTO_SHORTCUTS_MENU));
}
- pop_current_activity();
- return changed;
-}
+ if (ret & QUICKSCREEN_GOTO_SHORTCUTS_MENU) /* Eliminate flashing of parent during */
+ pop_current_activity_without_refresh(); /* transition to Shortcuts */
+ else
+ pop_current_activity();
-static const struct settings_list *get_setting(int gs_value,
- const struct settings_list *defaultval)
-{
- if (gs_value != -1 && gs_value < nb_settings &&
- is_setting_quickscreenable(&settings[gs_value]))
- return &settings[gs_value];
- return defaultval;
+ return ret;
}
int quick_screen_quick(int button_enter)
{
struct gui_quickscreen qs;
- bool oldshuffle = global_settings.playlist_shuffle;
- int oldrepeat = global_settings.repeat_mode;
+#ifdef HAVE_ALBUMART
+ int old_album_art = global_settings.album_art;
+#endif
bool usb = false;
- if (global_settings.shortcuts_replaces_qs)
- return do_shortcut_menu(NULL);
+ for (int i = 0; i < 4; ++i)
+ {
+ qs.items[i] = global_settings.qs_items[i];
- qs.items[QUICKSCREEN_TOP] =
- get_setting(global_settings.qs_items[QUICKSCREEN_TOP], NULL);
- qs.items[QUICKSCREEN_LEFT] =
- get_setting(global_settings.qs_items[QUICKSCREEN_LEFT],
- find_setting(&global_settings.playlist_shuffle, NULL));
- qs.items[QUICKSCREEN_RIGHT] =
- get_setting(global_settings.qs_items[QUICKSCREEN_RIGHT],
- find_setting(&global_settings.repeat_mode, NULL));
- qs.items[QUICKSCREEN_BOTTOM] =
- get_setting(global_settings.qs_items[QUICKSCREEN_BOTTOM], NULL);
+ if (!is_setting_quickscreenable(qs.items[i]))
+ qs.items[i] = NULL;
+ }
qs.callback = NULL;
- if (gui_syncquickscreen_run(&qs, button_enter, &usb))
+ int ret = gui_syncquickscreen_run(&qs, button_enter, &usb);
+ if (ret & QUICKSCREEN_CHANGED)
{
settings_save();
- /* make sure repeat/shuffle/any other nasty ones get updated */
- if ( oldrepeat != global_settings.repeat_mode &&
- (audio_status() & AUDIO_STATUS_PLAY) )
- {
- audio_flush_and_reload_tracks();
- }
- if (oldshuffle != global_settings.playlist_shuffle
- && audio_status() & AUDIO_STATUS_PLAY)
- {
- replaygain_update();
- if (global_settings.playlist_shuffle)
- playlist_randomise(NULL, current_tick, true);
- else
- playlist_sort(NULL, true);
- }
+#ifdef HAVE_ALBUMART
+ if (old_album_art != global_settings.album_art)
+ set_albumart_mode(global_settings.album_art);
+#endif
}
- return (usb ? 1:0);
+ if (usb)
+ return QUICKSCREEN_IN_USB;
+ return ret & QUICKSCREEN_GOTO_SHORTCUTS_MENU ? QUICKSCREEN_GOTO_SHORTCUTS_MENU :
+ QUICKSCREEN_OK;
}
/* stuff to make the quickscreen configurable */
bool is_setting_quickscreenable(const struct settings_list *setting)
{
+ if (!setting)
+ return true;
+
/* to keep things simple, only settings which have a lang_id set are ok */
- if (setting->lang_id < 0 || (setting->flags&F_BANFROMQS))
+ if (setting->lang_id < 0 || (setting->flags & F_BANFROMQS))
return false;
- switch (setting->flags&F_T_MASK)
+
+ switch (setting->flags & F_T_MASK)
{
case F_T_BOOL:
return true;
@@ -467,16 +468,3 @@ bool is_setting_quickscreenable(const struct settings_list *setting)
return false;
}
}
-
-void set_as_qs_item(const struct settings_list *setting,
- enum quickscreen_item item)
-{
- int i;
- for (i = 0; i < nb_settings; i++)
- {
- if (&settings[i] == setting)
- break;
- }
-
- global_settings.qs_items[item] = i;
-}