mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-31 01:11:12 +02:00
gui/movieplayer.cpp: add title selection to bookmarks/chapters menu
This commit is contained in:
@@ -1322,25 +1322,53 @@ void CMoviePlayerGui::selectChapter()
|
|||||||
|
|
||||||
std::vector<int> positions; std::vector<std::string> titles;
|
std::vector<int> positions; std::vector<std::string> titles;
|
||||||
playback->GetChapters(positions, titles);
|
playback->GetChapters(positions, titles);
|
||||||
if (positions.empty())
|
|
||||||
|
std::vector<int> playlists; std::vector<std::string> ptitles;
|
||||||
|
int current;
|
||||||
|
playback->GetTitles(playlists, ptitles, current);
|
||||||
|
|
||||||
|
if (positions.empty() && playlists.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CMenuWidget ChSelector(LOCALE_MOVIEBROWSER_MENU_MAIN_BOOKMARKS, NEUTRINO_ICON_AUDIO);
|
CMenuWidget ChSelector(LOCALE_MOVIEBROWSER_MENU_MAIN_BOOKMARKS, NEUTRINO_ICON_AUDIO);
|
||||||
ChSelector.addIntroItems();
|
//ChSelector.addIntroItems();
|
||||||
|
ChSelector.addItem(GenericMenuCancel);
|
||||||
|
|
||||||
|
int pselect = -1;
|
||||||
|
CMenuSelectorTarget * pselector = new CMenuSelectorTarget(&pselect);
|
||||||
|
|
||||||
int select = -1;
|
int select = -1;
|
||||||
CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select);
|
CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select);
|
||||||
|
|
||||||
char cnt[5];
|
char cnt[5];
|
||||||
for (unsigned i = 0; i < positions.size(); i++) {
|
if (!playlists.empty()) {
|
||||||
sprintf(cnt, "%d", i);
|
ChSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_MOVIEPLAYER_TITLES));
|
||||||
CMenuForwarder * item = new CMenuForwarder(titles[i].c_str(), true, NULL, selector, cnt, CRCInput::convertDigitToKey(i + 1));
|
for (unsigned i = 0; i < playlists.size(); i++) {
|
||||||
ChSelector.addItem(item, position > positions[i]);
|
sprintf(cnt, "%d", i);
|
||||||
|
CMenuForwarder * item = new CMenuForwarder(ptitles[i].c_str(), current != playlists[i], NULL, pselector, cnt);
|
||||||
|
ChSelector.addItem(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!positions.empty()) {
|
||||||
|
ChSelector.addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_MOVIEPLAYER_CHAPTERS));
|
||||||
|
for (unsigned i = 0; i < positions.size(); i++) {
|
||||||
|
sprintf(cnt, "%d", i);
|
||||||
|
CMenuForwarder * item = new CMenuForwarder(titles[i].c_str(), true, NULL, selector, cnt, CRCInput::convertDigitToKey(i + 1));
|
||||||
|
ChSelector.addItem(item, position > positions[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ChSelector.exec(NULL, "");
|
ChSelector.exec(NULL, "");
|
||||||
delete selector;
|
delete selector;
|
||||||
|
delete pselector;
|
||||||
printf("CMoviePlayerGui::selectChapter: selected %d (%d)\n", select, (select >= 0) ? positions[select] : -1);
|
printf("CMoviePlayerGui::selectChapter: selected %d (%d)\n", select, (select >= 0) ? positions[select] : -1);
|
||||||
if(select >= 0)
|
printf("CMoviePlayerGui::selectChapter: pselected %d (%d)\n", pselect, (pselect >= 0) ? playlists[pselect] : -1);
|
||||||
|
if(select >= 0) {
|
||||||
playback->SetPosition(positions[select], true);
|
playback->SetPosition(positions[select], true);
|
||||||
|
} else if (pselect >= 0) {
|
||||||
|
numsubs = numpida = 0;
|
||||||
|
playback->SetTitle(playlists[pselect]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMoviePlayerGui::selectSubtitle()
|
void CMoviePlayerGui::selectSubtitle()
|
||||||
|
Reference in New Issue
Block a user