MediaPlayer: localize InfoWin.cpp (see #7270).

* based on a patch from Joachim Seemer, which I reworked a bit.
This commit is contained in:
Joachim Seemer
2012-02-18 17:07:54 +01:00
committed by Jérôme Duval
parent 4ab51d63e2
commit 2112fd9ab8
+66 -38
View File
@@ -171,7 +171,8 @@ InfoWin::InfoWin(BPoint leftTop, Controller* controller)
BRect rect = Bounds(); BRect rect = Bounds();
// accomodate for big fonts // accomodate for big fonts
float div = max_c(2 * 32, be_plain_font->StringWidth("Display Mode") + 10); float div = max_c(2 * 32, be_plain_font->StringWidth(
B_TRANSLATE("Display Mode")) + 10);
fInfoView = new InfoView(rect, "background", div); fInfoView = new InfoView(rect, "background", div);
fInfoView->SetViewColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR)); fInfoView->SetViewColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR));
@@ -307,7 +308,8 @@ printf("InfoWin::Update(0x%08lx)\n", which);
status_t err; status_t err;
// video track format information // video track format information
if ((which & INFO_VIDEO) && fController->VideoTrackCount() > 0) { if ((which & INFO_VIDEO) && fController->VideoTrackCount() > 0) {
fLabelsView->Insert("Video\n\n\n"); BString label = B_TRANSLATE("Video");
fLabelsView->Insert(label << "\n\n\n");
BString s; BString s;
media_format format; media_format format;
media_raw_video_format videoFormat; media_raw_video_format videoFormat;
@@ -319,28 +321,32 @@ printf("InfoWin::Update(0x%08lx)\n", which);
media_codec_info mci; media_codec_info mci;
err = fController->GetVideoCodecInfo(&mci); err = fController->GetVideoCodecInfo(&mci);
if (err < B_OK) { if (err < B_OK) {
s << "Haiku Media Kit: " << strerror(err); s << B_TRANSLATE("Haiku Media Kit: ") << strerror(err);
if (format.user_data_type == B_CODEC_TYPE_INFO) { if (format.user_data_type == B_CODEC_TYPE_INFO) {
s << (char *)format.user_data << " (not supported)"; s << (char *)format.user_data << " "
<< B_TRANSLATE("(not supported)");
} }
} else } else
s << mci.pretty_name; //<< "(" << mci.short_name << ")"; s << mci.pretty_name; //<< "(" << mci.short_name << ")";
} else if (format.type == B_MEDIA_RAW_VIDEO) { } else if (format.type == B_MEDIA_RAW_VIDEO) {
videoFormat = format.u.raw_video; videoFormat = format.u.raw_video;
s << "raw video"; s << B_TRANSLATE("raw video");
} else } else
s << "unknown format"; s << B_TRANSLATE("unknown format");
s << "\n"; s << "\n";
s << format.Width() << " x " << format.Height(); s << format.Width() << " x " << format.Height();
// encoded has output as 1st field... // encoded has output as 1st field...
s << ", " << videoFormat.field_rate << " fps"; char fpsString[20];
s << "\n\n"; snprintf(fpsString, sizeof(fpsString), B_TRANSLATE("%f fps"),
videoFormat.field_rate);
s << ", " << fpsString << "\n\n";
fContentsView->Insert(s.String()); fContentsView->Insert(s.String());
} }
// audio track format information // audio track format information
if ((which & INFO_AUDIO) && fController->AudioTrackCount() > 0) { if ((which & INFO_AUDIO) && fController->AudioTrackCount() > 0) {
fLabelsView->Insert("Audio\n\n\n"); BString label = B_TRANSLATE("Audio");
fLabelsView->Insert(label << "\n\n\n");
BString s; BString s;
media_format format; media_format format;
media_raw_audio_format audioFormat; media_raw_audio_format audioFormat;
@@ -354,44 +360,59 @@ printf("InfoWin::Update(0x%08lx)\n", which);
media_codec_info mci; media_codec_info mci;
err = fController->GetAudioCodecInfo(&mci); err = fController->GetAudioCodecInfo(&mci);
if (err < 0) { if (err < 0) {
s << "Haiku Media Kit: " << strerror(err); s << B_TRANSLATE("Haiku Media Kit: ") << strerror(err);
if (format.user_data_type == B_CODEC_TYPE_INFO) { if (format.user_data_type == B_CODEC_TYPE_INFO) {
s << (char *)format.user_data << " (not supported)"; s << (char *)format.user_data << " "
<< B_TRANSLATE("(not supported)");
} }
} else } else
s << mci.pretty_name; //<< "(" << mci.short_name << ")"; s << mci.pretty_name; //<< "(" << mci.short_name << ")";
} else if (format.type == B_MEDIA_RAW_AUDIO) { } else if (format.type == B_MEDIA_RAW_AUDIO) {
audioFormat = format.u.raw_audio; audioFormat = format.u.raw_audio;
s << "raw audio"; s << B_TRANSLATE("raw audio");
} else } else
s << "unknown format"; s << B_TRANSLATE("unknown format");
s << "\n"; s << "\n";
uint32 bitsPerSample = 8 * (audioFormat.format uint32 bitsPerSample = 8 * (audioFormat.format
& media_raw_audio_format::B_AUDIO_SIZE_MASK); & media_raw_audio_format::B_AUDIO_SIZE_MASK);
uint32 channelCount = audioFormat.channel_count; uint32 channelCount = audioFormat.channel_count;
float sr = audioFormat.frame_rate; float sr = audioFormat.frame_rate;
if (bitsPerSample > 0) if (bitsPerSample > 0) {
s << bitsPerSample << " Bit "; char bitString[20];
snprintf(bitString, sizeof(bitString), B_TRANSLATE("%d Bit"),
bitsPerSample);
s << bitString << " ";
}
if (channelCount == 1) if (channelCount == 1)
s << "Mono"; s << B_TRANSLATE("Mono");
else if (channelCount == 2) else if (channelCount == 2)
s << "Stereo"; s << B_TRANSLATE("Stereo");
else else {
s << channelCount << " Channels"; char channelString[20];
snprintf(channelString, sizeof(channelString),
B_TRANSLATE("%d Channels"), channelCount);
s << channelString;
}
s << ", "; s << ", ";
if (sr > 0.0) if (sr > 0.0) {
s << sr / 1000; char rateString[20];
else snprintf(rateString, sizeof(rateString),
s << "??"; B_TRANSLATE("%d kHz"), sr / 1000);
s<< " kHz"; s << rateString;
} else {
BString rateString = B_TRANSLATE("%d kHz");
rateString.ReplaceFirst("%d", "??");
s << rateString;
}
s << "\n\n"; s << "\n\n";
fContentsView->Insert(s.String()); fContentsView->Insert(s.String());
} }
// statistics // statistics
if ((which & INFO_STATS) && fController->HasFile()) { if ((which & INFO_STATS) && fController->HasFile()) {
fLabelsView->Insert("Duration\n"); BString label = B_TRANSLATE("Duration");
fLabelsView->Insert(label << "\n");
BString s; BString s;
bigtime_t d = fController->TimeDuration(); bigtime_t d = fController->TimeDuration();
bigtime_t v; bigtime_t v;
@@ -411,18 +432,22 @@ printf("InfoWin::Update(0x%08lx)\n", which);
v = d / 1000; v = d / 1000;
s << v; s << v;
if (hours) if (hours)
s << " h"; s << " " << B_TRANSLATE_COMMENT("h", "Hours");
else else
s << " min"; s << " " << B_TRANSLATE_COMMENT("min", "Minutes");
s << "\n"; s << "\n";
fContentsView->Insert(s.String()); fContentsView->Insert(s.String());
// TODO: demux/video/audio/... perfs (Kb/s) // TODO: demux/video/audio/... perfs (Kb/s)
fLabelsView->Insert("Display mode\n"); BString content = B_TRANSLATE("Display mode");
if (fController->IsOverlayActive()) fLabelsView->Insert(content << "\n");
fContentsView->Insert("Overlay\n"); if (fController->IsOverlayActive()) {
else content = B_TRANSLATE("Overlay");
fContentsView->Insert("DrawBitmap\n"); fContentsView->Insert(content << "\n");
} else {
content = B_TRANSLATE("DrawBitmap");
fContentsView->Insert(content << "\n");
}
fLabelsView->Insert("\n"); fLabelsView->Insert("\n");
fContentsView->Insert("\n"); fContentsView->Insert("\n");
@@ -440,7 +465,8 @@ printf("InfoWin::Update(0x%08lx)\n", which);
media_file_format fileFormat; media_file_format fileFormat;
BString s; BString s;
if (fController->GetFileFormatInfo(&fileFormat) == B_OK) { if (fController->GetFileFormatInfo(&fileFormat) == B_OK) {
fLabelsView->Insert("Container\n"); BString label = B_TRANSLATE("Container");
fLabelsView->Insert(label << "\n");
s << fileFormat.pretty_name; s << fileFormat.pretty_name;
s << "\n"; s << "\n";
fContentsView->Insert(s.String()); fContentsView->Insert(s.String());
@@ -448,16 +474,17 @@ printf("InfoWin::Update(0x%08lx)\n", which);
iconSet = fInfoView->SetIcon(fileFormat.mime_type) == B_OK; iconSet = fInfoView->SetIcon(fileFormat.mime_type) == B_OK;
} else } else
fContentsView->Insert("\n"); fContentsView->Insert("\n");
fLabelsView->Insert("Location\n"); BString label = B_TRANSLATE("Location");
fLabelsView->Insert(label << "\n");
if (fController->GetLocation(&s) < B_OK) if (fController->GetLocation(&s) < B_OK)
s = "<unknown>"; s = B_TRANSLATE("<unknown>");
s << "\n"; s << "\n";
fContentsView->Insert(s.String()); fContentsView->Insert(s.String());
if (fController->GetName(&s) < B_OK) if (fController->GetName(&s) < B_OK)
s = "<unnamed media>"; s = B_TRANSLATE("<unnamed media>");
fFilenameView->SetText(s.String()); fFilenameView->SetText(s.String());
} else { } else {
fFilenameView->SetText("<no media>"); fFilenameView->SetText(B_TRANSLATE("<no media>"));
} }
if (!iconSet) if (!iconSet)
fInfoView->SetGenericIcon(); fInfoView->SetGenericIcon();
@@ -466,7 +493,8 @@ printf("InfoWin::Update(0x%08lx)\n", which);
if ((which & INFO_COPYRIGHT) && fController->HasFile()) { if ((which & INFO_COPYRIGHT) && fController->HasFile()) {
BString s; BString s;
if (fController->GetCopyright(&s) == B_OK && s.Length() > 0) { if (fController->GetCopyright(&s) == B_OK && s.Length() > 0) {
fLabelsView->Insert("Copyright\n\n"); BString label = B_TRANSLATE("Copyright");
fLabelsView->Insert(label << "\n\n");
s << "\n\n"; s << "\n\n";
fContentsView->Insert(s.String()); fContentsView->Insert(s.String());
} }