Make use of the new meta-data API and display the

audio track menu item label as the language of the
track.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38688 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2010-09-17 08:33:25 +00:00
parent d174a87e1b
commit 5bacae95fe
4 changed files with 56 additions and 3 deletions
+14 -2
View File
@@ -32,6 +32,7 @@
#include <Autolock.h>
#include <Debug.h>
#include <fs_attr.h>
#include <Language.h>
#include <Menu.h>
#include <MenuBar.h>
#include <MenuItem.h>
@@ -1548,7 +1549,18 @@ MainWin::_SetupTrackMenus(BMenu* audioTrackMenu, BMenu* videoTrackMenu)
int count = fController->AudioTrackCount();
int current = fController->CurrentAudioTrack();
for (int i = 0; i < count; i++) {
sprintf(s, "Track %d", i + 1);
BMessage metaData;
const char* languageString = NULL;
if (fController->GetAudioMetaData(i, &metaData) == B_OK)
metaData.FindString("language", &languageString);
if (languageString != NULL) {
BLanguage language(languageString);
BString languageName;
if (language.GetTranslatedName(languageName) == B_OK)
languageString = languageName.String();
snprintf(s, sizeof(s), "%s", languageString);
} else
snprintf(s, sizeof(s), "Track %d", i + 1);
BMenuItem* item = new BMenuItem(s,
new BMessage(M_SELECT_AUDIO_TRACK + i));
item->SetMarked(i == current);
@@ -1563,7 +1575,7 @@ MainWin::_SetupTrackMenus(BMenu* audioTrackMenu, BMenu* videoTrackMenu)
count = fController->VideoTrackCount();
current = fController->CurrentVideoTrack();
for (int i = 0; i < count; i++) {
sprintf(s, "Track %d", i + 1);
snprintf(s, sizeof(s), "Track %d", i + 1);
BMenuItem* item = new BMenuItem(s,
new BMessage(M_SELECT_VIDEO_TRACK + i));
item->SetMarked(i == current);