Updated to use B_TRANSLATE* macros. relates to #5408.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36690 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Matt Madia 2010-05-07 00:06:01 +00:00
parent 16a0078818
commit 176fb40f5b
2 changed files with 147 additions and 128 deletions

View File

@ -2,7 +2,7 @@
//
// Copyright (c) 2003, OpenBeOS
//
// This software is part of the OpenBeOS distribution and is covered
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//
//
@ -10,7 +10,7 @@
// Author: Sikosis, Jérôme Duval
// Description: Media Preferences
// Created : June 25, 2003
//
//
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
@ -36,17 +36,17 @@
#define TR_CONTEXT "Media views"
BarView::BarView()
BarView::BarView()
: BView ("barView", B_WILL_DRAW ),
fDisplay(true)
{
}
void
void
BarView::Draw(BRect updateRect)
{
BRect r = Bounds();
if (fDisplay) {
// Display the 3D Look Divider Bar
SetHighColor(140,140,140,0);
@ -68,8 +68,9 @@ SettingsView::SettingsView (bool isVideo)
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BBox *defaultsBox = new BBox("defaults");
defaultsBox->SetLabel(fIsVideo ? TR("Default nodes") : TR("Defaults"));
defaultsBox->SetLabel(fIsVideo ? B_TRANSLATE("Default nodes")
: B_TRANSLATE("Defaults"));
// create the default box
BGroupLayout* defaultBoxLayout = new BGroupLayout(B_VERTICAL, 5);
defaultBoxLayout->SetInsets(10,10,10,10);
@ -81,20 +82,22 @@ SettingsView::SettingsView (bool isVideo)
defaultsBox->GetLayout()->AddView(inputField);
defaultsBox->GetLayout()->AddView(outputField);
float divider = StringWidth(fIsVideo ? TR("Video output:")
: TR("Audio output:")) + 5;
float divider = StringWidth(fIsVideo ? B_TRANSLATE("Video output:")
: B_TRANSLATE("Audio output:")) + 5;
fMenu1 = new BPopUpMenu("<none>");
fMenu1->SetLabelFromMarked(true);
BMenuField *menuField1 = new BMenuField("menuField1",
fIsVideo ? TR("Video input:") : TR("Audio input:"), fMenu1, NULL);
fIsVideo ? B_TRANSLATE("Video input:")
: B_TRANSLATE("Audio input:"), fMenu1, NULL);
menuField1->SetDivider(divider);
fMenu2 = new BPopUpMenu("<none>");
fMenu2->SetLabelFromMarked(true);
BMenuField *menuField2 = new BMenuField("menuField2",
fIsVideo ? TR("Video output:") : TR("Audio output:"), fMenu2, NULL);
fIsVideo ? B_TRANSLATE("Video output:")
: B_TRANSLATE("Audio output:"), fMenu2, NULL);
menuField2->SetDivider(divider);
inputField->GroupLayout()->AddView(menuField1);
outputField->GroupLayout()->AddView(menuField2);
@ -103,70 +106,75 @@ SettingsView::SettingsView (bool isVideo)
fMenu3 = new BPopUpMenu("<none>");
fMenu3->SetLabelFromMarked(true);
menuField3 = new BMenuField("menuField3",
TR("Channel:"), fMenu3, NULL);
B_TRANSLATE("Channel:"), fMenu3, NULL);
outputField->GroupLayout()->AddView(menuField3);
menuField3->SetDivider(StringWidth(TR("Channel:"))+5);
menuField3->SetDivider(StringWidth(B_TRANSLATE("Channel:"))+5);
}
rgb_color red_color = {222, 32, 33};
fRestartView = new BStringView("restartStringView",
TR("Restart the media server to apply changes."));
B_TRANSLATE("Restart the media server to apply changes."));
fRestartView->SetHighColor(red_color);
defaultsBox->AddChild(fRestartView);
fRestartView->Hide();
// create the realtime box
BBox *realtimeBox = new BBox("realtime");
realtimeBox->SetLabel(TR("Real-time"));
realtimeBox->SetLabel(B_TRANSLATE("Real-time"));
BMessage *message = new BMessage(ML_ENABLE_REAL_TIME);
message->AddBool("isVideo", fIsVideo);
fRealtimeCheckBox = new BCheckBox("realtimeCheckBox",
fIsVideo ? TR("Enable real-time video") : TR("Enable real-time audio"),
fIsVideo ? B_TRANSLATE("Enable real-time video")
: B_TRANSLATE("Enable real-time audio"),
message);
uint32 flags;
BMediaRoster::Roster()->GetRealtimeFlags(&flags);
if (flags & (fIsVideo ? B_MEDIA_REALTIME_VIDEO : B_MEDIA_REALTIME_AUDIO))
fRealtimeCheckBox->SetValue(B_CONTROL_ON);
BTextView *textView = new BTextView("stringView");
textView->Insert(fIsVideo ? TR("Enabling real-time video allows system to "
textView->Insert(fIsVideo ? B_TRANSLATE(
"Enabling real-time video allows system to "
"perform video operations as fast and smoothly as possible. It "
"achieves optimum performance by using more RAM."
"\n\nOnly enable this feature if you need the lowest latency possible.")
: TR("Enabling real-time audio allows system to record and play audio "
: B_TRANSLATE(
"Enabling real-time audio allows system to record and play audio "
"as fast as possible. It achieves this performance by using more CPU and RAM."
"\n\nOnly enable this feature if you need the lowest latency possible."));
textView->MakeEditable(false);
textView->MakeSelectable(false);
textView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
BGroupLayout* realtimeBoxLayout = new BGroupLayout(B_VERTICAL, 5);
realtimeBoxLayout->SetInsets(10,10,10,10);
realtimeBox->SetLayout(realtimeBoxLayout);
realtimeBoxLayout->AddItem(BSpaceLayoutItem::CreateVerticalStrut(5));
realtimeBoxLayout->AddView(fRealtimeCheckBox);
realtimeBoxLayout->AddView(textView);
// create the bottom line: volumen in deskbar checkbox and restart button
BGroupView* bottomView = new BGroupView(B_HORIZONTAL);
BButton *restartButton = new BButton("restartButton",
TR("Restart media services"), new BMessage(ML_RESTART_MEDIA_SERVER));
BButton *restartButton = new BButton("restartButton",
B_TRANSLATE("Restart media services"),
new BMessage(ML_RESTART_MEDIA_SERVER));
if (!fIsVideo) {
fVolumeCheckBox = new BCheckBox("volumeCheckBox",
TR("Show volume control on Deskbar"), new BMessage(ML_SHOW_VOLUME_CONTROL));
fVolumeCheckBox = new BCheckBox("volumeCheckBox",
B_TRANSLATE("Show volume control on Deskbar"),
new BMessage(ML_SHOW_VOLUME_CONTROL));
bottomView->GroupLayout()->AddView(fVolumeCheckBox);
if (BDeskbar().HasItem("MediaReplicant"))
fVolumeCheckBox->SetValue(B_CONTROL_ON);
fVolumeCheckBox->SetValue(B_CONTROL_ON);
}
else{
bottomView->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
}
bottomView->GroupLayout()->AddView(restartButton);
// compose all stuff
BGroupLayout* rootlayout = new BGroupLayout(B_VERTICAL, 5);
SetLayout(rootlayout);
@ -198,7 +206,7 @@ void
SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID)
{
BMenu *menu = isInput ? fMenu1 : fMenu2;
for (int32 i = 0; i < menu->CountItems(); i++) {
SettingsItem *item = static_cast<SettingsItem *>(menu->ItemAt(i));
if (item->fInfo && item->fInfo->addon == info.addon && item->fInfo->flavor_id == info.flavor_id) {
@ -206,7 +214,7 @@ SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID)
break;
}
}
if (!fIsVideo&&!isInput&&outputID>-1) {
BMenuItem *item;
while ((item = fMenu3->RemoveItem((int32)0)) != NULL)
@ -215,12 +223,12 @@ SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID)
media_node node;
media_node_id node_id;
status_t err;
if (roster->GetInstancesFor(info.addon, info.flavor_id, &node_id)!=B_OK)
if (roster->GetInstancesFor(info.addon, info.flavor_id, &node_id)!=B_OK)
err = roster->InstantiateDormantNode(info, &node, B_FLAVOR_IS_GLOBAL);
else
err = roster->GetNodeFor(node_id, &node);
if (err == B_OK) {
if (err == B_OK) {
media_input inputs[16];
int32 inputCount = 16;
if (roster->GetAllInputsFor(node, inputs, 16, &inputCount)==B_OK) {
@ -238,12 +246,12 @@ SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID)
}
}
SettingsItem::SettingsItem(dormant_node_info *info, BMessage *message,
SettingsItem::SettingsItem(dormant_node_info *info, BMessage *message,
char shortcut, uint32 modifiers)
: BMenuItem(info->name, message, shortcut, modifiers),
fInfo(info)
{
}
@ -256,13 +264,13 @@ SettingsItem::Invoke(BMessage *message)
}
Settings2Item::Settings2Item(dormant_node_info *info, media_input *input, BMessage *message,
Settings2Item::Settings2Item(dormant_node_info *info, media_input *input, BMessage *message,
char shortcut, uint32 modifiers)
: BMenuItem(input->name, message, shortcut, modifiers),
fInfo(info),
fInput(input)
{
}

View File

@ -40,7 +40,7 @@ const uint32 ML_INIT_MEDIA = 'MlIM';
// MediaWindow - Constructor
MediaWindow::MediaWindow(BRect frame)
: BWindow (frame, TR("Media"), B_TITLED_WINDOW,
: BWindow (frame, B_TRANSLATE("Media"), B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
fCurrentNode(NULL),
fParamWeb(NULL),
@ -69,17 +69,17 @@ MediaWindow::~MediaWindow()
delete static_cast<dormant_node_info *>(fVideoOutputs.ItemAt(i));
for (int i = 0; i<fVideoInputs.CountItems(); i++)
delete static_cast<dormant_node_info *>(fVideoInputs.ItemAt(i));
BMediaRoster *roster = BMediaRoster::Roster();
if (roster && fCurrentNode)
roster->ReleaseNode(*fCurrentNode);
char buffer[512];
BRect rect = Frame();
PRINT_OBJECT(rect);
sprintf(buffer, "# MediaPrefs Settings\n rect = %i,%i,%i,%i\n",
int(rect.left), int(rect.top), int(rect.right), int(rect.bottom));
BPath path;
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
path.Append(SETTINGS_FILE);
@ -100,20 +100,20 @@ MediaWindow::FindNodes(media_type type, uint64 kind, BList &list)
media_format *format1 = NULL, *format2 = NULL;
BMediaRoster *roster = BMediaRoster::Roster();
format.type = type;
if (kind & B_PHYSICAL_OUTPUT)
format1 = &format;
else if (kind & B_PHYSICAL_INPUT)
format2 = &format;
else
return;
if (roster->GetDormantNodes(node_info, &node_info_count, format1, format2,
NULL, kind)!=B_OK) {
fprintf(stderr, "error\n");
return;
}
for (int32 i = 0; i<node_info_count; i++) {
PRINT(("node : %s, media_addon %i, flavor_id %i\n",
node_info[i].name, node_info[i].addon, node_info[i].flavor_id));
@ -186,7 +186,7 @@ MediaWindow::InitWindow(void)
fListView = new BListView("media_list_view");
fListView->SetSelectionMessage(new BMessage(ML_SELECTED_NODE));
// Add ScrollView to Media Menu
BScrollView *scrollView = new BScrollView("listscroller",
fListView, 0, false, false, B_FANCY_BORDER);
@ -198,20 +198,20 @@ MediaWindow::InitWindow(void)
B_PLAIN_BORDER);
SetLayout(new BGroupLayout(B_HORIZONTAL));
GetLayout()->AddView(fBox);
// StringViews
rgb_color titleFontColor = { 0, 0, 0, 0 };
fTitleView = new BStringView("AudioSettings",
TR("Audio settings"), B_WILL_DRAW);
B_TRANSLATE("Audio settings"), B_WILL_DRAW);
fTitleView->SetFont(be_bold_font);
fTitleView->SetHighColor(titleFontColor);
fContentView = new BBox("contentView", B_WILL_DRAW | B_FRAME_EVENTS,
B_NO_BORDER);
fAudioView = new SettingsView(false);
fVideoView = new SettingsView(true);
fBar = new BarView();
BGroupView* titleGroupView = new BGroupView(B_HORIZONTAL);
titleGroupView->GroupLayout()->AddView(fTitleView);
@ -223,15 +223,15 @@ MediaWindow::InitWindow(void)
rightView->GroupLayout()->AddView(titleGroupView);
rightView->GroupLayout()->AddView(fBar, 0);
rightView->GroupLayout()->AddView(fContentView);
BGroupLayout* rootLayout = new BGroupLayout(B_HORIZONTAL);
rootLayout->SetInsets(14, 14, 14, 14);
fBox->SetLayout(rootLayout);
rootLayout->AddView(scrollView);
rootLayout->AddView(rightView);
// Start the window
fInitCheck = InitMedia(true);
if (fInitCheck != B_OK) {
@ -251,37 +251,41 @@ MediaWindow::InitMedia(bool first)
{
status_t err = B_OK;
BMediaRoster *roster = BMediaRoster::Roster(&err);
if (first && err != B_OK) {
BAlert *alert = new BAlert("start_media_server",
TR("Could not connect to the media server.\n"
"Would you like to start it ?"), TR("Quit"),
TR("Start media server"), NULL,
B_TRANSLATE("Could not connect to the media server.\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)
return B_ERROR;
fAlert = new MediaAlert(BRect(0, 0, 300, 60),
"restart_alert", TR("Restarting media services\nStarting media server" B_UTF8_ELLIPSIS "\n"));
"restart_alert", B_TRANSLATE(
"Restarting media services\nStarting media server"
B_UTF8_ELLIPSIS "\n"));
fAlert->Show();
Show();
launch_media_server();
}
Lock();
bool isVideoSelected = true;
if (!first && fListView->ItemAt(0) && fListView->ItemAt(0)->IsSelected())
isVideoSelected = false;
if ((!first || (first && err) ) && fAlert) {
BAutolock locker(fAlert);
if (locker.IsLocked())
fAlert->TextView()->SetText(TR("Ready for use" B_UTF8_ELLIPSIS));
fAlert->TextView()->SetText(
B_TRANSLATE("Ready for use" B_UTF8_ELLIPSIS));
}
void *listItem;
while ((listItem = fListView->RemoveItem((int32)0)))
delete static_cast<MediaListItem *>(listItem);
@ -293,7 +297,7 @@ MediaWindow::InitMedia(bool first)
delete static_cast<dormant_node_info *>(listItem);
while ((listItem = fVideoInputs.RemoveItem((int32)0)))
delete static_cast<dormant_node_info *>(listItem);
MediaListItem *item, *mixer, *audio, *video;
// Grab Media Info
@ -312,25 +316,25 @@ MediaWindow::InitMedia(bool first)
AddNodes(fVideoInputs, true);
AddNodes(fAudioOutputs, false);
AddNodes(fAudioInputs, false);
fAudioView->AddNodes(fAudioOutputs, false);
fAudioView->AddNodes(fAudioInputs, true);
fVideoView->AddNodes(fVideoOutputs, false);
fVideoView->AddNodes(fVideoInputs, true);
fListView->AddItem(audio = new MediaListItem("Audio settings", 0, false, &fIcons));
fListView->AddItem(video = new MediaListItem("Video settings", 0, true, &fIcons));
fListView->AddItem(mixer = new MediaListItem("Audio mixer", 1, false, &fIcons));
mixer->SetAudioMixer(true);
fListView->SortItems(&MediaListItem::Compare);
media_node default_node;
dormant_node_info node_info;
int32 outputID;
BString outputName;
if (roster->GetAudioInput(&default_node)==B_OK) {
roster->GetDormantNodeFor(default_node, &node_info);
item = FindMediaListItem(&node_info);
@ -338,7 +342,7 @@ MediaWindow::InitMedia(bool first)
item->SetDefault(true, true);
fAudioView->SetDefault(node_info, true);
}
if (roster->GetAudioOutput(&default_node, &outputID, &outputName)==B_OK) {
roster->GetDormantNodeFor(default_node, &node_info);
item = FindMediaListItem(&node_info);
@ -346,7 +350,7 @@ MediaWindow::InitMedia(bool first)
item->SetDefault(true, false);
fAudioView->SetDefault(node_info, false, outputID);
}
if (roster->GetVideoInput(&default_node)==B_OK) {
roster->GetDormantNodeFor(default_node, &node_info);
item = FindMediaListItem(&node_info);
@ -354,7 +358,7 @@ MediaWindow::InitMedia(bool first)
item->SetDefault(true, true);
fVideoView->SetDefault(node_info, true);
}
if (roster->GetVideoOutput(&default_node)==B_OK) {
roster->GetDormantNodeFor(default_node, &node_info);
item = FindMediaListItem(&node_info);
@ -362,7 +366,7 @@ MediaWindow::InitMedia(bool first)
item->SetDefault(true, false);
fVideoView->SetDefault(node_info, false);
}
if (first) {
fListView->Select(fListView->IndexOf(mixer));
} else {
@ -370,21 +374,21 @@ MediaWindow::InitMedia(bool first)
fAudioView->fRestartView->Hide();
if (!fVideoView->fRestartView->IsHidden())
fVideoView->fRestartView->Hide();
if (isVideoSelected)
fListView->Select(fListView->IndexOf(video));
else
fListView->Select(fListView->IndexOf(audio));
}
if (fAlert) {
snooze(800000);
fAlert->PostMessage(B_QUIT_REQUESTED);
}
fAlert = NULL;
Unlock();
return B_OK;
}
@ -418,7 +422,8 @@ MediaWindow::FrameResized (float width, float height)
void
ErrorAlert(char* errorMessage) {
printf("%s\n", errorMessage);
BAlert *alert = new BAlert("BAlert", errorMessage, TR("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
BAlert *alert = new BAlert("BAlert", errorMessage, B_TRANSLATE("OK"),
NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT);
alert->Go();
exit(1);
}
@ -440,11 +445,11 @@ MediaWindow::MessageReceived (BMessage *message)
if (message->FindInt32("index", &index)!=B_OK)
break;
Settings2Item *item = static_cast<Settings2Item *>(fAudioView->fMenu3->ItemAt(index));
if (item) {
BMediaRoster *roster = BMediaRoster::Roster();
roster->SetAudioOutput(*item->fInput);
if (fAudioView->fRestartView->IsHidden())
fAudioView->fRestartView->Show();
} else
@ -465,7 +470,7 @@ MediaWindow::MessageReceived (BMessage *message)
SettingsView *settingsView = isVideo ? fVideoView : fAudioView;
BMenu *menu = isInput ? settingsView->fMenu1 : settingsView->fMenu2;
SettingsItem *item = static_cast<SettingsItem *>(menu->ItemAt(index));
if (item) {
PRINT(("isVideo %i isInput %i\n", isVideo, isInput));
BMediaRoster *roster = BMediaRoster::Roster();
@ -482,7 +487,7 @@ MediaWindow::MessageReceived (BMessage *message)
fAudioView->SetDefault(*item->fInfo, false, 0);
}
}
MediaListItem *oldListItem = NULL;
for (int32 j = 0; j<fListView->CountItems(); j++) {
oldListItem = static_cast<MediaListItem *>(fListView->ItemAt(j));
@ -494,14 +499,14 @@ MediaWindow::MessageReceived (BMessage *message)
oldListItem->SetDefault(false, isInput);
else
fprintf(stderr, "oldListItem not found\n");
MediaListItem *listItem = FindMediaListItem(item->fInfo);
if (listItem) {
listItem->SetDefault(true, isInput);
} else
fprintf(stderr, "MediaListItem not found\n");
fListView->Invalidate();
if (settingsView->fRestartView->IsHidden())
settingsView->fRestartView->Show();
} else
@ -530,13 +535,15 @@ MediaWindow::MessageReceived (BMessage *message)
status = deskbar.AddItem(&ref, &id);
if (status != B_OK) {
fprintf(stderr, TR("Couldn't add volume control in Deskbar: %s\n"),
fprintf(stderr, B_TRANSLATE(
"Couldn't add volume control in Deskbar: %s\n"),
strerror(status));
}
} else {
status_t status = deskbar.RemoveItem("MediaReplicant");
if (status != B_OK) {
fprintf(stderr, TR("Couldn't remove volume control in Deskbar: %s\n"),
fprintf(stderr, B_TRANSLATE(
"Couldn't remove volume control in Deskbar: %s\n"),
strerror(status));
}
}
@ -559,11 +566,11 @@ MediaWindow::MessageReceived (BMessage *message)
roster->SetRealtimeFlags(flags);
}
break;
case B_MEDIA_WEB_CHANGED:
case B_MEDIA_WEB_CHANGED:
case ML_SELECTED_NODE:
{
PRINT_OBJECT(*message);
MediaListItem *item = static_cast<MediaListItem *>(fListView->ItemAt(fListView->CurrentSelection()));
if (!item)
break;
@ -582,46 +589,47 @@ MediaWindow::MessageReceived (BMessage *message)
if (fParamWeb)
delete fParamWeb;
fParamWeb = NULL;
fTitleView->SetText(item->GetLabel());
if (item->OutlineLevel() == 0) {
if (item->IsVideo())
fContentView->AddChild(fVideoView);
else
fContentView->AddChild(fAudioView);
} else {
if (!fCurrentNode)
fCurrentNode = new media_node();
media_node_id node_id;
if (item->IsAudioMixer())
roster->GetAudioMixer(fCurrentNode);
else if (roster->GetInstancesFor(item->fInfo->addon, item->fInfo->flavor_id, &node_id)!=B_OK)
else if (roster->GetInstancesFor(item->fInfo->addon, item->fInfo->flavor_id, &node_id)!=B_OK)
roster->InstantiateDormantNode(*(item->fInfo), fCurrentNode, B_FLAVOR_IS_GLOBAL);
else
roster->GetNodeFor(node_id, fCurrentNode);
if (roster->GetParameterWebFor(*fCurrentNode, &fParamWeb)==B_OK
&& (paramView = BMediaTheme::PreferredTheme()->ViewFor(fParamWeb)) != NULL) {
fContentView->AddChild(paramView);
paramView->ResizeTo(fContentView->Bounds().Width(), fContentView->Bounds().Height() - 10);
roster->StartWatching(this, *fCurrentNode, B_MEDIA_WILDCARD);
} else {
if (fParamWeb)
delete fParamWeb;
fParamWeb = NULL;
BRect bounds = fContentView->Bounds();
BStringView* stringView = new BStringView(bounds,
"noControls", TR("This hardware has no controls."), B_FOLLOW_V_CENTER | B_FOLLOW_H_CENTER);
BStringView* stringView = new BStringView(bounds,
"noControls", B_TRANSLATE("This hardware has no controls."),
B_FOLLOW_V_CENTER | B_FOLLOW_H_CENTER);
stringView->ResizeToPreferred();
fContentView->AddChild(stringView);
stringView->MoveBy((bounds.Width()-stringView->Bounds().Width())/2,
stringView->MoveBy((bounds.Width()-stringView->Bounds().Width())/2,
(bounds.Height()-stringView->Bounds().Height())/2);
}
}
bool barChanged = (item->OutlineLevel() == 0 || fParamWeb == NULL || fParamWeb->CountGroups()<2);
if (barChanged != fBar->fDisplay) {
fBar->fDisplay = barChanged;
@ -634,10 +642,11 @@ MediaWindow::MessageReceived (BMessage *message)
PRINT_OBJECT(*message);
const char *mimeSig;
if (fAlert && message->FindString("be:signature", &mimeSig)==B_OK
&& (strcmp(mimeSig, "application/x-vnd.Be.addon-host")==0
&& (strcmp(mimeSig, "application/x-vnd.Be.addon-host")==0
|| strcmp(mimeSig, "application/x-vnd.Be.media-server")==0)) {
fAlert->Lock();
fAlert->TextView()->SetText(TR("Starting media server" B_UTF8_ELLIPSIS));
fAlert->TextView()->SetText(
B_TRANSLATE("Starting media server" B_UTF8_ELLIPSIS));
fAlert->Unlock();
}
}
@ -647,14 +656,14 @@ MediaWindow::MessageReceived (BMessage *message)
PRINT_OBJECT(*message);
const char *mimeSig;
if (message->FindString("be:signature", &mimeSig)==B_OK) {
if (strcmp(mimeSig, "application/x-vnd.Be.addon-host")==0
if (strcmp(mimeSig, "application/x-vnd.Be.addon-host")==0
|| strcmp(mimeSig, "application/x-vnd.Be.media-server")==0) {
BMediaRoster* roster = BMediaRoster::CurrentRoster();
if (roster&&roster->Lock())
roster->Quit();
}
}
}
break;
default:
@ -664,27 +673,29 @@ MediaWindow::MessageReceived (BMessage *message)
}
status_t
MediaWindow::RestartMediaServices(void *data)
MediaWindow::RestartMediaServices(void *data)
{
MediaWindow *window = (MediaWindow *)data;
window->fAlert = new MediaAlert(BRect(0, 0, 300, 60),
"restart_alert", TR("Restarting media services\nShutting down media server\n"));
window->fAlert = new MediaAlert(BRect(0, 0, 300, 60),
"restart_alert", B_TRANSLATE(
"Restarting media services\nShutting down media server\n"));
window->fAlert->Show();
shutdown_media_server(B_INFINITE_TIMEOUT, MediaWindow::UpdateProgress, window->fAlert);
{
BAutolock locker(window->fAlert);
if (locker.IsLocked())
window->fAlert->TextView()->SetText(TR("Starting media server" B_UTF8_ELLIPSIS));
window->fAlert->TextView()->SetText(
B_TRANSLATE("Starting media server" B_UTF8_ELLIPSIS));
}
launch_media_server();
return window->PostMessage(ML_INIT_MEDIA);
}
bool
bool
MediaWindow::UpdateProgress(int stage, const char * message, void * cookie)
{
MediaAlert *alert = static_cast<MediaAlert*>(cookie);
@ -692,22 +703,22 @@ MediaWindow::UpdateProgress(int stage, const char * message, void * cookie)
const char *string = "Unknown stage";
switch (stage) {
case 10:
string = TR("Stopping media server" B_UTF8_ELLIPSIS);
string = B_TRANSLATE("Stopping media server" B_UTF8_ELLIPSIS);
break;
case 20:
string = TR("Telling media_addon_server to quit.");
string = B_TRANSLATE("Telling media_addon_server to quit.");
break;
case 40:
string = TR("Waiting for media_server to quit.");
string = B_TRANSLATE("Waiting for media_server to quit.");
break;
case 70:
string = TR("Cleaning up.");
string = B_TRANSLATE("Cleaning up.");
break;
case 100:
string = TR("Done shutting down.");
string = B_TRANSLATE("Done shutting down.");
break;
}
BAutolock locker(alert);
if (locker.IsLocked())
alert->TextView()->SetText(string);