Patch by Dziadek as part of GCI : localize MediaPlayer.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40021 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-12-29 10:38:58 +00:00
parent c3dab48ba4
commit 238df8fb85
12 changed files with 293 additions and 171 deletions

View File

@ -113,8 +113,23 @@ Application MediaPlayer :
MainWin.cpp
VideoView.cpp
: be game locale media tracker translation textencoding $(TARGET_LIBSTDC++)
libshared.a
: be game locale media tracker translation textencoding $(TARGET_LIBSTDC++)
$(HAIKU_LOCALE_LIBS) libshared.a
: MediaPlayer.rdef
;
DoCatalogs MediaPlayer :
x-vnd.Haiku-MediaPlayer
:
PeakView.cpp
CopyPLItemsCommand.cpp
ImportPLItemsCommand.cpp
MovePLItemsCommand.cpp
PlaylistItem.cpp
PlaylistWindow.cpp
RandomizePLItemsCommand.cpp
RemovePLItemsCommand.cpp
SettingsWindow.cpp
MainApp.cpp
MainWin.cpp
;

View File

@ -24,8 +24,10 @@
#include <Alert.h>
#include <Autolock.h>
#include <Catalog.h>
#include <Entry.h>
#include <FilePanel.h>
#include <Locale.h>
#include <MediaDefs.h>
#include <MediaRoster.h>
#include <MimeType.h>
@ -43,8 +45,12 @@
#include "SettingsWindow.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-Main"
static const char* kCurrentPlaylistFilename = "MediaPlayer Current Playlist";
static const char* kCurrentPlaylistFilename =
B_TRANSLATE("MediaPlayer Current Playlist");
const char* kAppSig = "application/x-vnd.Haiku-MediaPlayer";
@ -85,8 +91,9 @@ MainApp::MainApp()
if (!fMediaServerRunning || !fMediaAddOnServerRunning) {
BAlert* alert = new BAlert("start_media_server",
"It appears the media server is not running.\n"
"Would you like to start it ?", "Quit", "Start media server", NULL,
B_TRANSLATE("It appears the media server is not running.\n"
"Would you like to start it ?"), B_TRANSLATE("Quit"),
B_TRANSLATE("Start media server"), NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
if (alert->Go() == 0) {
PostMessage(B_QUIT_REQUESTED);
@ -404,8 +411,10 @@ MainApp::MessageReceived(BMessage* message)
void
MainApp::AboutRequested()
{
BAlert* alert = new BAlert("about", NAME"\n\nWritten by Marcus Overhagen, "
"Stephan Aßmus and Frederik Modéen", "Thanks");
BAlert* alert = new BAlert("about", B_TRANSLATE(
NAME"\n\nWritten by Marcus Overhagen, "
"Stephan Aßmus and Frederik Modéen"),
B_TRANSLATE("Thanks"));
alert->SetFeel(B_FLOATING_ALL_WINDOW_FEEL);
// Make sure it is on top of any player windows that may have the
// floating all window feel.
@ -462,7 +471,7 @@ MainApp::_ShowOpenFilePanel(const BMessage* message)
}
_ShowFilePanel(fOpenFilePanel, M_OPEN_PANEL_RESULT, message,
"Open", "Open");
B_TRANSLATE("Open"), B_TRANSLATE("Open"));
}
@ -475,7 +484,7 @@ MainApp::_ShowSaveFilePanel(const BMessage* message)
}
_ShowFilePanel(fSaveFilePanel, M_SAVE_PANEL_RESULT, message,
"Save", "Save");
B_TRANSLATE("Save"), B_TRANSLATE("Save"));
}

View File

@ -30,9 +30,11 @@
#include <Alert.h>
#include <Application.h>
#include <Autolock.h>
#include <Catalog.h>
#include <Debug.h>
#include <fs_attr.h>
#include <Language.h>
#include <Locale.h>
#include <Menu.h>
#include <MenuBar.h>
#include <MenuItem.h>
@ -59,6 +61,8 @@
#include "Settings.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-Main"
#define MIN_WIDTH 250
@ -116,34 +120,43 @@ enum {
static property_info sPropertyInfo[] = {
{ "Next", { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 }, "Skip to the next track.", 0
{ B_TRANSLATE("Next"), { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 },
B_TRANSLATE("Skip to the next track."), 0
},
{ "Prev", { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 }, "Skip to the previous track.", 0
{ B_TRANSLATE("Prev"), { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 },
B_TRANSLATE("Skip to the previous track."), 0
},
{ "Play", { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 }, "Start playing.", 0
{ B_TRANSLATE("Play"), { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 },
B_TRANSLATE("Start playing."), 0
},
{ "Stop", { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 }, "Stop playing.", 0
{ B_TRANSLATE("Stop"), { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 },
B_TRANSLATE("Stop playing."), 0
},
{ "Pause", { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 }, "Pause playback.", 0
{ B_TRANSLATE("Pause"), { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 },
B_TRANSLATE("Pause playback."), 0
},
{ "TogglePlaying", { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 }, "Toggle pause/play.", 0
{ B_TRANSLATE("TogglePlaying"), { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 },
B_TRANSLATE("Toggle pause/play."), 0
},
{ "Mute", { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 }, "Toggle mute.", 0
{ B_TRANSLATE("Mute"), { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 },
B_TRANSLATE("Toggle mute."), 0
},
{ "Volume", { B_GET_PROPERTY, B_SET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 0 }, "Gets/sets the volume (0.0-2.0).", 0,
{ B_TRANSLATE("Volume"), { B_GET_PROPERTY, B_SET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 0 },
B_TRANSLATE("Gets/sets the volume (0.0-2.0)."), 0,
{ B_FLOAT_TYPE }
},
{ "URI", { B_GET_PROPERTY, 0 },
{ B_TRANSLATE("URI"), { B_GET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 0 },
"Gets the URI of the currently playing item.", 0, { B_STRING_TYPE }
B_TRANSLATE("Gets the URI of the currently playing item."), 0,
{ B_STRING_TYPE }
},
{ 0, { 0 }, { 0 }, 0, 0 }
};
@ -151,7 +164,7 @@ static property_info sPropertyInfo[] = {
static const char* kRatingAttrName = "Media:Rating";
static const char* kDisabledSeekMessage = "Drop files to play";
static const char* kDisabledSeekMessage = B_TRANSLATE("Drop files to play");
//#define printf(a...)
@ -609,8 +622,9 @@ MainWin::MessageReceived(BMessage* msg)
}
case MSG_PLAYLIST_IMPORT_FAILED:
{
BAlert* alert = new BAlert("Nothing to Play", "None of the files "
"you wanted to play appear to be media files.", "OK");
BAlert* alert = new BAlert(B_TRANSLATE("Nothing to Play"),
B_TRANSLATE("None of the files you wanted to play appear "
"to be media files."), B_TRANSLATE("OK"));
alert->Go();
fControls->SetDisabledString(kDisabledSeekMessage);
break;
@ -741,8 +755,8 @@ MainWin::MessageReceived(BMessage* msg)
BMessage appMessage(M_SHOW_OPEN_PANEL);
appMessage.AddMessenger("target", target);
appMessage.AddMessage("message", &result);
appMessage.AddString("title", "Open Clips");
appMessage.AddString("label", "Open");
appMessage.AddString("title", B_TRANSLATE("Open Clips"));
appMessage.AddString("label", B_TRANSLATE("Open"));
be_app->PostMessage(&appMessage);
break;
}
@ -1068,8 +1082,9 @@ MainWin::OpenPlaylistItem(const PlaylistItemRef& item)
if (ret != B_OK) {
fprintf(stderr, "MainWin::OpenPlaylistItem() - Failed to send message "
"to Controller.\n");
(new BAlert("error", NAME" encountered an internal error. "
"The file could not be opened.", "OK"))->Go();
(new BAlert(B_TRANSLATE("error"),
B_TRANSLATE(NAME" encountered an internal error. "
"The file could not be opened."), B_TRANSLATE("OK")))->Go();
_PlaylistItemOpened(item, ret);
} else {
BString string;
@ -1307,21 +1322,21 @@ MainWin::_PlaylistItemOpened(const PlaylistItemRef& item, status_t result)
if (allItemsFailed) {
// Display error if all files failed to play.
BString message;
message << "The file '";
message << item->Name();
message << "' could not be opened.\n\n";
BString message(B_TRANSLATE(
"The file'%filename' could not be opened.\n\n"));;
message.ReplaceAll("%filename", item->Name());
if (result == B_MEDIA_NO_HANDLER) {
// give a more detailed message for the most likely of all
// errors
message << "There is no decoder installed to handle the "
message << B_TRANSLATE(
"There is no decoder installed to handle the "
"file format, or the decoder has trouble with the "
"specific version of the format.";
"specific version of the format.");
} else {
message << "Error: " << strerror(result);
message << B_TRANSLATE("Error: ") << strerror(result);
}
(new BAlert("error", message.String(), "OK"))->Go();
(new BAlert("error", message.String(), B_TRANSLATE("OK")))->Go();
fControls->SetDisabledString(kDisabledSeekMessage);
} else {
// Just go to the next file and don't bother user (yet)
@ -1404,21 +1419,23 @@ void
MainWin::_CreateMenu()
{
fFileMenu = new BMenu(NAME);
fPlaylistMenu = new BMenu("Playlist"B_UTF8_ELLIPSIS);
fAudioMenu = new BMenu("Audio");
fVideoMenu = new BMenu("Video");
fVideoAspectMenu = new BMenu("Aspect ratio");
fAudioTrackMenu = new BMenu("Track");
fVideoTrackMenu = new BMenu("Track");
fSubTitleTrackMenu = new BMenu("Subtitles");
fAttributesMenu = new BMenu("Attributes");
fPlaylistMenu = new BMenu(B_TRANSLATE("Playlist"B_UTF8_ELLIPSIS));
fAudioMenu = new BMenu(B_TRANSLATE("Audio"));
fVideoMenu = new BMenu(B_TRANSLATE("Video"));
fVideoAspectMenu = new BMenu(B_TRANSLATE("Aspect ratio"));
fAudioTrackMenu = new BMenu(B_TRANSLATE_WITH_CONTEXT("Track",
"Audio Track Menu"));
fVideoTrackMenu = new BMenu(B_TRANSLATE_WITH_CONTEXT("Track",
"Video Track Menu"));
fSubTitleTrackMenu = new BMenu(B_TRANSLATE("Subtitles"));
fAttributesMenu = new BMenu(B_TRANSLATE("Attributes"));
fMenuBar->AddItem(fFileMenu);
fMenuBar->AddItem(fAudioMenu);
fMenuBar->AddItem(fVideoMenu);
fMenuBar->AddItem(fAttributesMenu);
BMenuItem* item = new BMenuItem("New player"B_UTF8_ELLIPSIS,
BMenuItem* item = new BMenuItem(B_TRANSLATE("New player"B_UTF8_ELLIPSIS),
new BMessage(M_NEW_PLAYER), 'N');
fFileMenu->AddItem(item);
item->SetTarget(be_app);
@ -1426,14 +1443,14 @@ MainWin::_CreateMenu()
// Add recent files to "Open File" entry as sub-menu.
BRecentFilesList recentFiles(10, false, NULL, kAppSig);
item = new BMenuItem(recentFiles.NewFileListMenu(
"Open file"B_UTF8_ELLIPSIS, NULL, NULL, this, 10, true, NULL, kAppSig),
new BMessage(M_FILE_OPEN));
B_TRANSLATE("Open file"B_UTF8_ELLIPSIS), NULL, NULL, this, 10, true,
NULL, kAppSig), new BMessage(M_FILE_OPEN));
item->SetShortcut('O', 0);
fFileMenu->AddItem(item);
fFileMenu->AddSeparatorItem();
fFileMenu->AddItem(new BMenuItem("File info"B_UTF8_ELLIPSIS,
fFileMenu->AddItem(new BMenuItem(B_TRANSLATE("File info"B_UTF8_ELLIPSIS),
new BMessage(M_FILE_INFO), 'I'));
fFileMenu->AddItem(fPlaylistMenu);
fPlaylistMenu->Superitem()->SetShortcut('P', B_COMMAND_KEY);
@ -1441,28 +1458,30 @@ MainWin::_CreateMenu()
fFileMenu->AddSeparatorItem();
fNoInterfaceMenuItem = new BMenuItem("Hide interface",
fNoInterfaceMenuItem = new BMenuItem(B_TRANSLATE("Hide interface"),
new BMessage(M_TOGGLE_NO_INTERFACE), 'H');
fFileMenu->AddItem(fNoInterfaceMenuItem);
fFileMenu->AddItem(new BMenuItem("Always on top",
fFileMenu->AddItem(new BMenuItem(B_TRANSLATE("Always on top"),
new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'A'));
item = new BMenuItem("Settings"B_UTF8_ELLIPSIS,
item = new BMenuItem(B_TRANSLATE("Settings"B_UTF8_ELLIPSIS),
new BMessage(M_SETTINGS), 'S');
fFileMenu->AddItem(item);
item->SetTarget(be_app);
fFileMenu->AddSeparatorItem();
item = new BMenuItem("About " NAME B_UTF8_ELLIPSIS,
item = new BMenuItem(B_TRANSLATE("About " NAME B_UTF8_ELLIPSIS),
new BMessage(B_ABOUT_REQUESTED));
fFileMenu->AddItem(item);
item->SetTarget(be_app);
fFileMenu->AddSeparatorItem();
fFileMenu->AddItem(new BMenuItem("Close", new BMessage(M_FILE_CLOSE), 'W'));
fFileMenu->AddItem(new BMenuItem("Quit", new BMessage(M_FILE_QUIT), 'Q'));
fFileMenu->AddItem(new BMenuItem(B_TRANSLATE("Close"),
new BMessage(M_FILE_CLOSE), 'W'));
fFileMenu->AddItem(new BMenuItem(B_TRANSLATE("Quit"),
new BMessage(M_FILE_QUIT), 'Q'));
fPlaylistMenu->SetRadioMode(true);
@ -1473,27 +1492,32 @@ MainWin::_CreateMenu()
fVideoMenu->AddSeparatorItem();
BMessage* resizeMessage = new BMessage(M_VIEW_SIZE);
resizeMessage->AddInt32("size", 50);
fVideoMenu->AddItem(new BMenuItem("50% scale", resizeMessage, '0'));
fVideoMenu->AddItem(new BMenuItem(
B_TRANSLATE("50% scale"), resizeMessage, '0'));
resizeMessage = new BMessage(M_VIEW_SIZE);
resizeMessage->AddInt32("size", 100);
fVideoMenu->AddItem(new BMenuItem("100% scale", resizeMessage, '1'));
fVideoMenu->AddItem(new BMenuItem(
B_TRANSLATE("100% scale"), resizeMessage, '1'));
resizeMessage = new BMessage(M_VIEW_SIZE);
resizeMessage->AddInt32("size", 200);
fVideoMenu->AddItem(new BMenuItem("200% scale", resizeMessage, '2'));
fVideoMenu->AddItem(new BMenuItem(
B_TRANSLATE("200% scale"), resizeMessage, '2'));
resizeMessage = new BMessage(M_VIEW_SIZE);
resizeMessage->AddInt32("size", 300);
fVideoMenu->AddItem(new BMenuItem("300% scale", resizeMessage, '3'));
fVideoMenu->AddItem(new BMenuItem(
B_TRANSLATE("300% scale"), resizeMessage, '3'));
resizeMessage = new BMessage(M_VIEW_SIZE);
resizeMessage->AddInt32("size", 400);
fVideoMenu->AddItem(new BMenuItem("400% scale", resizeMessage, '4'));
fVideoMenu->AddItem(new BMenuItem(
B_TRANSLATE("400% scale"), resizeMessage, '4'));
fVideoMenu->AddSeparatorItem();
fVideoMenu->AddItem(new BMenuItem("Full screen",
fVideoMenu->AddItem(new BMenuItem(B_TRANSLATE("Full screen"),
new BMessage(M_TOGGLE_FULLSCREEN), 'F'));
fVideoMenu->AddSeparatorItem();
@ -1501,7 +1525,7 @@ MainWin::_CreateMenu()
_SetupVideoAspectItems(fVideoAspectMenu);
fVideoMenu->AddItem(fVideoAspectMenu);
fRatingMenu = new BMenu("Rating");
fRatingMenu = new BMenu(B_TRANSLATE("Rating"));
fAttributesMenu->AddItem(fRatingMenu);
for (int32 i = 1; i <= 10; i++) {
char label[16];
@ -1532,12 +1556,12 @@ MainWin::_SetupVideoAspectItems(BMenu* menu)
// "Stream Settings" and "16 : 9" if the stream settings happen to
// be "16 : 9".
menu->AddItem(item = new BMenuItem("Stream settings",
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Stream settings"),
new BMessage(M_ASPECT_SAME_AS_SOURCE)));
item->SetMarked(widthAspect == fWidthAspect
&& heightAspect == fHeightAspect);
menu->AddItem(item = new BMenuItem("No aspect correction",
menu->AddItem(item = new BMenuItem(B_TRANSLATE("No aspect correction"),
new BMessage(M_ASPECT_NO_DISTORTION)));
item->SetMarked(width == fWidthAspect && height == fHeightAspect);
@ -1558,10 +1582,10 @@ MainWin::_SetupVideoAspectItems(BMenu* menu)
menu->AddItem(item = new BMenuItem("1.75 : 1",
new BMessage(M_ASPECT_7_4)));
item->SetMarked(fWidthAspect == 7 && fHeightAspect == 4);
menu->AddItem(item = new BMenuItem("1.85 : 1 (American)",
menu->AddItem(item = new BMenuItem(B_TRANSLATE("1.85 : 1 (American)"),
new BMessage(M_ASPECT_37_20)));
item->SetMarked(fWidthAspect == 37 && fHeightAspect == 20);
menu->AddItem(item = new BMenuItem("2.35 : 1 (Cinemascope)",
menu->AddItem(item = new BMenuItem(B_TRANSLATE("2.35 : 1 (Cinemascope)"),
new BMessage(M_ASPECT_47_20)));
item->SetMarked(fWidthAspect == 47 && fHeightAspect == 20);
}
@ -1591,14 +1615,15 @@ MainWin::_SetupTrackMenus(BMenu* audioTrackMenu, BMenu* videoTrackMenu,
languageString = languageName.String();
snprintf(s, sizeof(s), "%s", languageString);
} else
snprintf(s, sizeof(s), "Track %d", i + 1);
snprintf(s, sizeof(s), B_TRANSLATE("Track %d"), i + 1);
BMenuItem* item = new BMenuItem(s,
new BMessage(M_SELECT_AUDIO_TRACK + i));
item->SetMarked(i == current);
audioTrackMenu->AddItem(item);
}
if (count == 0) {
audioTrackMenu->AddItem(new BMenuItem("none", new BMessage(M_DUMMY)));
audioTrackMenu->AddItem(new BMenuItem(B_TRANSLATE_WITH_CONTEXT("none",
"Audio track menu"), new BMessage(M_DUMMY)));
audioTrackMenu->ItemAt(0)->SetMarked(true);
}
@ -1606,7 +1631,7 @@ MainWin::_SetupTrackMenus(BMenu* audioTrackMenu, BMenu* videoTrackMenu,
count = fController->VideoTrackCount();
current = fController->CurrentVideoTrack();
for (int i = 0; i < count; i++) {
snprintf(s, sizeof(s), "Track %d", i + 1);
snprintf(s, sizeof(s), B_TRANSLATE("Track %d"), i + 1);
BMenuItem* item = new BMenuItem(s,
new BMessage(M_SELECT_VIDEO_TRACK + i));
item->SetMarked(i == current);
@ -1620,7 +1645,8 @@ MainWin::_SetupTrackMenus(BMenu* audioTrackMenu, BMenu* videoTrackMenu,
count = fController->SubTitleTrackCount();
if (count > 0) {
current = fController->CurrentSubTitleTrack();
BMenuItem* item = new BMenuItem("Off",
BMenuItem* item = new BMenuItem(
B_TRANSLATE_WITH_CONTEXT("Off", "Subtitles menu"),
new BMessage(M_SELECT_SUB_TITLE_TRACK - 1));
subTitleTrackMenu->AddItem(item);
item->SetMarked(current == -1);
@ -1632,14 +1658,15 @@ MainWin::_SetupTrackMenus(BMenu* audioTrackMenu, BMenu* videoTrackMenu,
if (name != NULL)
snprintf(s, sizeof(s), "%s", name);
else
snprintf(s, sizeof(s), "Track %d", i + 1);
snprintf(s, sizeof(s), B_TRANSLATE("Track %d"), i + 1);
item = new BMenuItem(s,
new BMessage(M_SELECT_SUB_TITLE_TRACK + i));
item->SetMarked(i == current);
subTitleTrackMenu->AddItem(item);
}
} else {
subTitleTrackMenu->AddItem(new BMenuItem("none",
subTitleTrackMenu->AddItem(new BMenuItem(
B_TRANSLATE_WITH_CONTEXT("none", "Subtitles menu"),
new BMessage(M_DUMMY)));
subTitleTrackMenu->ItemAt(0)->SetMarked(true);
}
@ -1978,18 +2005,18 @@ MainWin::_ShowContextMenu(const BPoint& screenPoint)
printf("Show context menu\n");
BPopUpMenu* menu = new BPopUpMenu("context menu", false, false);
BMenuItem* item;
menu->AddItem(item = new BMenuItem("Full screen",
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Full screen"),
new BMessage(M_TOGGLE_FULLSCREEN), 'F'));
item->SetMarked(fIsFullscreen);
item->SetEnabled(fHasVideo);
BMenu* aspectSubMenu = new BMenu("Aspect ratio");
BMenu* aspectSubMenu = new BMenu(B_TRANSLATE("Aspect ratio"));
_SetupVideoAspectItems(aspectSubMenu);
aspectSubMenu->SetTargetForItems(this);
menu->AddItem(item = new BMenuItem(aspectSubMenu));
item->SetEnabled(fHasVideo);
menu->AddItem(item = new BMenuItem("Hide interface",
menu->AddItem(item = new BMenuItem(B_TRANSLATE("Hide interface"),
new BMessage(M_TOGGLE_NO_INTERFACE), 'H'));
item->SetMarked(fNoInterface);
item->SetEnabled(fHasVideo);
@ -1997,9 +2024,9 @@ MainWin::_ShowContextMenu(const BPoint& screenPoint)
menu->AddSeparatorItem();
// Add track selector menus
BMenu* audioTrackMenu = new BMenu("Audio track");
BMenu* videoTrackMenu = new BMenu("Video track");
BMenu* subTitleTrackMenu = new BMenu("Subtitles");
BMenu* audioTrackMenu = new BMenu(B_TRANSLATE("Audio track"));
BMenu* videoTrackMenu = new BMenu(B_TRANSLATE("Video track"));
BMenu* subTitleTrackMenu = new BMenu(B_TRANSLATE("Subtitles"));
_SetupTrackMenus(audioTrackMenu, videoTrackMenu, subTitleTrackMenu);
audioTrackMenu->SetTargetForItems(this);
@ -2016,7 +2043,7 @@ MainWin::_ShowContextMenu(const BPoint& screenPoint)
item->SetEnabled(fHasVideo);
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Quit", new BMessage(M_FILE_QUIT), 'Q'));
menu->AddItem(new BMenuItem(B_TRANSLATE("Quit"), new BMessage(M_FILE_QUIT), 'Q'));
menu->SetTargetForItems(this);
BRect rect(screenPoint.x - 5, screenPoint.y - 5, screenPoint.x + 5,

View File

@ -14,7 +14,9 @@
#include <string.h>
#include <Bitmap.h>
#include <Catalog.h>
#include <ControlLook.h>
#include <Locale.h>
#include <MenuItem.h>
#include <Message.h>
#include <MessageRunner.h>
@ -22,6 +24,11 @@
#include <PopUpMenu.h>
#include <Window.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-PeakView"
using std::nothrow;
@ -133,7 +140,7 @@ PeakView::MouseDown(BPoint where)
} else {
// Display context menu
BPopUpMenu* menu = new BPopUpMenu("peak context menu");
BMenuItem* item = new BMenuItem("Lock Peaks",
BMenuItem* item = new BMenuItem(B_TRANSLATE("Lock Peaks"),
new BMessage(MSG_LOCK_PEAKS));
item->SetMarked(fPeakLocked);
menu->AddItem(item);

View File

@ -8,10 +8,16 @@
#include <stdio.h>
#include <Autolock.h>
#include <Catalog.h>
#include <Locale.h>
#include "Playlist.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-CopyPLItemsCmd"
using std::nothrow;
@ -111,7 +117,7 @@ void
CopyPLItemsCommand::GetName(BString& name)
{
if (fCount > 1)
name << "Copy Entries";
name << B_TRANSLATE("Copy Entries");
else
name << "Copy Entry";
name << B_TRANSLATE("Copy Entry");
}

View File

@ -10,11 +10,17 @@
#include <stdio.h>
#include <Autolock.h>
#include <Catalog.h>
#include <Locale.h>
#include "Playlist.h"
#include "PlaylistItem.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-ImportPLItemsCmd"
using std::nothrow;
@ -166,8 +172,8 @@ void
ImportPLItemsCommand::GetName(BString& name)
{
if (fNewCount > 1)
name << "Import Entries";
name << B_TRANSLATE("Import Entries");
else
name << "Import Entry";
name << B_TRANSLATE("Import Entry");
}

View File

@ -9,10 +9,16 @@
#include <stdio.h>
#include <Autolock.h>
#include <Catalog.h>
#include <Locale.h>
#include "Playlist.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-MovePLItemsCmd"
using std::nothrow;
@ -172,7 +178,7 @@ void
MovePLItemsCommand::GetName(BString& name)
{
if (fCount > 1)
name << "Move Entries";
name << B_TRANSLATE("Move Entries");
else
name << "Move Entry";
name << B_TRANSLATE("Move Entry");
}

View File

@ -7,6 +7,13 @@
#include <stdio.h>
#include <Catalog.h>
#include <Locale.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-PlaylistItem"
PlaylistItem::Listener::Listener()
{
@ -55,7 +62,7 @@ PlaylistItem::Name() const
{
BString name;
if (GetAttribute(ATTR_STRING_NAME, name) != B_OK)
name = "<unnamed>";
name = B_TRANSLATE_WITH_CONTEXT("<unnamed>", "PlaylistItem-name");
return name;
}
@ -65,7 +72,7 @@ PlaylistItem::Author() const
{
BString author;
if (GetAttribute(ATTR_STRING_AUTHOR, author) != B_OK)
author = "<unknown>";
author = B_TRANSLATE_WITH_CONTEXT("<unknown>", "PlaylistItem-author");
return author;
}
@ -75,7 +82,7 @@ PlaylistItem::Album() const
{
BString album;
if (GetAttribute(ATTR_STRING_ALBUM, album) != B_OK)
album = "<unknown>";
album = B_TRANSLATE_WITH_CONTEXT("<unknown>", "PlaylistItem-album");
return album;
}
@ -85,7 +92,7 @@ PlaylistItem::Title() const
{
BString title;
if (GetAttribute(ATTR_STRING_TITLE, title) != B_OK)
title = "<untitled>";
title = B_TRANSLATE_WITH_CONTEXT("<untitled>", "PlaylistItem-title");
return title;
}

View File

@ -15,20 +15,22 @@
#include <Alert.h>
#include <Application.h>
#include <Autolock.h>
#include <Box.h>
#include <Button.h>
#include <Catalog.h>
#include <Entry.h>
#include <File.h>
#include <Roster.h>
#include <Path.h>
#include <FilePanel.h>
#include <Locale.h>
#include <Menu.h>
#include <MenuBar.h>
#include <MenuItem.h>
#include <NodeInfo.h>
#include <Path.h>
#include <Roster.h>
#include <ScrollBar.h>
#include <ScrollView.h>
#include <String.h>
#include <Box.h>
#include <Button.h>
#include <FilePanel.h>
#include "CommandStack.h"
#include "MainApp.h"
@ -36,6 +38,10 @@
#include "RWLocker.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-PlaylistWindow"
// TODO:
// Maintaining a playlist file on disk is a bit tricky. The playlist ref should
// be discarded when the user
@ -64,8 +70,8 @@ enum {
static void
display_save_alert(const char* message)
{
BAlert* alert = new BAlert("Save error", message, "OK", NULL, NULL,
B_WIDTH_AS_USUAL, B_STOP_ALERT);
BAlert* alert = new BAlert(B_TRANSLATE("Save error"), message,
B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->Go(NULL);
}
@ -73,7 +79,7 @@ display_save_alert(const char* message)
static void
display_save_alert(status_t error)
{
BString errorMessage("Saving the playlist failed.\n\nError: ");
BString errorMessage(B_TRANSLATE("Saving the playlist failed.\n\nError: "));
errorMessage << strerror(error);
display_save_alert(errorMessage.String());
}
@ -85,8 +91,8 @@ display_save_alert(status_t error)
PlaylistWindow::PlaylistWindow(BRect frame, Playlist* playlist,
Controller* controller)
:
BWindow(frame, "Playlist", B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS),
BWindow(frame, B_TRANSLATE("Playlist"), B_DOCUMENT_WINDOW_LOOK,
B_NORMAL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS),
fPlaylist(playlist),
fLocker(new RWLocker("command stack lock")),
fCommandStack(new CommandStack(fLocker)),
@ -188,8 +194,8 @@ PlaylistWindow::MessageReceived(BMessage* message)
BMessage appMessage(M_SHOW_OPEN_PANEL);
appMessage.AddMessenger("target", target);
appMessage.AddMessage("message", &result);
appMessage.AddString("title", "Open Playlist");
appMessage.AddString("label", "Open");
appMessage.AddString("title", B_TRANSLATE("Open Playlist"));
appMessage.AddString("label", B_TRANSLATE("Open"));
be_app->PostMessage(&appMessage);
break;
}
@ -207,8 +213,8 @@ PlaylistWindow::MessageReceived(BMessage* message)
BMessage appMessage(M_SHOW_SAVE_PANEL);
appMessage.AddMessenger("target", target);
appMessage.AddMessage("message", &result);
appMessage.AddString("title", "Save Playlist");
appMessage.AddString("label", "Save");
appMessage.AddString("title", B_TRANSLATE("Save Playlist"));
appMessage.AddString("label", B_TRANSLATE("Save"));
be_app->PostMessage(&appMessage);
break;
}
@ -250,34 +256,35 @@ PlaylistWindow::_CreateMenu(BRect& frame)
{
frame.bottom = 15;
BMenuBar* menuBar = new BMenuBar(frame, "main menu");
BMenu* fileMenu = new BMenu("Playlist");
BMenu* fileMenu = new BMenu(B_TRANSLATE("Playlist"));
menuBar->AddItem(fileMenu);
fileMenu->AddItem(new BMenuItem("Open"B_UTF8_ELLIPSIS,
fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Open"B_UTF8_ELLIPSIS),
new BMessage(M_PLAYLIST_OPEN), 'O'));
fileMenu->AddItem(new BMenuItem("Save as"B_UTF8_ELLIPSIS,
fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Save as"B_UTF8_ELLIPSIS),
new BMessage(M_PLAYLIST_SAVE_AS), 'S', B_SHIFT_KEY));
// fileMenu->AddItem(new BMenuItem("Save",
// new BMessage(M_PLAYLIST_SAVE), 'S'));
fileMenu->AddSeparatorItem();
fileMenu->AddItem(new BMenuItem("Close",
fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Close"),
new BMessage(B_QUIT_REQUESTED), 'W'));
BMenu* editMenu = new BMenu("Edit");
fUndoMI = new BMenuItem("Undo", new BMessage(B_UNDO), 'Z');
BMenu* editMenu = new BMenu(B_TRANSLATE("Edit"));
fUndoMI = new BMenuItem(B_TRANSLATE("Undo"), new BMessage(B_UNDO), 'Z');
editMenu->AddItem(fUndoMI);
fRedoMI = new BMenuItem("Redo", new BMessage(B_REDO), 'Z', B_SHIFT_KEY);
fRedoMI = new BMenuItem(B_TRANSLATE("Redo"), new BMessage(B_REDO), 'Z',
B_SHIFT_KEY);
editMenu->AddItem(fRedoMI);
editMenu->AddSeparatorItem();
editMenu->AddItem(new BMenuItem("Randomize",
editMenu->AddItem(new BMenuItem(B_TRANSLATE("Randomize"),
new BMessage(M_PLAYLIST_RANDOMIZE), 'R'));
editMenu->AddSeparatorItem();
editMenu->AddItem(new BMenuItem("Remove (Del)",
editMenu->AddItem(new BMenuItem(B_TRANSLATE("Remove (Del)"),
new BMessage(M_PLAYLIST_REMOVE)/*, B_DELETE, 0*/));
editMenu->AddItem(new BMenuItem("Remove and put into Trash",
editMenu->AddItem(new BMenuItem(B_TRANSLATE("Remove and put into Trash"),
new BMessage(M_PLAYLIST_REMOVE_AND_PUT_INTO_TRASH), 'T'));
editMenu->AddItem(new BMenuItem("Remove all",
editMenu->AddItem(new BMenuItem(B_TRANSLATE("Remove all"),
new BMessage(M_PLAYLIST_EMPTY), 'N'));
menuBar->AddItem(editMenu);
@ -297,20 +304,20 @@ PlaylistWindow::_ObjectChanged(const Notifier* object)
{
if (object == fCommandStack) {
// relable Undo item and update enabled status
BString label("Undo");
BString label(B_TRANSLATE("Undo"));
fUndoMI->SetEnabled(fCommandStack->GetUndoName(label));
if (fUndoMI->IsEnabled())
fUndoMI->SetLabel(label.String());
else
fUndoMI->SetLabel("<nothing to undo>");
fUndoMI->SetLabel(B_TRANSLATE("<nothing to undo>"));
// relable Redo item and update enabled status
label.SetTo("Redo");
label.SetTo(B_TRANSLATE("Redo"));
fRedoMI->SetEnabled(fCommandStack->GetRedoName(label));
if (fRedoMI->IsEnabled())
fRedoMI->SetLabel(label.String());
else
fRedoMI->SetLabel("<nothing to redo>");
fRedoMI->SetLabel(B_TRANSLATE("<nothing to redo>"));
}
}
@ -322,8 +329,8 @@ PlaylistWindow::_SavePlaylist(const BMessage* message)
const char* name;
if (message->FindRef("directory", &ref) != B_OK
|| message->FindString("name", &name) != B_OK) {
display_save_alert("Internal error (malformed message). "
"Saving the playlist failed.");
display_save_alert(B_TRANSLATE("Internal error (malformed message). "
"Saving the playlist failed."));
return;
}
@ -335,16 +342,16 @@ PlaylistWindow::_SavePlaylist(const BMessage* message)
if (origPath.InitCheck() != B_OK || tempPath.InitCheck() != B_OK
|| origPath.Append(name) != B_OK
|| tempPath.Append(tempName.String()) != B_OK) {
display_save_alert("Internal error (out of memory). "
"Saving the playlist failed.");
display_save_alert(B_TRANSLATE("Internal error (out of memory). "
"Saving the playlist failed."));
return;
}
BEntry origEntry(origPath.Path());
BEntry tempEntry(tempPath.Path());
if (origEntry.InitCheck() != B_OK || tempEntry.InitCheck() != B_OK) {
display_save_alert("Internal error (out of memory). "
"Saving the playlist failed.");
display_save_alert(B_TRANSLATE("Internal error (out of memory). "
"Saving the playlist failed."));
return;
}
@ -392,7 +399,8 @@ PlaylistWindow::_SavePlaylist(BEntry& origEntry, BEntry& tempEntry,
BFile file(&tempEntry, B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY);
if (file.InitCheck() != B_OK) {
BString errorMessage("Saving the playlist failed:\n\nError: ");
BString errorMessage(B_TRANSLATE(
"Saving the playlist failed:\n\nError: "));
errorMessage << strerror(file.InitCheck());
display_save_alert(errorMessage.String());
return;
@ -400,8 +408,8 @@ PlaylistWindow::_SavePlaylist(BEntry& origEntry, BEntry& tempEntry,
AutoLocker<Playlist> lock(fPlaylist);
if (!lock.IsLocked()) {
display_save_alert("Internal error (locking failed). "
"Saving the playlist failed.");
display_save_alert(B_TRANSLATE("Internal error (locking failed). "
"Saving the playlist failed."));
return;
}

View File

@ -10,10 +10,16 @@
#include <stdlib.h>
#include <Autolock.h>
#include <Catalog.h>
#include <Locale.h>
#include "Playlist.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-RandomizePLItemsCmd"
using std::nothrow;
@ -93,7 +99,7 @@ RandomizePLItemsCommand::Undo()
void
RandomizePLItemsCommand::GetName(BString& name)
{
name << "Randomize Entries";
name << B_TRANSLATE("Randomize Entries");
}

View File

@ -10,10 +10,16 @@
#include <Alert.h>
#include <Autolock.h>
#include <Catalog.h>
#include <Locale.h>
#include "Playlist.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-RemovePLItemsCmd"
using std::nothrow;
@ -106,13 +112,14 @@ RemovePLItemsCommand::Perform()
fMoveErrorShown = true;
BString message;
if (errorOnAllFiles)
message << "All ";
message <<
B_TRANSLATE("All files could not be moved into Trash.");
else
message << "Some ";
message << "files could not be moved into Trash.\n\n";
message << "Error: " << strerror(moveError);
(new BAlert("Move Into Trash Error", message.String(),
"OK", NULL, NULL, B_WIDTH_AS_USUAL,
message <<
B_TRANSLATE("Some files could not be moved into Trash.");
message << "\n\n" << B_TRANSLATE("Error: ") << strerror(moveError);
(new BAlert(B_TRANSLATE("Move Into Trash Error"), message.String(),
B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL,
B_WARNING_ALERT))->Go(NULL);
}
}
@ -159,11 +166,17 @@ RemovePLItemsCommand::Undo()
void
RemovePLItemsCommand::GetName(BString& name)
{
if (fCount > 1)
name << "Remove Entries";
if (fMoveFilesToTrash) {
if (fCount > 1)
name << B_TRANSLATE("Remove Entries into Trash");
else
name << B_TRANSLATE("Remove Entry into Trash");
}
else
name << "Remove Entry";
if (fMoveFilesToTrash)
name << " into Trash";
{
if (fCount > 1)
name << B_TRANSLATE("Remove Entries");
else
name << B_TRANSLATE("Remove Entry");
}
}

View File

@ -14,9 +14,11 @@
#include <Box.h>
#include <Button.h>
#include <Catalog.h>
#include <CheckBox.h>
#include <GridLayoutBuilder.h>
#include <GroupLayoutBuilder.h>
#include <Locale.h>
#include <OptionPopUp.h>
#include <SpaceLayoutItem.h>
#include <String.h>
@ -25,6 +27,10 @@
#include <View.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-SettingsWindow"
enum {
M_SETTINGS_CHANGED = 0x3000,
@ -41,7 +47,7 @@ enum {
SettingsWindow::SettingsWindow(BRect frame)
:
BWindow(frame, "MediaPlayer settings", B_FLOATING_WINDOW_LOOK,
BWindow(frame, B_TRANSLATE("MediaPlayer settings"), B_FLOATING_WINDOW_LOOK,
B_FLOATING_APP_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE
| B_AUTO_UPDATE_SIZE_LIMITS)
@ -54,11 +60,11 @@ SettingsWindow::SettingsWindow(BRect frame)
buttonBox->SetLayout(buttonLayout);
BStringView* playModeLabel = new BStringView("stringViewPlayMode",
"Play mode");
B_TRANSLATE("Play mode"));
BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions",
"View options");
B_TRANSLATE("View options"));
BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg",
"Play background clips at");
B_TRANSLATE("Play background clips at"));
BAlignment alignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER);
playModeLabel->SetExplicitAlignment(alignment);
playModeLabel->SetFont(be_bold_font);
@ -68,60 +74,66 @@ SettingsWindow::SettingsWindow(BRect frame)
bgMoviesModeLabel->SetFont(be_bold_font);
fAutostartCB = new BCheckBox("chkboxAutostart",
"Automatically start playing", new BMessage(M_SETTINGS_CHANGED));
B_TRANSLATE("Automatically start playing"),
new BMessage(M_SETTINGS_CHANGED));
fCloseWindowMoviesCB = new BCheckBox("chkBoxCloseWindowMovies",
"Close window when done playing movies",
B_TRANSLATE("Close window when done playing movies"),
new BMessage(M_SETTINGS_CHANGED));
fCloseWindowSoundsCB = new BCheckBox("chkBoxCloseWindowSounds",
"Close window when done playing sounds",
B_TRANSLATE("Close window when done playing sounds"),
new BMessage(M_SETTINGS_CHANGED));
fLoopMoviesCB = new BCheckBox("chkBoxLoopMovie",
"Loop movies by default", new BMessage(M_SETTINGS_CHANGED));
B_TRANSLATE("Loop movies by default"),
new BMessage(M_SETTINGS_CHANGED));
fLoopSoundsCB = new BCheckBox("chkBoxLoopSounds",
"Loop sounds by default", new BMessage(M_SETTINGS_CHANGED));
B_TRANSLATE("Loop sounds by default"),
new BMessage(M_SETTINGS_CHANGED));
fUseOverlaysCB = new BCheckBox("chkBoxUseOverlays",
"Use hardware video overlays if available",
B_TRANSLATE("Use hardware video overlays if available"),
new BMessage(M_SETTINGS_CHANGED));
fScaleBilinearCB = new BCheckBox("chkBoxScaleBilinear",
"Scale movies smoothly (non-overlay mode)",
B_TRANSLATE("Scale movies smoothly (non-overlay mode)"),
new BMessage(M_SETTINGS_CHANGED));
fScaleFullscreenControlsCB = new BCheckBox("chkBoxScaleControls",
"Scale controls in full-screen mode",
B_TRANSLATE("Scale controls in full-screen mode"),
new BMessage(M_SETTINGS_CHANGED));
fSubtitleSizeOP = new BOptionPopUp("subtitleSize",
"Subtitle size", new BMessage(M_SETTINGS_CHANGED));
fSubtitleSizeOP->AddOption("Small", mpSettings::SUBTITLE_SIZE_SMALL);
fSubtitleSizeOP->AddOption("Medium", mpSettings::SUBTITLE_SIZE_MEDIUM);
fSubtitleSizeOP->AddOption("Large", mpSettings::SUBTITLE_SIZE_LARGE);
B_TRANSLATE("Subtitle size"), new BMessage(M_SETTINGS_CHANGED));
fSubtitleSizeOP->AddOption(
B_TRANSLATE("Small"), mpSettings::SUBTITLE_SIZE_SMALL);
fSubtitleSizeOP->AddOption(
B_TRANSLATE("Medium"), mpSettings::SUBTITLE_SIZE_MEDIUM);
fSubtitleSizeOP->AddOption(
B_TRANSLATE("Large"), mpSettings::SUBTITLE_SIZE_LARGE);
fSubtitlePlacementOP = new BOptionPopUp("subtitlePlacement",
"Subtitle placement", new BMessage(M_SETTINGS_CHANGED));
fSubtitlePlacementOP->AddOption("Bottom of video",
B_TRANSLATE("Subtitle placement"), new BMessage(M_SETTINGS_CHANGED));
fSubtitlePlacementOP->AddOption(B_TRANSLATE("Bottom of video"),
mpSettings::SUBTITLE_PLACEMENT_BOTTOM_OF_VIDEO);
fSubtitlePlacementOP->AddOption("Bottom of screen",
fSubtitlePlacementOP->AddOption(B_TRANSLATE("Bottom of screen"),
mpSettings::SUBTITLE_PLACEMENT_BOTTOM_OF_SCREEN);
fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
"Full volume", new BMessage(M_SETTINGS_CHANGED));
B_TRANSLATE("Full volume"), new BMessage(M_SETTINGS_CHANGED));
fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume",
"Low volume", new BMessage(M_SETTINGS_CHANGED));
B_TRANSLATE("Low volume"), new BMessage(M_SETTINGS_CHANGED));
fMutedVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
"Muted", new BMessage(M_SETTINGS_CHANGED));
B_TRANSLATE("Muted"), new BMessage(M_SETTINGS_CHANGED));
fRevertB = new BButton("revert", "Revert",
fRevertB = new BButton("revert", B_TRANSLATE("Revert"),
new BMessage(M_SETTINGS_REVERT));
BButton* cancelButton = new BButton("cancel", "Cancel",
BButton* cancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
new BMessage(M_SETTINGS_CANCEL));
BButton* okButton = new BButton("ok", "OK",
BButton* okButton = new BButton("ok", B_TRANSLATE("OK"),
new BMessage(M_SETTINGS_SAVE));
okButton->MakeDefault(true);