diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 6c58d4911..2db967ba5 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -532,6 +532,7 @@ favorites.copy Kopiere Bouquet zu Favoriten favorites.finalhint \nVersehentlich hinzugefügte Kanäle können mit\nder Bouquetverwaltung korrigiert werden.\n favorites.menueadd Kanal Favoriten hinzufügen favorites.nobouquets Favoriten sind nur mit aktivierten Bouquets möglich. +filebrowser.add Hinzufügen filebrowser.delete Löschen filebrowser.denydirectoryleave Startverzeichnis absolut filebrowser.dodelete1 Soll @@ -541,6 +542,7 @@ filebrowser.filter.inactive Filter aus filebrowser.head Dateibrowser filebrowser.mark Markieren filebrowser.nextpage Seite vor +filebrowser.pm Playlist Manager filebrowser.prevpage Seite zurück filebrowser.scan Durchsuche Verzeichnisse filebrowser.select Auswählen diff --git a/data/locale/english.locale b/data/locale/english.locale index dae69ce6b..bee72c1cd 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -532,6 +532,7 @@ favorites.copy Copy bouquet to Favorites favorites.finalhint \nUse the bouqueteditor to modify your favorites.\n favorites.menueadd add channel to favorites favorites.nobouquets Favorites are available with activated Bouquets only. +filebrowser.add Add filebrowser.delete Delete filebrowser.denydirectoryleave Absolute start directory filebrowser.dodelete1 Delete @@ -541,6 +542,7 @@ filebrowser.filter.inactive Filter off filebrowser.head Filebrowser filebrowser.mark Mark filebrowser.nextpage Next Page +filebrowser.pm Playlist Manager filebrowser.prevpage Prev. Page filebrowser.scan Scaning folder filebrowser.select Select diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index bce3e01eb..8b258c500 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -597,6 +597,7 @@ bool CFileBrowser::exec(const char * const dirname) bool res = false; menu_ret = menu_return::RETURN_REPAINT; + playlistmode = false; #ifdef ENABLE_INTERNETRADIO if (m_Mode == ModeSC) { m_baseurl = base; @@ -905,6 +906,187 @@ bool CFileBrowser::exec(const char * const dirname) return res; } +bool CFileBrowser::playlist_manager(CFileList &playlist, unsigned int playing) +{ + neutrino_msg_t msg; + neutrino_msg_data_t data; + + bool res = false; + menu_ret = menu_return::RETURN_REPAINT; + + filelist = playlist; + playlistmode = true; + + fontInit(); + paintHead(); + selected = playing; + + unsigned int oldselected = selected; + + paint(); + paintFoot(); + + uint64_t timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_FILEBROWSER]); + + bool loop=true; + while (loop) + { + frameBuffer->blit(); + g_RCInput->getMsgAbsoluteTimeout( &msg, &data, &timeoutEnd ); + neutrino_msg_t msg_repeatok = msg & ~CRCInput::RC_Repeat; + + if (msg <= CRCInput::RC_MaxRC) + timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_FILEBROWSER]); + + if(!CRCInput::isNumeric(msg)) + { + m_SMSKeyInput.resetOldKey(); + paintSMSKey(); + } + if (msg == CRCInput::RC_home) + { + loop = false; + } + else if (msg == NeutrinoMessages::STANDBY_ON || + msg == NeutrinoMessages::SHUTDOWN || + msg == NeutrinoMessages::SLEEPTIMER) + { + menu_ret = menu_return::RETURN_EXIT_ALL; + loop = false; + g_RCInput->postMsg(msg, data); + } + else if (msg == CRCInput::RC_timeout) + { + selected = oldselected; + loop = false; + } + else if (msg > CRCInput::RC_MaxRC) + { + if (CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all) { + menu_ret = menu_return::RETURN_EXIT_ALL; + loop = false; + } + } + if ((filelist.empty())) + continue; + + if (msg_repeatok == CRCInput::RC_up) + { + unsigned int prevselected=selected; + unsigned int prevliststart = liststart; + if (selected) + selected --; + else + selected = filelist.size() - 1; + liststart = (selected/listmaxshow)*listmaxshow; + if(prevliststart != liststart) + { + paint(); + } + else + { + paintItem(prevselected - prevliststart); + paintItem(selected - liststart); + } + } + else if (msg_repeatok == CRCInput::RC_down) + { + unsigned int prevselected=selected; + unsigned int prevliststart = liststart; + selected = (selected + 1) % filelist.size(); + liststart = (selected/listmaxshow)*listmaxshow; + if(prevliststart != liststart) + { + paint(); + } + else + { + paintItem(prevselected - prevliststart); + paintItem(selected - liststart); + } + } + else if (msg == (neutrino_msg_t) g_settings.key_pagedown) + { + unsigned int last = filelist.size() - 1; + if (selected != last && selected + listmaxshow >= filelist.size()) { + selected = last; + } else { + selected = (selected == last) ? 0 : selected + listmaxshow; + liststart = (selected / listmaxshow) * listmaxshow; + } + paint(); + } + else if (msg == (neutrino_msg_t) g_settings.key_pageup) + { + if (selected && selected < listmaxshow) { + selected = 0; + } else { + selected = selected ? selected - listmaxshow : filelist.size() - 1; + liststart = (selected/listmaxshow)*listmaxshow; + } + paint(); + } + else if (msg == CRCInput::RC_red) + { + if (filelist.size() > 1) + { + filelist.erase(filelist.begin()+selected); + if (selected) selected --; + } + paint(); + } + else if (msg == CRCInput::RC_green) + { + CFileBrowser *addfiles = new CFileBrowser; + addfiles->Hide_records = true; + addfiles->Multi_Select = true; + addfiles->Dirs_Selectable = true; + addfiles->exec(g_settings.network_nfs_moviedir.c_str()); + CFileList tmplist = addfiles->getSelectedFiles(); + filelist.insert( filelist.end(), tmplist.begin(), tmplist.end() ); + tmplist.clear(); + delete addfiles; + paintHead(); + paint(); + paintFoot(); + } + else if (msg == CRCInput::RC_yellow ) + { + if (++g_settings.filebrowser_sortmethod >= FILEBROWSER_NUMBER_OF_SORT_VARIANTS) + g_settings.filebrowser_sortmethod = 0; + + sort(filelist.begin(), filelist.end(), sortBy[g_settings.filebrowser_sortmethod]); + + paint(); + paintFoot(); + } + else if (msg == CRCInput::RC_blue ) + { + std::random_shuffle ( filelist.begin(), filelist.end() ); + selected = 0; + paint(); + paintFoot(); + } + else if (msg == CRCInput::RC_ok) + { + filelist[selected].Marked = true; + loop = false; + res = true; + } + else if (CRCInput::isNumeric(msg_repeatok)) + { + SMSInput(msg_repeatok); + } + } + + hide(); + frameBuffer->blit(); + + playlist = filelist; + + return res; +} + void CFileBrowser::addRecursiveDir(CFileList * re_filelist, std::string rpath, bool bRootCall, CProgressWindow * progress) { neutrino_msg_t msg; @@ -1115,7 +1297,7 @@ void CFileBrowser::paintHead() l = asprintf(&l_name, "%s %s", g_Locale->getText(LOCALE_AUDIOPLAYER_ADD_SC), FILESYSTEM_ENCODING_TO_UTF8_STRING(name).c_str()); else #endif - l = asprintf(&l_name, "%s %s", g_Locale->getText(LOCALE_FILEBROWSER_HEAD), FILESYSTEM_ENCODING_TO_UTF8_STRING(name).c_str()); + l = asprintf(&l_name, "%s %s", g_Locale->getText(playlistmode ? LOCALE_FILEBROWSER_PM : LOCALE_FILEBROWSER_HEAD), FILESYSTEM_ENCODING_TO_UTF8_STRING(name).c_str()); if (l < 1) /* at least 1 for the " " space */ { @@ -1176,6 +1358,8 @@ const struct button_label FileBrowserFilterButton[2] = int CFileBrowser::paintFoot(bool show) { + int cnt,res; + std::string sort_text = g_Locale->getText(LOCALE_MOVIEBROWSER_FOOT_SORT); sort_text += g_Locale->getText(sortByNames[g_settings.filebrowser_sortmethod]); @@ -1190,6 +1374,15 @@ int CFileBrowser::paintFoot(bool show) if (Filter != NULL && use_filter) f_loc = LOCALE_FILEBROWSER_FILTER_ACTIVE; + button_label_ext footerButtons_pm[] = { + { NEUTRINO_ICON_BUTTON_RED, LOCALE_FILEBROWSER_DELETE, NULL, 0, false }, + { NEUTRINO_ICON_BUTTON_GREEN, LOCALE_FILEBROWSER_ADD, NULL, 0, false }, + { NEUTRINO_ICON_BUTTON_YELLOW, NONEXISTANT_LOCALE, sort_text.c_str(), sort_text_len, false }, + { NEUTRINO_ICON_BUTTON_BLUE, LOCALE_AUDIOPLAYER_SHUFFLE, NULL, 0, false }, + { NEUTRINO_ICON_BUTTON_OKAY, LOCALE_FILEBROWSER_SELECT, NULL, 0, false }, + { NEUTRINO_ICON_BUTTON_PLAY, LOCALE_FILEBROWSER_MARK, NULL, 0, false }, + }; + button_label_ext footerButtons[] = { { NEUTRINO_ICON_BUTTON_RED, NONEXISTANT_LOCALE, sort_text.c_str(), sort_text_len, false }, { NEUTRINO_ICON_BUTTON_OKAY, LOCALE_FILEBROWSER_SELECT, NULL, 0, false }, @@ -1197,17 +1390,28 @@ int CFileBrowser::paintFoot(bool show) { NEUTRINO_ICON_BUTTON_PLAY, LOCALE_FILEBROWSER_MARK, NULL, 0, false }, { NEUTRINO_ICON_BUTTON_BLUE, f_loc, NULL, 0, false }, }; - int cnt = sizeof(footerButtons) / sizeof(button_label_ext); + + if (playlistmode) { + cnt = sizeof(footerButtons_pm) / sizeof(button_label_ext); + if (!show) + return paintButtons(footerButtons_pm, cnt, 0, 0, 0, 0, 0, false, NULL, NULL); + } else { + cnt = sizeof(footerButtons) / sizeof(button_label_ext); + if (!show) + return paintButtons(footerButtons, cnt, 0, 0, 0, 0, 0, false, NULL, NULL); + } + int fowidth = width - skwidth; - if (!show) - return paintButtons(footerButtons, cnt, 0, 0, 0, 0, 0, false, NULL, NULL); if (filelist.empty()) { frameBuffer->paintBoxRel(x, y + height - foheight, width, foheight, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_MID, CORNER_BOTTOM); return foheight; } - int res = paintButtons(footerButtons, Filter ? cnt : cnt - 1, x, y + height - foheight, width, foheight, fowidth); + if (playlistmode) + res = paintButtons(footerButtons_pm, Filter ? cnt : cnt - 1, x, y + height - foheight, width, foheight, fowidth); + else + res = paintButtons(footerButtons, Filter ? cnt : cnt - 1, x, y + height - foheight, width, foheight, fowidth); paintSMSKey(); return res; } diff --git a/src/gui/filebrowser.h b/src/gui/filebrowser.h index aa30e5015..b0f640821 100644 --- a/src/gui/filebrowser.h +++ b/src/gui/filebrowser.h @@ -187,6 +187,7 @@ class CFileBrowser int paintFoot(bool show = true); void paintSMSKey(); void recursiveDelete(const char* file); + bool playlistmode; protected: void commonInit(); @@ -220,6 +221,7 @@ class CFileBrowser ~CFileBrowser(); bool exec(const char * const dirname); + bool playlist_manager(CFileList &playlist,unsigned int playing); CFile *getSelectedFile(); inline const CFileList & getSelectedFiles(void) const diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 5a7518d5c..9c6171b8c 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -885,6 +885,22 @@ void CMoviePlayerGui::PlayFileLoop(void) updateLcd(); if (timeshift == TSHIFT_MODE_OFF) callInfoViewer(); + } else if (filelist.size() > 0) { + CFileBrowser playlist; + CFile *pfile = NULL; + pfile = &(*filelist_it); + if (playlist.playlist_manager(filelist, std::distance( filelist.begin(), filelist_it ))) + { + playstate = CMoviePlayerGui::STOPPED; + CFile *sfile = NULL; + for (filelist_it = filelist.begin(); filelist_it != filelist.end(); ++filelist_it) + { + pfile = &(*filelist_it); + sfile = playlist.getSelectedFile(); + if ( (sfile->getFileName() == pfile->getFileName()) && (sfile->getPath() == pfile->getPath())) + break; + } + } } } else if (msg == (neutrino_msg_t) g_settings.mpkey_pause) { if (playstate == CMoviePlayerGui::PAUSE) { diff --git a/src/system/locals.h b/src/system/locals.h index 6d9e28afd..25932f0e7 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -559,6 +559,7 @@ typedef enum LOCALE_FAVORITES_FINALHINT, LOCALE_FAVORITES_MENUEADD, LOCALE_FAVORITES_NOBOUQUETS, + LOCALE_FILEBROWSER_ADD, LOCALE_FILEBROWSER_DELETE, LOCALE_FILEBROWSER_DENYDIRECTORYLEAVE, LOCALE_FILEBROWSER_DODELETE1, @@ -568,6 +569,7 @@ typedef enum LOCALE_FILEBROWSER_HEAD, LOCALE_FILEBROWSER_MARK, LOCALE_FILEBROWSER_NEXTPAGE, + LOCALE_FILEBROWSER_PM, LOCALE_FILEBROWSER_PREVPAGE, LOCALE_FILEBROWSER_SCAN, LOCALE_FILEBROWSER_SELECT, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 18e8301a7..0d50f7579 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -559,6 +559,7 @@ const char * locale_real_names[] = "favorites.finalhint", "favorites.menueadd", "favorites.nobouquets", + "filebrowser.add", "filebrowser.delete", "filebrowser.denydirectoryleave", "filebrowser.dodelete1", @@ -568,6 +569,7 @@ const char * locale_real_names[] = "filebrowser.head", "filebrowser.mark", "filebrowser.nextpage", + "filebrowser.pm", "filebrowser.prevpage", "filebrowser.scan", "filebrowser.select",