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
+17 -2
View File
@@ -113,8 +113,23 @@ Application MediaPlayer :
MainWin.cpp MainWin.cpp
VideoView.cpp VideoView.cpp
: be game locale media tracker translation textencoding $(TARGET_LIBSTDC++) : be game locale media tracker translation textencoding $(TARGET_LIBSTDC++)
libshared.a $(HAIKU_LOCALE_LIBS) libshared.a
: MediaPlayer.rdef : 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
;
+16 -7
View File
@@ -24,8 +24,10 @@
#include <Alert.h> #include <Alert.h>
#include <Autolock.h> #include <Autolock.h>
#include <Catalog.h>
#include <Entry.h> #include <Entry.h>
#include <FilePanel.h> #include <FilePanel.h>
#include <Locale.h>
#include <MediaDefs.h> #include <MediaDefs.h>
#include <MediaRoster.h> #include <MediaRoster.h>
#include <MimeType.h> #include <MimeType.h>
@@ -43,8 +45,12 @@
#include "SettingsWindow.h" #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"; const char* kAppSig = "application/x-vnd.Haiku-MediaPlayer";
@@ -85,8 +91,9 @@ MainApp::MainApp()
if (!fMediaServerRunning || !fMediaAddOnServerRunning) { if (!fMediaServerRunning || !fMediaAddOnServerRunning) {
BAlert* alert = new BAlert("start_media_server", BAlert* alert = new BAlert("start_media_server",
"It appears the media server is not running.\n" B_TRANSLATE("It appears the media server is not running.\n"
"Would you like to start it ?", "Quit", "Start media server", NULL, "Would you like to start it ?"), B_TRANSLATE("Quit"),
B_TRANSLATE("Start media server"), NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT); B_WIDTH_AS_USUAL, B_WARNING_ALERT);
if (alert->Go() == 0) { if (alert->Go() == 0) {
PostMessage(B_QUIT_REQUESTED); PostMessage(B_QUIT_REQUESTED);
@@ -404,8 +411,10 @@ MainApp::MessageReceived(BMessage* message)
void void
MainApp::AboutRequested() MainApp::AboutRequested()
{ {
BAlert* alert = new BAlert("about", NAME"\n\nWritten by Marcus Overhagen, " BAlert* alert = new BAlert("about", B_TRANSLATE(
"Stephan Aßmus and Frederik Modéen", "Thanks"); NAME"\n\nWritten by Marcus Overhagen, "
"Stephan Aßmus and Frederik Modéen"),
B_TRANSLATE("Thanks"));
alert->SetFeel(B_FLOATING_ALL_WINDOW_FEEL); alert->SetFeel(B_FLOATING_ALL_WINDOW_FEEL);
// Make sure it is on top of any player windows that may have the // Make sure it is on top of any player windows that may have the
// floating all window feel. // floating all window feel.
@@ -462,7 +471,7 @@ MainApp::_ShowOpenFilePanel(const BMessage* message)
} }
_ShowFilePanel(fOpenFilePanel, M_OPEN_PANEL_RESULT, 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, _ShowFilePanel(fSaveFilePanel, M_SAVE_PANEL_RESULT, message,
"Save", "Save"); B_TRANSLATE("Save"), B_TRANSLATE("Save"));
} }
+102 -75
View File
@@ -30,9 +30,11 @@
#include <Alert.h> #include <Alert.h>
#include <Application.h> #include <Application.h>
#include <Autolock.h> #include <Autolock.h>
#include <Catalog.h>
#include <Debug.h> #include <Debug.h>
#include <fs_attr.h> #include <fs_attr.h>
#include <Language.h> #include <Language.h>
#include <Locale.h>
#include <Menu.h> #include <Menu.h>
#include <MenuBar.h> #include <MenuBar.h>
#include <MenuItem.h> #include <MenuItem.h>
@@ -59,6 +61,8 @@
#include "Settings.h" #include "Settings.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-Main"
#define MIN_WIDTH 250 #define MIN_WIDTH 250
@@ -116,34 +120,43 @@ enum {
static property_info sPropertyInfo[] = { static property_info sPropertyInfo[] = {
{ "Next", { B_EXECUTE_PROPERTY }, { B_TRANSLATE("Next"), { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 }, "Skip to the next track.", 0 { B_DIRECT_SPECIFIER, 0 },
B_TRANSLATE("Skip to the next track."), 0
}, },
{ "Prev", { B_EXECUTE_PROPERTY }, { B_TRANSLATE("Prev"), { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 }, "Skip to the previous track.", 0 { B_DIRECT_SPECIFIER, 0 },
B_TRANSLATE("Skip to the previous track."), 0
}, },
{ "Play", { B_EXECUTE_PROPERTY }, { B_TRANSLATE("Play"), { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 }, "Start playing.", 0 { B_DIRECT_SPECIFIER, 0 },
B_TRANSLATE("Start playing."), 0
}, },
{ "Stop", { B_EXECUTE_PROPERTY }, { B_TRANSLATE("Stop"), { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 }, "Stop playing.", 0 { B_DIRECT_SPECIFIER, 0 },
B_TRANSLATE("Stop playing."), 0
}, },
{ "Pause", { B_EXECUTE_PROPERTY }, { B_TRANSLATE("Pause"), { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 }, "Pause playback.", 0 { B_DIRECT_SPECIFIER, 0 },
B_TRANSLATE("Pause playback."), 0
}, },
{ "TogglePlaying", { B_EXECUTE_PROPERTY }, { B_TRANSLATE("TogglePlaying"), { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 }, "Toggle pause/play.", 0 { B_DIRECT_SPECIFIER, 0 },
B_TRANSLATE("Toggle pause/play."), 0
}, },
{ "Mute", { B_EXECUTE_PROPERTY }, { B_TRANSLATE("Mute"), { B_EXECUTE_PROPERTY },
{ B_DIRECT_SPECIFIER, 0 }, "Toggle mute.", 0 { B_DIRECT_SPECIFIER, 0 },
B_TRANSLATE("Toggle mute."), 0
}, },
{ "Volume", { B_GET_PROPERTY, B_SET_PROPERTY, 0 }, { B_TRANSLATE("Volume"), { B_GET_PROPERTY, B_SET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 0 }, "Gets/sets the volume (0.0-2.0).", 0, { B_DIRECT_SPECIFIER, 0 },
B_TRANSLATE("Gets/sets the volume (0.0-2.0)."), 0,
{ B_FLOAT_TYPE } { B_FLOAT_TYPE }
}, },
{ "URI", { B_GET_PROPERTY, 0 }, { B_TRANSLATE("URI"), { B_GET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 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 } { 0, { 0 }, { 0 }, 0, 0 }
}; };
@@ -151,7 +164,7 @@ static property_info sPropertyInfo[] = {
static const char* kRatingAttrName = "Media:Rating"; 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...) //#define printf(a...)
@@ -609,8 +622,9 @@ MainWin::MessageReceived(BMessage* msg)
} }
case MSG_PLAYLIST_IMPORT_FAILED: case MSG_PLAYLIST_IMPORT_FAILED:
{ {
BAlert* alert = new BAlert("Nothing to Play", "None of the files " BAlert* alert = new BAlert(B_TRANSLATE("Nothing to Play"),
"you wanted to play appear to be media files.", "OK"); B_TRANSLATE("None of the files you wanted to play appear "
"to be media files."), B_TRANSLATE("OK"));
alert->Go(); alert->Go();
fControls->SetDisabledString(kDisabledSeekMessage); fControls->SetDisabledString(kDisabledSeekMessage);
break; break;
@@ -741,8 +755,8 @@ MainWin::MessageReceived(BMessage* msg)
BMessage appMessage(M_SHOW_OPEN_PANEL); BMessage appMessage(M_SHOW_OPEN_PANEL);
appMessage.AddMessenger("target", target); appMessage.AddMessenger("target", target);
appMessage.AddMessage("message", &result); appMessage.AddMessage("message", &result);
appMessage.AddString("title", "Open Clips"); appMessage.AddString("title", B_TRANSLATE("Open Clips"));
appMessage.AddString("label", "Open"); appMessage.AddString("label", B_TRANSLATE("Open"));
be_app->PostMessage(&appMessage); be_app->PostMessage(&appMessage);
break; break;
} }
@@ -1068,8 +1082,9 @@ MainWin::OpenPlaylistItem(const PlaylistItemRef& item)
if (ret != B_OK) { if (ret != B_OK) {
fprintf(stderr, "MainWin::OpenPlaylistItem() - Failed to send message " fprintf(stderr, "MainWin::OpenPlaylistItem() - Failed to send message "
"to Controller.\n"); "to Controller.\n");
(new BAlert("error", NAME" encountered an internal error. " (new BAlert(B_TRANSLATE("error"),
"The file could not be opened.", "OK"))->Go(); B_TRANSLATE(NAME" encountered an internal error. "
"The file could not be opened."), B_TRANSLATE("OK")))->Go();
_PlaylistItemOpened(item, ret); _PlaylistItemOpened(item, ret);
} else { } else {
BString string; BString string;
@@ -1307,21 +1322,21 @@ MainWin::_PlaylistItemOpened(const PlaylistItemRef& item, status_t result)
if (allItemsFailed) { if (allItemsFailed) {
// Display error if all files failed to play. // Display error if all files failed to play.
BString message; BString message(B_TRANSLATE(
message << "The file '"; "The file'%filename' could not be opened.\n\n"));;
message << item->Name(); message.ReplaceAll("%filename", item->Name());
message << "' could not be opened.\n\n";
if (result == B_MEDIA_NO_HANDLER) { if (result == B_MEDIA_NO_HANDLER) {
// give a more detailed message for the most likely of all // give a more detailed message for the most likely of all
// errors // 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 " "file format, or the decoder has trouble with the "
"specific version of the format."; "specific version of the format.");
} else { } 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); fControls->SetDisabledString(kDisabledSeekMessage);
} else { } else {
// Just go to the next file and don't bother user (yet) // Just go to the next file and don't bother user (yet)
@@ -1404,21 +1419,23 @@ void
MainWin::_CreateMenu() MainWin::_CreateMenu()
{ {
fFileMenu = new BMenu(NAME); fFileMenu = new BMenu(NAME);
fPlaylistMenu = new BMenu("Playlist"B_UTF8_ELLIPSIS); fPlaylistMenu = new BMenu(B_TRANSLATE("Playlist"B_UTF8_ELLIPSIS));
fAudioMenu = new BMenu("Audio"); fAudioMenu = new BMenu(B_TRANSLATE("Audio"));
fVideoMenu = new BMenu("Video"); fVideoMenu = new BMenu(B_TRANSLATE("Video"));
fVideoAspectMenu = new BMenu("Aspect ratio"); fVideoAspectMenu = new BMenu(B_TRANSLATE("Aspect ratio"));
fAudioTrackMenu = new BMenu("Track"); fAudioTrackMenu = new BMenu(B_TRANSLATE_WITH_CONTEXT("Track",
fVideoTrackMenu = new BMenu("Track"); "Audio Track Menu"));
fSubTitleTrackMenu = new BMenu("Subtitles"); fVideoTrackMenu = new BMenu(B_TRANSLATE_WITH_CONTEXT("Track",
fAttributesMenu = new BMenu("Attributes"); "Video Track Menu"));
fSubTitleTrackMenu = new BMenu(B_TRANSLATE("Subtitles"));
fAttributesMenu = new BMenu(B_TRANSLATE("Attributes"));
fMenuBar->AddItem(fFileMenu); fMenuBar->AddItem(fFileMenu);
fMenuBar->AddItem(fAudioMenu); fMenuBar->AddItem(fAudioMenu);
fMenuBar->AddItem(fVideoMenu); fMenuBar->AddItem(fVideoMenu);
fMenuBar->AddItem(fAttributesMenu); 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'); new BMessage(M_NEW_PLAYER), 'N');
fFileMenu->AddItem(item); fFileMenu->AddItem(item);
item->SetTarget(be_app); item->SetTarget(be_app);
@@ -1426,14 +1443,14 @@ MainWin::_CreateMenu()
// Add recent files to "Open File" entry as sub-menu. // Add recent files to "Open File" entry as sub-menu.
BRecentFilesList recentFiles(10, false, NULL, kAppSig); BRecentFilesList recentFiles(10, false, NULL, kAppSig);
item = new BMenuItem(recentFiles.NewFileListMenu( item = new BMenuItem(recentFiles.NewFileListMenu(
"Open file"B_UTF8_ELLIPSIS, NULL, NULL, this, 10, true, NULL, kAppSig), B_TRANSLATE("Open file"B_UTF8_ELLIPSIS), NULL, NULL, this, 10, true,
new BMessage(M_FILE_OPEN)); NULL, kAppSig), new BMessage(M_FILE_OPEN));
item->SetShortcut('O', 0); item->SetShortcut('O', 0);
fFileMenu->AddItem(item); fFileMenu->AddItem(item);
fFileMenu->AddSeparatorItem(); 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')); new BMessage(M_FILE_INFO), 'I'));
fFileMenu->AddItem(fPlaylistMenu); fFileMenu->AddItem(fPlaylistMenu);
fPlaylistMenu->Superitem()->SetShortcut('P', B_COMMAND_KEY); fPlaylistMenu->Superitem()->SetShortcut('P', B_COMMAND_KEY);
@@ -1441,28 +1458,30 @@ MainWin::_CreateMenu()
fFileMenu->AddSeparatorItem(); fFileMenu->AddSeparatorItem();
fNoInterfaceMenuItem = new BMenuItem("Hide interface", fNoInterfaceMenuItem = new BMenuItem(B_TRANSLATE("Hide interface"),
new BMessage(M_TOGGLE_NO_INTERFACE), 'H'); new BMessage(M_TOGGLE_NO_INTERFACE), 'H');
fFileMenu->AddItem(fNoInterfaceMenuItem); 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')); 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'); new BMessage(M_SETTINGS), 'S');
fFileMenu->AddItem(item); fFileMenu->AddItem(item);
item->SetTarget(be_app); item->SetTarget(be_app);
fFileMenu->AddSeparatorItem(); 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)); new BMessage(B_ABOUT_REQUESTED));
fFileMenu->AddItem(item); fFileMenu->AddItem(item);
item->SetTarget(be_app); item->SetTarget(be_app);
fFileMenu->AddSeparatorItem(); fFileMenu->AddSeparatorItem();
fFileMenu->AddItem(new BMenuItem("Close", new BMessage(M_FILE_CLOSE), 'W')); fFileMenu->AddItem(new BMenuItem(B_TRANSLATE("Close"),
fFileMenu->AddItem(new BMenuItem("Quit", new BMessage(M_FILE_QUIT), 'Q')); new BMessage(M_FILE_CLOSE), 'W'));
fFileMenu->AddItem(new BMenuItem(B_TRANSLATE("Quit"),
new BMessage(M_FILE_QUIT), 'Q'));
fPlaylistMenu->SetRadioMode(true); fPlaylistMenu->SetRadioMode(true);
@@ -1473,27 +1492,32 @@ MainWin::_CreateMenu()
fVideoMenu->AddSeparatorItem(); fVideoMenu->AddSeparatorItem();
BMessage* resizeMessage = new BMessage(M_VIEW_SIZE); BMessage* resizeMessage = new BMessage(M_VIEW_SIZE);
resizeMessage->AddInt32("size", 50); 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 = new BMessage(M_VIEW_SIZE);
resizeMessage->AddInt32("size", 100); 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 = new BMessage(M_VIEW_SIZE);
resizeMessage->AddInt32("size", 200); 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 = new BMessage(M_VIEW_SIZE);
resizeMessage->AddInt32("size", 300); 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 = new BMessage(M_VIEW_SIZE);
resizeMessage->AddInt32("size", 400); 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->AddSeparatorItem();
fVideoMenu->AddItem(new BMenuItem("Full screen", fVideoMenu->AddItem(new BMenuItem(B_TRANSLATE("Full screen"),
new BMessage(M_TOGGLE_FULLSCREEN), 'F')); new BMessage(M_TOGGLE_FULLSCREEN), 'F'));
fVideoMenu->AddSeparatorItem(); fVideoMenu->AddSeparatorItem();
@@ -1501,7 +1525,7 @@ MainWin::_CreateMenu()
_SetupVideoAspectItems(fVideoAspectMenu); _SetupVideoAspectItems(fVideoAspectMenu);
fVideoMenu->AddItem(fVideoAspectMenu); fVideoMenu->AddItem(fVideoAspectMenu);
fRatingMenu = new BMenu("Rating"); fRatingMenu = new BMenu(B_TRANSLATE("Rating"));
fAttributesMenu->AddItem(fRatingMenu); fAttributesMenu->AddItem(fRatingMenu);
for (int32 i = 1; i <= 10; i++) { for (int32 i = 1; i <= 10; i++) {
char label[16]; char label[16];
@@ -1532,12 +1556,12 @@ MainWin::_SetupVideoAspectItems(BMenu* menu)
// "Stream Settings" and "16 : 9" if the stream settings happen to // "Stream Settings" and "16 : 9" if the stream settings happen to
// be "16 : 9". // 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))); new BMessage(M_ASPECT_SAME_AS_SOURCE)));
item->SetMarked(widthAspect == fWidthAspect item->SetMarked(widthAspect == fWidthAspect
&& heightAspect == fHeightAspect); && 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))); new BMessage(M_ASPECT_NO_DISTORTION)));
item->SetMarked(width == fWidthAspect && height == fHeightAspect); item->SetMarked(width == fWidthAspect && height == fHeightAspect);
@@ -1558,10 +1582,10 @@ MainWin::_SetupVideoAspectItems(BMenu* menu)
menu->AddItem(item = new BMenuItem("1.75 : 1", menu->AddItem(item = new BMenuItem("1.75 : 1",
new BMessage(M_ASPECT_7_4))); new BMessage(M_ASPECT_7_4)));
item->SetMarked(fWidthAspect == 7 && fHeightAspect == 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))); new BMessage(M_ASPECT_37_20)));
item->SetMarked(fWidthAspect == 37 && fHeightAspect == 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))); new BMessage(M_ASPECT_47_20)));
item->SetMarked(fWidthAspect == 47 && fHeightAspect == 20); item->SetMarked(fWidthAspect == 47 && fHeightAspect == 20);
} }
@@ -1591,14 +1615,15 @@ MainWin::_SetupTrackMenus(BMenu* audioTrackMenu, BMenu* videoTrackMenu,
languageString = languageName.String(); languageString = languageName.String();
snprintf(s, sizeof(s), "%s", languageString); snprintf(s, sizeof(s), "%s", languageString);
} else } else
snprintf(s, sizeof(s), "Track %d", i + 1); snprintf(s, sizeof(s), B_TRANSLATE("Track %d"), i + 1);
BMenuItem* item = new BMenuItem(s, BMenuItem* item = new BMenuItem(s,
new BMessage(M_SELECT_AUDIO_TRACK + i)); new BMessage(M_SELECT_AUDIO_TRACK + i));
item->SetMarked(i == current); item->SetMarked(i == current);
audioTrackMenu->AddItem(item); audioTrackMenu->AddItem(item);
} }
if (count == 0) { 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); audioTrackMenu->ItemAt(0)->SetMarked(true);
} }
@@ -1606,7 +1631,7 @@ MainWin::_SetupTrackMenus(BMenu* audioTrackMenu, BMenu* videoTrackMenu,
count = fController->VideoTrackCount(); count = fController->VideoTrackCount();
current = fController->CurrentVideoTrack(); current = fController->CurrentVideoTrack();
for (int i = 0; i < count; i++) { 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, BMenuItem* item = new BMenuItem(s,
new BMessage(M_SELECT_VIDEO_TRACK + i)); new BMessage(M_SELECT_VIDEO_TRACK + i));
item->SetMarked(i == current); item->SetMarked(i == current);
@@ -1620,7 +1645,8 @@ MainWin::_SetupTrackMenus(BMenu* audioTrackMenu, BMenu* videoTrackMenu,
count = fController->SubTitleTrackCount(); count = fController->SubTitleTrackCount();
if (count > 0) { if (count > 0) {
current = fController->CurrentSubTitleTrack(); 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)); new BMessage(M_SELECT_SUB_TITLE_TRACK - 1));
subTitleTrackMenu->AddItem(item); subTitleTrackMenu->AddItem(item);
item->SetMarked(current == -1); item->SetMarked(current == -1);
@@ -1632,14 +1658,15 @@ MainWin::_SetupTrackMenus(BMenu* audioTrackMenu, BMenu* videoTrackMenu,
if (name != NULL) if (name != NULL)
snprintf(s, sizeof(s), "%s", name); snprintf(s, sizeof(s), "%s", name);
else else
snprintf(s, sizeof(s), "Track %d", i + 1); snprintf(s, sizeof(s), B_TRANSLATE("Track %d"), i + 1);
item = new BMenuItem(s, item = new BMenuItem(s,
new BMessage(M_SELECT_SUB_TITLE_TRACK + i)); new BMessage(M_SELECT_SUB_TITLE_TRACK + i));
item->SetMarked(i == current); item->SetMarked(i == current);
subTitleTrackMenu->AddItem(item); subTitleTrackMenu->AddItem(item);
} }
} else { } else {
subTitleTrackMenu->AddItem(new BMenuItem("none", subTitleTrackMenu->AddItem(new BMenuItem(
B_TRANSLATE_WITH_CONTEXT("none", "Subtitles menu"),
new BMessage(M_DUMMY))); new BMessage(M_DUMMY)));
subTitleTrackMenu->ItemAt(0)->SetMarked(true); subTitleTrackMenu->ItemAt(0)->SetMarked(true);
} }
@@ -1978,18 +2005,18 @@ MainWin::_ShowContextMenu(const BPoint& screenPoint)
printf("Show context menu\n"); printf("Show context menu\n");
BPopUpMenu* menu = new BPopUpMenu("context menu", false, false); BPopUpMenu* menu = new BPopUpMenu("context menu", false, false);
BMenuItem* item; BMenuItem* item;
menu->AddItem(item = new BMenuItem("Full screen", menu->AddItem(item = new BMenuItem(B_TRANSLATE("Full screen"),
new BMessage(M_TOGGLE_FULLSCREEN), 'F')); new BMessage(M_TOGGLE_FULLSCREEN), 'F'));
item->SetMarked(fIsFullscreen); item->SetMarked(fIsFullscreen);
item->SetEnabled(fHasVideo); item->SetEnabled(fHasVideo);
BMenu* aspectSubMenu = new BMenu("Aspect ratio"); BMenu* aspectSubMenu = new BMenu(B_TRANSLATE("Aspect ratio"));
_SetupVideoAspectItems(aspectSubMenu); _SetupVideoAspectItems(aspectSubMenu);
aspectSubMenu->SetTargetForItems(this); aspectSubMenu->SetTargetForItems(this);
menu->AddItem(item = new BMenuItem(aspectSubMenu)); menu->AddItem(item = new BMenuItem(aspectSubMenu));
item->SetEnabled(fHasVideo); 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')); new BMessage(M_TOGGLE_NO_INTERFACE), 'H'));
item->SetMarked(fNoInterface); item->SetMarked(fNoInterface);
item->SetEnabled(fHasVideo); item->SetEnabled(fHasVideo);
@@ -1997,9 +2024,9 @@ MainWin::_ShowContextMenu(const BPoint& screenPoint)
menu->AddSeparatorItem(); menu->AddSeparatorItem();
// Add track selector menus // Add track selector menus
BMenu* audioTrackMenu = new BMenu("Audio track"); BMenu* audioTrackMenu = new BMenu(B_TRANSLATE("Audio track"));
BMenu* videoTrackMenu = new BMenu("Video track"); BMenu* videoTrackMenu = new BMenu(B_TRANSLATE("Video track"));
BMenu* subTitleTrackMenu = new BMenu("Subtitles"); BMenu* subTitleTrackMenu = new BMenu(B_TRANSLATE("Subtitles"));
_SetupTrackMenus(audioTrackMenu, videoTrackMenu, subTitleTrackMenu); _SetupTrackMenus(audioTrackMenu, videoTrackMenu, subTitleTrackMenu);
audioTrackMenu->SetTargetForItems(this); audioTrackMenu->SetTargetForItems(this);
@@ -2016,7 +2043,7 @@ MainWin::_ShowContextMenu(const BPoint& screenPoint)
item->SetEnabled(fHasVideo); item->SetEnabled(fHasVideo);
menu->AddSeparatorItem(); 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); menu->SetTargetForItems(this);
BRect rect(screenPoint.x - 5, screenPoint.y - 5, screenPoint.x + 5, BRect rect(screenPoint.x - 5, screenPoint.y - 5, screenPoint.x + 5,
+8 -1
View File
@@ -14,7 +14,9 @@
#include <string.h> #include <string.h>
#include <Bitmap.h> #include <Bitmap.h>
#include <Catalog.h>
#include <ControlLook.h> #include <ControlLook.h>
#include <Locale.h>
#include <MenuItem.h> #include <MenuItem.h>
#include <Message.h> #include <Message.h>
#include <MessageRunner.h> #include <MessageRunner.h>
@@ -22,6 +24,11 @@
#include <PopUpMenu.h> #include <PopUpMenu.h>
#include <Window.h> #include <Window.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-PeakView"
using std::nothrow; using std::nothrow;
@@ -133,7 +140,7 @@ PeakView::MouseDown(BPoint where)
} else { } else {
// Display context menu // Display context menu
BPopUpMenu* menu = new BPopUpMenu("peak 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)); new BMessage(MSG_LOCK_PEAKS));
item->SetMarked(fPeakLocked); item->SetMarked(fPeakLocked);
menu->AddItem(item); menu->AddItem(item);
@@ -8,10 +8,16 @@
#include <stdio.h> #include <stdio.h>
#include <Autolock.h> #include <Autolock.h>
#include <Catalog.h>
#include <Locale.h>
#include "Playlist.h" #include "Playlist.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-CopyPLItemsCmd"
using std::nothrow; using std::nothrow;
@@ -111,7 +117,7 @@ void
CopyPLItemsCommand::GetName(BString& name) CopyPLItemsCommand::GetName(BString& name)
{ {
if (fCount > 1) if (fCount > 1)
name << "Copy Entries"; name << B_TRANSLATE("Copy Entries");
else else
name << "Copy Entry"; name << B_TRANSLATE("Copy Entry");
} }
@@ -10,11 +10,17 @@
#include <stdio.h> #include <stdio.h>
#include <Autolock.h> #include <Autolock.h>
#include <Catalog.h>
#include <Locale.h>
#include "Playlist.h" #include "Playlist.h"
#include "PlaylistItem.h" #include "PlaylistItem.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-ImportPLItemsCmd"
using std::nothrow; using std::nothrow;
@@ -166,8 +172,8 @@ void
ImportPLItemsCommand::GetName(BString& name) ImportPLItemsCommand::GetName(BString& name)
{ {
if (fNewCount > 1) if (fNewCount > 1)
name << "Import Entries"; name << B_TRANSLATE("Import Entries");
else else
name << "Import Entry"; name << B_TRANSLATE("Import Entry");
} }
@@ -9,10 +9,16 @@
#include <stdio.h> #include <stdio.h>
#include <Autolock.h> #include <Autolock.h>
#include <Catalog.h>
#include <Locale.h>
#include "Playlist.h" #include "Playlist.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-MovePLItemsCmd"
using std::nothrow; using std::nothrow;
@@ -172,7 +178,7 @@ void
MovePLItemsCommand::GetName(BString& name) MovePLItemsCommand::GetName(BString& name)
{ {
if (fCount > 1) if (fCount > 1)
name << "Move Entries"; name << B_TRANSLATE("Move Entries");
else else
name << "Move Entry"; name << B_TRANSLATE("Move Entry");
} }
+11 -4
View File
@@ -7,6 +7,13 @@
#include <stdio.h> #include <stdio.h>
#include <Catalog.h>
#include <Locale.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-PlaylistItem"
PlaylistItem::Listener::Listener() PlaylistItem::Listener::Listener()
{ {
@@ -55,7 +62,7 @@ PlaylistItem::Name() const
{ {
BString name; BString name;
if (GetAttribute(ATTR_STRING_NAME, name) != B_OK) if (GetAttribute(ATTR_STRING_NAME, name) != B_OK)
name = "<unnamed>"; name = B_TRANSLATE_WITH_CONTEXT("<unnamed>", "PlaylistItem-name");
return name; return name;
} }
@@ -65,7 +72,7 @@ PlaylistItem::Author() const
{ {
BString author; BString author;
if (GetAttribute(ATTR_STRING_AUTHOR, author) != B_OK) if (GetAttribute(ATTR_STRING_AUTHOR, author) != B_OK)
author = "<unknown>"; author = B_TRANSLATE_WITH_CONTEXT("<unknown>", "PlaylistItem-author");
return author; return author;
} }
@@ -75,7 +82,7 @@ PlaylistItem::Album() const
{ {
BString album; BString album;
if (GetAttribute(ATTR_STRING_ALBUM, album) != B_OK) if (GetAttribute(ATTR_STRING_ALBUM, album) != B_OK)
album = "<unknown>"; album = B_TRANSLATE_WITH_CONTEXT("<unknown>", "PlaylistItem-album");
return album; return album;
} }
@@ -85,7 +92,7 @@ PlaylistItem::Title() const
{ {
BString title; BString title;
if (GetAttribute(ATTR_STRING_TITLE, title) != B_OK) if (GetAttribute(ATTR_STRING_TITLE, title) != B_OK)
title = "<untitled>"; title = B_TRANSLATE_WITH_CONTEXT("<untitled>", "PlaylistItem-title");
return title; return title;
} }
@@ -15,20 +15,22 @@
#include <Alert.h> #include <Alert.h>
#include <Application.h> #include <Application.h>
#include <Autolock.h> #include <Autolock.h>
#include <Box.h>
#include <Button.h>
#include <Catalog.h>
#include <Entry.h> #include <Entry.h>
#include <File.h> #include <File.h>
#include <Roster.h> #include <FilePanel.h>
#include <Path.h> #include <Locale.h>
#include <Menu.h> #include <Menu.h>
#include <MenuBar.h> #include <MenuBar.h>
#include <MenuItem.h> #include <MenuItem.h>
#include <NodeInfo.h> #include <NodeInfo.h>
#include <Path.h>
#include <Roster.h>
#include <ScrollBar.h> #include <ScrollBar.h>
#include <ScrollView.h> #include <ScrollView.h>
#include <String.h> #include <String.h>
#include <Box.h>
#include <Button.h>
#include <FilePanel.h>
#include "CommandStack.h" #include "CommandStack.h"
#include "MainApp.h" #include "MainApp.h"
@@ -36,6 +38,10 @@
#include "RWLocker.h" #include "RWLocker.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-PlaylistWindow"
// TODO: // TODO:
// Maintaining a playlist file on disk is a bit tricky. The playlist ref should // Maintaining a playlist file on disk is a bit tricky. The playlist ref should
// be discarded when the user // be discarded when the user
@@ -64,8 +70,8 @@ enum {
static void static void
display_save_alert(const char* message) display_save_alert(const char* message)
{ {
BAlert* alert = new BAlert("Save error", message, "OK", NULL, NULL, BAlert* alert = new BAlert(B_TRANSLATE("Save error"), message,
B_WIDTH_AS_USUAL, B_STOP_ALERT); B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->Go(NULL); alert->Go(NULL);
} }
@@ -73,7 +79,7 @@ display_save_alert(const char* message)
static void static void
display_save_alert(status_t error) 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); errorMessage << strerror(error);
display_save_alert(errorMessage.String()); display_save_alert(errorMessage.String());
} }
@@ -85,8 +91,8 @@ display_save_alert(status_t error)
PlaylistWindow::PlaylistWindow(BRect frame, Playlist* playlist, PlaylistWindow::PlaylistWindow(BRect frame, Playlist* playlist,
Controller* controller) Controller* controller)
: :
BWindow(frame, "Playlist", B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, BWindow(frame, B_TRANSLATE("Playlist"), B_DOCUMENT_WINDOW_LOOK,
B_ASYNCHRONOUS_CONTROLS), B_NORMAL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS),
fPlaylist(playlist), fPlaylist(playlist),
fLocker(new RWLocker("command stack lock")), fLocker(new RWLocker("command stack lock")),
fCommandStack(new CommandStack(fLocker)), fCommandStack(new CommandStack(fLocker)),
@@ -188,8 +194,8 @@ PlaylistWindow::MessageReceived(BMessage* message)
BMessage appMessage(M_SHOW_OPEN_PANEL); BMessage appMessage(M_SHOW_OPEN_PANEL);
appMessage.AddMessenger("target", target); appMessage.AddMessenger("target", target);
appMessage.AddMessage("message", &result); appMessage.AddMessage("message", &result);
appMessage.AddString("title", "Open Playlist"); appMessage.AddString("title", B_TRANSLATE("Open Playlist"));
appMessage.AddString("label", "Open"); appMessage.AddString("label", B_TRANSLATE("Open"));
be_app->PostMessage(&appMessage); be_app->PostMessage(&appMessage);
break; break;
} }
@@ -207,8 +213,8 @@ PlaylistWindow::MessageReceived(BMessage* message)
BMessage appMessage(M_SHOW_SAVE_PANEL); BMessage appMessage(M_SHOW_SAVE_PANEL);
appMessage.AddMessenger("target", target); appMessage.AddMessenger("target", target);
appMessage.AddMessage("message", &result); appMessage.AddMessage("message", &result);
appMessage.AddString("title", "Save Playlist"); appMessage.AddString("title", B_TRANSLATE("Save Playlist"));
appMessage.AddString("label", "Save"); appMessage.AddString("label", B_TRANSLATE("Save"));
be_app->PostMessage(&appMessage); be_app->PostMessage(&appMessage);
break; break;
} }
@@ -250,34 +256,35 @@ PlaylistWindow::_CreateMenu(BRect& frame)
{ {
frame.bottom = 15; frame.bottom = 15;
BMenuBar* menuBar = new BMenuBar(frame, "main menu"); BMenuBar* menuBar = new BMenuBar(frame, "main menu");
BMenu* fileMenu = new BMenu("Playlist"); BMenu* fileMenu = new BMenu(B_TRANSLATE("Playlist"));
menuBar->AddItem(fileMenu); 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')); 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)); new BMessage(M_PLAYLIST_SAVE_AS), 'S', B_SHIFT_KEY));
// fileMenu->AddItem(new BMenuItem("Save", // fileMenu->AddItem(new BMenuItem("Save",
// new BMessage(M_PLAYLIST_SAVE), 'S')); // new BMessage(M_PLAYLIST_SAVE), 'S'));
fileMenu->AddSeparatorItem(); fileMenu->AddSeparatorItem();
fileMenu->AddItem(new BMenuItem("Close", fileMenu->AddItem(new BMenuItem(B_TRANSLATE("Close"),
new BMessage(B_QUIT_REQUESTED), 'W')); new BMessage(B_QUIT_REQUESTED), 'W'));
BMenu* editMenu = new BMenu("Edit"); BMenu* editMenu = new BMenu(B_TRANSLATE("Edit"));
fUndoMI = new BMenuItem("Undo", new BMessage(B_UNDO), 'Z'); fUndoMI = new BMenuItem(B_TRANSLATE("Undo"), new BMessage(B_UNDO), 'Z');
editMenu->AddItem(fUndoMI); 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->AddItem(fRedoMI);
editMenu->AddSeparatorItem(); editMenu->AddSeparatorItem();
editMenu->AddItem(new BMenuItem("Randomize", editMenu->AddItem(new BMenuItem(B_TRANSLATE("Randomize"),
new BMessage(M_PLAYLIST_RANDOMIZE), 'R')); new BMessage(M_PLAYLIST_RANDOMIZE), 'R'));
editMenu->AddSeparatorItem(); editMenu->AddSeparatorItem();
editMenu->AddItem(new BMenuItem("Remove (Del)", editMenu->AddItem(new BMenuItem(B_TRANSLATE("Remove (Del)"),
new BMessage(M_PLAYLIST_REMOVE)/*, B_DELETE, 0*/)); 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')); 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')); new BMessage(M_PLAYLIST_EMPTY), 'N'));
menuBar->AddItem(editMenu); menuBar->AddItem(editMenu);
@@ -297,20 +304,20 @@ PlaylistWindow::_ObjectChanged(const Notifier* object)
{ {
if (object == fCommandStack) { if (object == fCommandStack) {
// relable Undo item and update enabled status // relable Undo item and update enabled status
BString label("Undo"); BString label(B_TRANSLATE("Undo"));
fUndoMI->SetEnabled(fCommandStack->GetUndoName(label)); fUndoMI->SetEnabled(fCommandStack->GetUndoName(label));
if (fUndoMI->IsEnabled()) if (fUndoMI->IsEnabled())
fUndoMI->SetLabel(label.String()); fUndoMI->SetLabel(label.String());
else else
fUndoMI->SetLabel("<nothing to undo>"); fUndoMI->SetLabel(B_TRANSLATE("<nothing to undo>"));
// relable Redo item and update enabled status // relable Redo item and update enabled status
label.SetTo("Redo"); label.SetTo(B_TRANSLATE("Redo"));
fRedoMI->SetEnabled(fCommandStack->GetRedoName(label)); fRedoMI->SetEnabled(fCommandStack->GetRedoName(label));
if (fRedoMI->IsEnabled()) if (fRedoMI->IsEnabled())
fRedoMI->SetLabel(label.String()); fRedoMI->SetLabel(label.String());
else 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; const char* name;
if (message->FindRef("directory", &ref) != B_OK if (message->FindRef("directory", &ref) != B_OK
|| message->FindString("name", &name) != B_OK) { || message->FindString("name", &name) != B_OK) {
display_save_alert("Internal error (malformed message). " display_save_alert(B_TRANSLATE("Internal error (malformed message). "
"Saving the playlist failed."); "Saving the playlist failed."));
return; return;
} }
@@ -335,16 +342,16 @@ PlaylistWindow::_SavePlaylist(const BMessage* message)
if (origPath.InitCheck() != B_OK || tempPath.InitCheck() != B_OK if (origPath.InitCheck() != B_OK || tempPath.InitCheck() != B_OK
|| origPath.Append(name) != B_OK || origPath.Append(name) != B_OK
|| tempPath.Append(tempName.String()) != B_OK) { || tempPath.Append(tempName.String()) != B_OK) {
display_save_alert("Internal error (out of memory). " display_save_alert(B_TRANSLATE("Internal error (out of memory). "
"Saving the playlist failed."); "Saving the playlist failed."));
return; return;
} }
BEntry origEntry(origPath.Path()); BEntry origEntry(origPath.Path());
BEntry tempEntry(tempPath.Path()); BEntry tempEntry(tempPath.Path());
if (origEntry.InitCheck() != B_OK || tempEntry.InitCheck() != B_OK) { if (origEntry.InitCheck() != B_OK || tempEntry.InitCheck() != B_OK) {
display_save_alert("Internal error (out of memory). " display_save_alert(B_TRANSLATE("Internal error (out of memory). "
"Saving the playlist failed."); "Saving the playlist failed."));
return; return;
} }
@@ -392,7 +399,8 @@ PlaylistWindow::_SavePlaylist(BEntry& origEntry, BEntry& tempEntry,
BFile file(&tempEntry, B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY); BFile file(&tempEntry, B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY);
if (file.InitCheck() != B_OK) { 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()); errorMessage << strerror(file.InitCheck());
display_save_alert(errorMessage.String()); display_save_alert(errorMessage.String());
return; return;
@@ -400,8 +408,8 @@ PlaylistWindow::_SavePlaylist(BEntry& origEntry, BEntry& tempEntry,
AutoLocker<Playlist> lock(fPlaylist); AutoLocker<Playlist> lock(fPlaylist);
if (!lock.IsLocked()) { if (!lock.IsLocked()) {
display_save_alert("Internal error (locking failed). " display_save_alert(B_TRANSLATE("Internal error (locking failed). "
"Saving the playlist failed."); "Saving the playlist failed."));
return; return;
} }
@@ -10,10 +10,16 @@
#include <stdlib.h> #include <stdlib.h>
#include <Autolock.h> #include <Autolock.h>
#include <Catalog.h>
#include <Locale.h>
#include "Playlist.h" #include "Playlist.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-RandomizePLItemsCmd"
using std::nothrow; using std::nothrow;
@@ -93,7 +99,7 @@ RandomizePLItemsCommand::Undo()
void void
RandomizePLItemsCommand::GetName(BString& name) RandomizePLItemsCommand::GetName(BString& name)
{ {
name << "Randomize Entries"; name << B_TRANSLATE("Randomize Entries");
} }
@@ -10,10 +10,16 @@
#include <Alert.h> #include <Alert.h>
#include <Autolock.h> #include <Autolock.h>
#include <Catalog.h>
#include <Locale.h>
#include "Playlist.h" #include "Playlist.h"
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-RemovePLItemsCmd"
using std::nothrow; using std::nothrow;
@@ -106,13 +112,14 @@ RemovePLItemsCommand::Perform()
fMoveErrorShown = true; fMoveErrorShown = true;
BString message; BString message;
if (errorOnAllFiles) if (errorOnAllFiles)
message << "All "; message <<
B_TRANSLATE("All files could not be moved into Trash.");
else else
message << "Some "; message <<
message << "files could not be moved into Trash.\n\n"; B_TRANSLATE("Some files could not be moved into Trash.");
message << "Error: " << strerror(moveError); message << "\n\n" << B_TRANSLATE("Error: ") << strerror(moveError);
(new BAlert("Move Into Trash Error", message.String(), (new BAlert(B_TRANSLATE("Move Into Trash Error"), message.String(),
"OK", NULL, NULL, B_WIDTH_AS_USUAL, B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL,
B_WARNING_ALERT))->Go(NULL); B_WARNING_ALERT))->Go(NULL);
} }
} }
@@ -159,11 +166,17 @@ RemovePLItemsCommand::Undo()
void void
RemovePLItemsCommand::GetName(BString& name) RemovePLItemsCommand::GetName(BString& name)
{ {
if (fCount > 1) if (fMoveFilesToTrash) {
name << "Remove Entries"; if (fCount > 1)
name << B_TRANSLATE("Remove Entries into Trash");
else
name << B_TRANSLATE("Remove Entry into Trash");
}
else else
name << "Remove Entry"; {
if (fCount > 1)
if (fMoveFilesToTrash) name << B_TRANSLATE("Remove Entries");
name << " into Trash"; else
name << B_TRANSLATE("Remove Entry");
}
} }
@@ -14,9 +14,11 @@
#include <Box.h> #include <Box.h>
#include <Button.h> #include <Button.h>
#include <Catalog.h>
#include <CheckBox.h> #include <CheckBox.h>
#include <GridLayoutBuilder.h> #include <GridLayoutBuilder.h>
#include <GroupLayoutBuilder.h> #include <GroupLayoutBuilder.h>
#include <Locale.h>
#include <OptionPopUp.h> #include <OptionPopUp.h>
#include <SpaceLayoutItem.h> #include <SpaceLayoutItem.h>
#include <String.h> #include <String.h>
@@ -25,6 +27,10 @@
#include <View.h> #include <View.h>
#undef B_TRANSLATE_CONTEXT
#define B_TRANSLATE_CONTEXT "MediaPlayer-SettingsWindow"
enum { enum {
M_SETTINGS_CHANGED = 0x3000, M_SETTINGS_CHANGED = 0x3000,
@@ -41,7 +47,7 @@ enum {
SettingsWindow::SettingsWindow(BRect frame) 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_FLOATING_APP_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE
| B_AUTO_UPDATE_SIZE_LIMITS) | B_AUTO_UPDATE_SIZE_LIMITS)
@@ -54,11 +60,11 @@ SettingsWindow::SettingsWindow(BRect frame)
buttonBox->SetLayout(buttonLayout); buttonBox->SetLayout(buttonLayout);
BStringView* playModeLabel = new BStringView("stringViewPlayMode", BStringView* playModeLabel = new BStringView("stringViewPlayMode",
"Play mode"); B_TRANSLATE("Play mode"));
BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions", BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions",
"View options"); B_TRANSLATE("View options"));
BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg", BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg",
"Play background clips at"); B_TRANSLATE("Play background clips at"));
BAlignment alignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER); BAlignment alignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER);
playModeLabel->SetExplicitAlignment(alignment); playModeLabel->SetExplicitAlignment(alignment);
playModeLabel->SetFont(be_bold_font); playModeLabel->SetFont(be_bold_font);
@@ -68,60 +74,66 @@ SettingsWindow::SettingsWindow(BRect frame)
bgMoviesModeLabel->SetFont(be_bold_font); bgMoviesModeLabel->SetFont(be_bold_font);
fAutostartCB = new BCheckBox("chkboxAutostart", 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", fCloseWindowMoviesCB = new BCheckBox("chkBoxCloseWindowMovies",
"Close window when done playing movies", B_TRANSLATE("Close window when done playing movies"),
new BMessage(M_SETTINGS_CHANGED)); new BMessage(M_SETTINGS_CHANGED));
fCloseWindowSoundsCB = new BCheckBox("chkBoxCloseWindowSounds", fCloseWindowSoundsCB = new BCheckBox("chkBoxCloseWindowSounds",
"Close window when done playing sounds", B_TRANSLATE("Close window when done playing sounds"),
new BMessage(M_SETTINGS_CHANGED)); new BMessage(M_SETTINGS_CHANGED));
fLoopMoviesCB = new BCheckBox("chkBoxLoopMovie", 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", 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", fUseOverlaysCB = new BCheckBox("chkBoxUseOverlays",
"Use hardware video overlays if available", B_TRANSLATE("Use hardware video overlays if available"),
new BMessage(M_SETTINGS_CHANGED)); new BMessage(M_SETTINGS_CHANGED));
fScaleBilinearCB = new BCheckBox("chkBoxScaleBilinear", fScaleBilinearCB = new BCheckBox("chkBoxScaleBilinear",
"Scale movies smoothly (non-overlay mode)", B_TRANSLATE("Scale movies smoothly (non-overlay mode)"),
new BMessage(M_SETTINGS_CHANGED)); new BMessage(M_SETTINGS_CHANGED));
fScaleFullscreenControlsCB = new BCheckBox("chkBoxScaleControls", fScaleFullscreenControlsCB = new BCheckBox("chkBoxScaleControls",
"Scale controls in full-screen mode", B_TRANSLATE("Scale controls in full-screen mode"),
new BMessage(M_SETTINGS_CHANGED)); new BMessage(M_SETTINGS_CHANGED));
fSubtitleSizeOP = new BOptionPopUp("subtitleSize", fSubtitleSizeOP = new BOptionPopUp("subtitleSize",
"Subtitle size", new BMessage(M_SETTINGS_CHANGED)); B_TRANSLATE("Subtitle size"), new BMessage(M_SETTINGS_CHANGED));
fSubtitleSizeOP->AddOption("Small", mpSettings::SUBTITLE_SIZE_SMALL); fSubtitleSizeOP->AddOption(
fSubtitleSizeOP->AddOption("Medium", mpSettings::SUBTITLE_SIZE_MEDIUM); B_TRANSLATE("Small"), mpSettings::SUBTITLE_SIZE_SMALL);
fSubtitleSizeOP->AddOption("Large", mpSettings::SUBTITLE_SIZE_LARGE); fSubtitleSizeOP->AddOption(
B_TRANSLATE("Medium"), mpSettings::SUBTITLE_SIZE_MEDIUM);
fSubtitleSizeOP->AddOption(
B_TRANSLATE("Large"), mpSettings::SUBTITLE_SIZE_LARGE);
fSubtitlePlacementOP = new BOptionPopUp("subtitlePlacement", fSubtitlePlacementOP = new BOptionPopUp("subtitlePlacement",
"Subtitle placement", new BMessage(M_SETTINGS_CHANGED)); B_TRANSLATE("Subtitle placement"), new BMessage(M_SETTINGS_CHANGED));
fSubtitlePlacementOP->AddOption("Bottom of video", fSubtitlePlacementOP->AddOption(B_TRANSLATE("Bottom of video"),
mpSettings::SUBTITLE_PLACEMENT_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); mpSettings::SUBTITLE_PLACEMENT_BOTTOM_OF_SCREEN);
fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume", fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
"Full volume", new BMessage(M_SETTINGS_CHANGED)); B_TRANSLATE("Full volume"), new BMessage(M_SETTINGS_CHANGED));
fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume", fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume",
"Low volume", new BMessage(M_SETTINGS_CHANGED)); B_TRANSLATE("Low volume"), new BMessage(M_SETTINGS_CHANGED));
fMutedVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume", 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)); new BMessage(M_SETTINGS_REVERT));
BButton* cancelButton = new BButton("cancel", "Cancel", BButton* cancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
new BMessage(M_SETTINGS_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)); new BMessage(M_SETTINGS_SAVE));
okButton->MakeDefault(true); okButton->MakeDefault(true);