playlists added dialog

This commit is contained in:
NotImplementedLife 2023-06-19 19:54:46 +03:00
parent b0ad464e65
commit 28967284d8
3 changed files with 93 additions and 17 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 988 B

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -177,6 +177,10 @@ public:
{ {
close()->next(get_playlists_scene()); close()->next(get_playlists_scene());
} }
else if(touch_in_rect(96,154,64,24))
{
go_to_player();
}
} }
else if(keys & KEY_B) else if(keys & KEY_B)
{ {
@ -184,25 +188,25 @@ public:
} }
else if(keys & KEY_A) else if(keys & KEY_A)
{ {
int index = 3*thumbnail_sel_row+thumbnail_sel_col;
if(ppm_states[index]<0)
return;
load_path(9*crt_page+index);
Debug::log(flipnote_path);
selected_flipnote_path = flipnote_path;
flipnote_path = nullptr;
selected_thumbnail_page = crt_page;
selected_thumbnail_index = index;
go_to_player(); go_to_player();
} }
} }
void go_to_player() void go_to_player()
{ {
int index = 3*thumbnail_sel_row+thumbnail_sel_col;
if(ppm_states[index]<0)
return;
load_path(9*crt_page+index);
Debug::log(flipnote_path);
selected_flipnote_path = flipnote_path;
flipnote_path = nullptr;
selected_thumbnail_page = crt_page;
selected_thumbnail_index = index;
delete[] selected_location->path; delete[] selected_location->path;
selected_location->path = nullptr; selected_location->path = nullptr;
delete selected_location; delete selected_location;

View File

@ -20,6 +20,10 @@ private:
Sprite* add_folder_icon=nullptr; Sprite* add_folder_icon=nullptr;
Sprite* back_arrow = nullptr; Sprite* back_arrow = nullptr;
Sprite* reindex_icon = nullptr;
Sprite* remove_icon = nullptr;
VwfEngine* vwf = new VwfEngine(Resources::Fonts::default_8x16); VwfEngine* vwf = new VwfEngine(Resources::Fonts::default_8x16);
LocationsProvider* locations_provider; LocationsProvider* locations_provider;
@ -68,6 +72,14 @@ public:
locations_provider = nullptr; locations_provider = nullptr;
close()->next(get_folder_picker_scene()); close()->next(get_folder_picker_scene());
} }
else if(touch_in_rect(180,0,32,32))
{
if(show_yes_no_dialog("Do you want to reindex the location?", 24))
{
Debug::log("Dialog accepted");
}
}
else if(touch_in_rect(0,0,32,32)) else if(touch_in_rect(0,0,32,32))
{ {
close()->next(gen_title_scene()); close()->next(gen_title_scene());
@ -119,6 +131,15 @@ public:
back_arrow->add_frame(new ObjFrame(&ROA_back_arrow8,0,0)); back_arrow->add_frame(new ObjFrame(&ROA_back_arrow8,0,0));
back_arrow->set_position(0, 0); back_arrow->set_position(0, 0);
reindex_icon = create_sprite(new Sprite(SIZE_32x32, Engine::Sub));
reindex_icon->add_frame(new ObjFrame(&ROA_folder_icon8,0,4));
reindex_icon->set_position(180, 0);
remove_icon = create_sprite(new Sprite(SIZE_32x32, Engine::Sub));
remove_icon->add_frame(new ObjFrame(&ROA_folder_icon8,0,5));
remove_icon->set_position(140, 0);
end_sprites_init(); end_sprites_init();
key_down.add_event(&PlaylistsScene::on_key_down, this); key_down.add_event(&PlaylistsScene::on_key_down, this);
@ -177,6 +198,8 @@ public:
vwf->put_text("Indexing files", Pal4bit, SolidColorBrush(0x2)); vwf->put_text("Indexing files", Pal4bit, SolidColorBrush(0x2));
add_folder_icon->hide(); add_folder_icon->hide();
reindex_icon->hide();
remove_icon->hide();
back_arrow->hide(); back_arrow->hide();
GenericScene256::frame(); GenericScene256::frame();
swiWaitForVBlank(); swiWaitForVBlank();
@ -252,24 +275,70 @@ public:
} }
add_folder_icon->show(); add_folder_icon->show();
reindex_icon->show();
remove_icon->show();
back_arrow->show(); back_arrow->show();
display_page(); display_page();
} }
Scene::run(); Scene::run();
} }
bool show_yes_no_dialog(const char* message, int x)
{
vwf->clear(Pal4bit);
vwf->set_cursor(6, x);
vwf->put_text(message, Pal4bit, SolidColorBrush(0x1));
vwf->set_cursor(8, 86);
vwf->put_text("Yes", Pal4bit, SolidColorBrush(0x1));
vwf->set_cursor(8, 156);
vwf->put_text("No", Pal4bit, SolidColorBrush(0x1));
int val=1;
bool working=true;
while(working)
{
swiWaitForVBlank();
scanKeys();
int keys = keysDown();
if(keys & (KEY_LEFT | KEY_RIGHT)) val^=1;
else if(keys & KEY_A)
{
working=false;
}
else if(keys & KEY_B)
{
working=false;
val=0;
}
vwf->clear_row(8, Pal4bit);
vwf->set_cursor(8, 86);
vwf->put_text("Yes", Pal4bit, SolidColorBrush(0x1+val));
vwf->set_cursor(8, 156);
vwf->put_text("No", Pal4bit, SolidColorBrush(0x2-val));
}
display_page();
return val;
}
int loc_selected_index=0; int loc_selected_index=0;
void display_page() void display_page()
{ {
reindex_icon->show();
remove_icon->show();
vwf->clear(Pal4bit); vwf->clear(Pal4bit);
for(int i=0;i<4;i++) for(int i=0;i<4;i++)
folder_icons[i]->hide(); folder_icons[i]->hide();
if(locations_provider->get_count()==0) if(locations_provider->get_count()==0)
{ {
reindex_icon->hide();
remove_icon->hide();
vwf->set_cursor(6, 40); vwf->set_cursor(6, 40);
vwf->put_text("No flipnote locations. Add one!", Pal4bit, SolidColorBrush(0x3)); vwf->put_text("No flipnote locations. Add one!", Pal4bit, SolidColorBrush(0x3));
return; return;
@ -313,6 +382,9 @@ public:
delete folder_highlighted_frame; delete folder_highlighted_frame;
key_down.remove_event(&PlaylistsScene::on_key_down, this); key_down.remove_event(&PlaylistsScene::on_key_down, this);
delete locations_provider; delete locations_provider;
delete reindex_icon;
delete remove_icon;
} }
}; };