Ticket #7270: mediaplayer-infowindow.diff
File mediaplayer-infowindow.diff, 6.9 KB (added by , 13 years ago) |
---|
-
src/apps/mediaplayer/InfoWin.cpp
26 26 #include <string.h> 27 27 28 28 #include <Bitmap.h> 29 #include <Catalog.h> 29 30 #include <Debug.h> 30 31 #include <MediaDefs.h> 31 32 #include <Mime.h> … … 39 40 #include "PlaylistItem.h" 40 41 41 42 42 #define NAME "File Info" 43 #undef B_TRANSLATE_CONTEXT 44 #define B_TRANSLATE_CONTEXT "MediaPlayer-File Info" 45 43 46 #define MIN_WIDTH 400 44 47 45 48 #define BASE_HEIGHT (32 + 32) … … 159 162 InfoWin::InfoWin(BPoint leftTop, Controller* controller) 160 163 : 161 164 BWindow(BRect(leftTop.x, leftTop.y, leftTop.x + MIN_WIDTH - 1, 162 leftTop.y + 300), NAME, B_TITLED_WINDOW,165 leftTop.y + 300), B_TRANSLATE("File info"), B_TITLED_WINDOW, 163 166 B_ASYNCHRONOUS_CONTROLS | B_NOT_RESIZABLE | B_NOT_ZOOMABLE), 164 167 fController(controller), 165 168 fControllerObserver(new ControllerObserver(this, … … 168 171 BRect rect = Bounds(); 169 172 170 173 // accomodate for big fonts 171 float div = max_c(2 * 32, be_plain_font->StringWidth( "Display Mode") + 10);174 float div = max_c(2 * 32, be_plain_font->StringWidth(B_TRANSLATE("Display mode")) + 10); 172 175 173 176 fInfoView = new InfoView(rect, "background", div); 174 177 fInfoView->SetViewColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR)); … … 304 307 status_t err; 305 308 // video track format information 306 309 if ((which & INFO_VIDEO) && fController->VideoTrackCount() > 0) { 307 fLabelsView->Insert( "Video\n\n\n");310 fLabelsView->Insert(B_TRANSLATE("Video\n\n\n")); 308 311 BString s; 309 312 media_format format; 310 313 media_raw_video_format videoFormat; … … 316 319 media_codec_info mci; 317 320 err = fController->GetVideoCodecInfo(&mci); 318 321 if (err < B_OK) { 319 s << "Haiku Media Kit: "<< strerror(err);322 s << B_TRANSLATE("Haiku Media Kit:") << strerror(err); 320 323 if (format.user_data_type == B_CODEC_TYPE_INFO) { 321 s << (char *)format.user_data << " (not supported)"; 324 s << (char *)format.user_data << " " << 325 B_TRANSLATE("(not supported)"); 322 326 } 323 327 } else 324 328 s << mci.pretty_name; //<< "(" << mci.short_name << ")"; 325 329 } else if (format.type == B_MEDIA_RAW_VIDEO) { 326 330 videoFormat = format.u.raw_video; 327 s << "raw video";331 s << B_TRANSLATE("raw video"); 328 332 } else 329 s << "unknown format";333 s << B_TRANSLATE("unknown format"); 330 334 s << "\n"; 331 335 s << format.Width() << " x " << format.Height(); 332 336 // encoded has output as 1st field... 333 s << ", " << videoFormat.field_rate << " fps";337 s << ", " << videoFormat.field_rate << " " << B_TRANSLATE("fps"); 334 338 s << "\n\n"; 335 339 fContentsView->Insert(s.String()); 336 340 } 337 341 338 342 // audio track format information 339 343 if ((which & INFO_AUDIO) && fController->AudioTrackCount() > 0) { 340 fLabelsView->Insert( "Audio\n\n\n");344 fLabelsView->Insert(B_TRANSLATE("Audio\n\n\n")); 341 345 BString s; 342 346 media_format format; 343 347 media_raw_audio_format audioFormat; … … 351 355 media_codec_info mci; 352 356 err = fController->GetAudioCodecInfo(&mci); 353 357 if (err < 0) { 354 s << "Haiku Media Kit:" << strerror(err);358 s << B_TRANSLATE("Haiku Media Kit:") << " " << strerror(err); 355 359 if (format.user_data_type == B_CODEC_TYPE_INFO) { 356 s << (char *)format.user_data << " (not supported)"; 360 s << (char *)format.user_data << " " << 361 B_TRANSLATE("(not supported)"); 357 362 } 358 363 } else 359 364 s << mci.pretty_name; //<< "(" << mci.short_name << ")"; 360 365 } else if (format.type == B_MEDIA_RAW_AUDIO) { 361 366 audioFormat = format.u.raw_audio; 362 s << "raw audio";367 s << B_TRANSLATE("raw audio"); 363 368 } else 364 s << "unknown format";369 s << B_TRANSLATE("unknown format"); 365 370 s << "\n"; 366 371 uint32 bitsPerSample = 8 * (audioFormat.format 367 372 & media_raw_audio_format::B_AUDIO_SIZE_MASK); … … 369 374 float sr = audioFormat.frame_rate; 370 375 371 376 if (bitsPerSample > 0) 372 s << bitsPerSample << " Bit";377 s << bitsPerSample << " " << B_TRANSLATE("Bit") << " "; 373 378 if (channelCount == 1) 374 s << "Mono";379 s << B_TRANSLATE("Mono"); 375 380 else if (channelCount == 2) 376 s << "Stereo";381 s << B_TRANSLATE("Stereo"); 377 382 else 378 s << channelCount << " Channels";383 s << channelCount << " " << B_TRANSLATE("Channels"); 379 384 s << ", "; 380 385 if (sr > 0.0) 381 386 s << sr / 1000; 382 387 else 383 388 s << "??"; 384 s << " kHz";389 s << " " << B_TRANSLATE("kHz"); 385 390 s << "\n\n"; 386 391 fContentsView->Insert(s.String()); 387 392 } 388 393 389 394 // statistics 390 395 if ((which & INFO_STATS) && fController->HasFile()) { 391 fLabelsView->Insert( "Duration\n");396 fLabelsView->Insert(B_TRANSLATE("Duration\n")); 392 397 BString s; 393 398 bigtime_t d = fController->TimeDuration(); 394 399 bigtime_t v; … … 408 413 v = d / 1000; 409 414 s << v; 410 415 if (hours) 411 s << " h";416 s << " " << B_TRANSLATE_COMMENT("h", "Hours"); 412 417 else 413 s << " min";418 s << " " << B_TRANSLATE_COMMENT("min", "Minutes"); 414 419 s << "\n"; 415 420 fContentsView->Insert(s.String()); 416 421 // TODO: demux/video/audio/... perfs (Kb/s) 417 422 418 fLabelsView->Insert( "Display mode\n");423 fLabelsView->Insert(B_TRANSLATE("Display mode\n")); 419 424 if (fController->IsOverlayActive()) 420 fContentsView->Insert( "Overlay\n");425 fContentsView->Insert(B_TRANSLATE("Overlay\n")); 421 426 else 422 fContentsView->Insert( "DrawBitmap\n");427 fContentsView->Insert(B_TRANSLATE("DrawBitmap\n")); 423 428 424 429 fLabelsView->Insert("\n"); 425 430 fContentsView->Insert("\n"); … … 437 442 media_file_format fileFormat; 438 443 BString s; 439 444 if (fController->GetFileFormatInfo(&fileFormat) == B_OK) { 440 fLabelsView->Insert( "Container\n");445 fLabelsView->Insert(B_TRANSLATE("Container\n")); 441 446 s << fileFormat.pretty_name; 442 447 s << "\n"; 443 448 fContentsView->Insert(s.String()); … … 445 450 iconSet = fInfoView->SetIcon(fileFormat.mime_type) == B_OK; 446 451 } else 447 452 fContentsView->Insert("\n"); 448 fLabelsView->Insert( "Location\n");453 fLabelsView->Insert(B_TRANSLATE("Location\n")); 449 454 if (fController->GetLocation(&s) < B_OK) 450 s = "<unknown>";455 s = B_TRANSLATE("<unknown>"); 451 456 s << "\n"; 452 457 fContentsView->Insert(s.String()); 453 458 if (fController->GetName(&s) < B_OK) 454 s = "<unnamed media>";459 s = B_TRANSLATE("<unnamed media>"); 455 460 fFilenameView->SetText(s.String()); 456 461 } else { 457 fFilenameView->SetText( "<no media>");462 fFilenameView->SetText(B_TRANSLATE("<no media>")); 458 463 } 459 464 if (!iconSet) 460 465 fInfoView->SetGenericIcon(); … … 463 468 if ((which & INFO_COPYRIGHT) && fController->HasFile()) { 464 469 BString s; 465 470 if (fController->GetCopyright(&s) == B_OK && s.Length() > 0) { 466 fLabelsView->Insert( "Copyright\n\n");471 fLabelsView->Insert(B_TRANSLATE("Copyright\n\n")); 467 472 s << "\n\n"; 468 473 fContentsView->Insert(s.String()); 469 474 } -
src/apps/mediaplayer/Jamfile
124 124 PeakView.cpp 125 125 CopyPLItemsCommand.cpp 126 126 ImportPLItemsCommand.cpp 127 InfoWin.cpp 127 128 MovePLItemsCommand.cpp 128 129 PlaylistItem.cpp 129 130 PlaylistWindow.cpp