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:
@@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// Copyright (c) 2003, OpenBeOS
|
// 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.
|
// by the OpenBeOS license.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
// Author: Sikosis, Jérôme Duval
|
// Author: Sikosis, Jérôme Duval
|
||||||
// Description: Media Preferences
|
// Description: Media Preferences
|
||||||
// Created : June 25, 2003
|
// Created : June 25, 2003
|
||||||
//
|
//
|
||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||||
|
|
||||||
|
|
||||||
@@ -36,17 +36,17 @@
|
|||||||
|
|
||||||
#define TR_CONTEXT "Media views"
|
#define TR_CONTEXT "Media views"
|
||||||
|
|
||||||
BarView::BarView()
|
BarView::BarView()
|
||||||
: BView ("barView", B_WILL_DRAW ),
|
: BView ("barView", B_WILL_DRAW ),
|
||||||
fDisplay(true)
|
fDisplay(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
BarView::Draw(BRect updateRect)
|
BarView::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
BRect r = Bounds();
|
BRect r = Bounds();
|
||||||
|
|
||||||
if (fDisplay) {
|
if (fDisplay) {
|
||||||
// Display the 3D Look Divider Bar
|
// Display the 3D Look Divider Bar
|
||||||
SetHighColor(140,140,140,0);
|
SetHighColor(140,140,140,0);
|
||||||
@@ -68,8 +68,9 @@ SettingsView::SettingsView (bool isVideo)
|
|||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
BBox *defaultsBox = new BBox("defaults");
|
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
|
// create the default box
|
||||||
BGroupLayout* defaultBoxLayout = new BGroupLayout(B_VERTICAL, 5);
|
BGroupLayout* defaultBoxLayout = new BGroupLayout(B_VERTICAL, 5);
|
||||||
defaultBoxLayout->SetInsets(10,10,10,10);
|
defaultBoxLayout->SetInsets(10,10,10,10);
|
||||||
@@ -81,20 +82,22 @@ SettingsView::SettingsView (bool isVideo)
|
|||||||
defaultsBox->GetLayout()->AddView(inputField);
|
defaultsBox->GetLayout()->AddView(inputField);
|
||||||
defaultsBox->GetLayout()->AddView(outputField);
|
defaultsBox->GetLayout()->AddView(outputField);
|
||||||
|
|
||||||
float divider = StringWidth(fIsVideo ? TR("Video output:")
|
float divider = StringWidth(fIsVideo ? B_TRANSLATE("Video output:")
|
||||||
: TR("Audio output:")) + 5;
|
: B_TRANSLATE("Audio output:")) + 5;
|
||||||
fMenu1 = new BPopUpMenu("<none>");
|
fMenu1 = new BPopUpMenu("<none>");
|
||||||
fMenu1->SetLabelFromMarked(true);
|
fMenu1->SetLabelFromMarked(true);
|
||||||
BMenuField *menuField1 = new BMenuField("menuField1",
|
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);
|
menuField1->SetDivider(divider);
|
||||||
|
|
||||||
fMenu2 = new BPopUpMenu("<none>");
|
fMenu2 = new BPopUpMenu("<none>");
|
||||||
fMenu2->SetLabelFromMarked(true);
|
fMenu2->SetLabelFromMarked(true);
|
||||||
BMenuField *menuField2 = new BMenuField("menuField2",
|
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);
|
menuField2->SetDivider(divider);
|
||||||
|
|
||||||
inputField->GroupLayout()->AddView(menuField1);
|
inputField->GroupLayout()->AddView(menuField1);
|
||||||
outputField->GroupLayout()->AddView(menuField2);
|
outputField->GroupLayout()->AddView(menuField2);
|
||||||
|
|
||||||
@@ -103,70 +106,75 @@ SettingsView::SettingsView (bool isVideo)
|
|||||||
fMenu3 = new BPopUpMenu("<none>");
|
fMenu3 = new BPopUpMenu("<none>");
|
||||||
fMenu3->SetLabelFromMarked(true);
|
fMenu3->SetLabelFromMarked(true);
|
||||||
menuField3 = new BMenuField("menuField3",
|
menuField3 = new BMenuField("menuField3",
|
||||||
TR("Channel:"), fMenu3, NULL);
|
B_TRANSLATE("Channel:"), fMenu3, NULL);
|
||||||
outputField->GroupLayout()->AddView(menuField3);
|
outputField->GroupLayout()->AddView(menuField3);
|
||||||
menuField3->SetDivider(StringWidth(TR("Channel:"))+5);
|
menuField3->SetDivider(StringWidth(B_TRANSLATE("Channel:"))+5);
|
||||||
}
|
}
|
||||||
|
|
||||||
rgb_color red_color = {222, 32, 33};
|
rgb_color red_color = {222, 32, 33};
|
||||||
fRestartView = new BStringView("restartStringView",
|
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);
|
fRestartView->SetHighColor(red_color);
|
||||||
defaultsBox->AddChild(fRestartView);
|
defaultsBox->AddChild(fRestartView);
|
||||||
fRestartView->Hide();
|
fRestartView->Hide();
|
||||||
|
|
||||||
// create the realtime box
|
// create the realtime box
|
||||||
BBox *realtimeBox = new BBox("realtime");
|
BBox *realtimeBox = new BBox("realtime");
|
||||||
realtimeBox->SetLabel(TR("Real-time"));
|
realtimeBox->SetLabel(B_TRANSLATE("Real-time"));
|
||||||
|
|
||||||
BMessage *message = new BMessage(ML_ENABLE_REAL_TIME);
|
BMessage *message = new BMessage(ML_ENABLE_REAL_TIME);
|
||||||
message->AddBool("isVideo", fIsVideo);
|
message->AddBool("isVideo", fIsVideo);
|
||||||
fRealtimeCheckBox = new BCheckBox("realtimeCheckBox",
|
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);
|
message);
|
||||||
|
|
||||||
uint32 flags;
|
uint32 flags;
|
||||||
BMediaRoster::Roster()->GetRealtimeFlags(&flags);
|
BMediaRoster::Roster()->GetRealtimeFlags(&flags);
|
||||||
if (flags & (fIsVideo ? B_MEDIA_REALTIME_VIDEO : B_MEDIA_REALTIME_AUDIO))
|
if (flags & (fIsVideo ? B_MEDIA_REALTIME_VIDEO : B_MEDIA_REALTIME_AUDIO))
|
||||||
fRealtimeCheckBox->SetValue(B_CONTROL_ON);
|
fRealtimeCheckBox->SetValue(B_CONTROL_ON);
|
||||||
|
|
||||||
BTextView *textView = new BTextView("stringView");
|
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 "
|
"perform video operations as fast and smoothly as possible. It "
|
||||||
"achieves optimum performance by using more RAM."
|
"achieves optimum performance by using more RAM."
|
||||||
"\n\nOnly enable this feature if you need the lowest latency possible.")
|
"\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."
|
"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."));
|
"\n\nOnly enable this feature if you need the lowest latency possible."));
|
||||||
textView->MakeEditable(false);
|
textView->MakeEditable(false);
|
||||||
textView->MakeSelectable(false);
|
textView->MakeSelectable(false);
|
||||||
textView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
textView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
BGroupLayout* realtimeBoxLayout = new BGroupLayout(B_VERTICAL, 5);
|
BGroupLayout* realtimeBoxLayout = new BGroupLayout(B_VERTICAL, 5);
|
||||||
realtimeBoxLayout->SetInsets(10,10,10,10);
|
realtimeBoxLayout->SetInsets(10,10,10,10);
|
||||||
realtimeBox->SetLayout(realtimeBoxLayout);
|
realtimeBox->SetLayout(realtimeBoxLayout);
|
||||||
|
|
||||||
realtimeBoxLayout->AddItem(BSpaceLayoutItem::CreateVerticalStrut(5));
|
realtimeBoxLayout->AddItem(BSpaceLayoutItem::CreateVerticalStrut(5));
|
||||||
realtimeBoxLayout->AddView(fRealtimeCheckBox);
|
realtimeBoxLayout->AddView(fRealtimeCheckBox);
|
||||||
realtimeBoxLayout->AddView(textView);
|
realtimeBoxLayout->AddView(textView);
|
||||||
|
|
||||||
// create the bottom line: volumen in deskbar checkbox and restart button
|
// create the bottom line: volumen in deskbar checkbox and restart button
|
||||||
BGroupView* bottomView = new BGroupView(B_HORIZONTAL);
|
BGroupView* bottomView = new BGroupView(B_HORIZONTAL);
|
||||||
BButton *restartButton = new BButton("restartButton",
|
BButton *restartButton = new BButton("restartButton",
|
||||||
TR("Restart media services"), new BMessage(ML_RESTART_MEDIA_SERVER));
|
B_TRANSLATE("Restart media services"),
|
||||||
|
new BMessage(ML_RESTART_MEDIA_SERVER));
|
||||||
|
|
||||||
if (!fIsVideo) {
|
if (!fIsVideo) {
|
||||||
fVolumeCheckBox = new BCheckBox("volumeCheckBox",
|
fVolumeCheckBox = new BCheckBox("volumeCheckBox",
|
||||||
TR("Show volume control on Deskbar"), new BMessage(ML_SHOW_VOLUME_CONTROL));
|
B_TRANSLATE("Show volume control on Deskbar"),
|
||||||
|
new BMessage(ML_SHOW_VOLUME_CONTROL));
|
||||||
bottomView->GroupLayout()->AddView(fVolumeCheckBox);
|
bottomView->GroupLayout()->AddView(fVolumeCheckBox);
|
||||||
if (BDeskbar().HasItem("MediaReplicant"))
|
if (BDeskbar().HasItem("MediaReplicant"))
|
||||||
fVolumeCheckBox->SetValue(B_CONTROL_ON);
|
fVolumeCheckBox->SetValue(B_CONTROL_ON);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
bottomView->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
|
bottomView->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());
|
||||||
}
|
}
|
||||||
bottomView->GroupLayout()->AddView(restartButton);
|
bottomView->GroupLayout()->AddView(restartButton);
|
||||||
|
|
||||||
// compose all stuff
|
// compose all stuff
|
||||||
BGroupLayout* rootlayout = new BGroupLayout(B_VERTICAL, 5);
|
BGroupLayout* rootlayout = new BGroupLayout(B_VERTICAL, 5);
|
||||||
SetLayout(rootlayout);
|
SetLayout(rootlayout);
|
||||||
@@ -198,7 +206,7 @@ void
|
|||||||
SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID)
|
SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID)
|
||||||
{
|
{
|
||||||
BMenu *menu = isInput ? fMenu1 : fMenu2;
|
BMenu *menu = isInput ? fMenu1 : fMenu2;
|
||||||
|
|
||||||
for (int32 i = 0; i < menu->CountItems(); i++) {
|
for (int32 i = 0; i < menu->CountItems(); i++) {
|
||||||
SettingsItem *item = static_cast<SettingsItem *>(menu->ItemAt(i));
|
SettingsItem *item = static_cast<SettingsItem *>(menu->ItemAt(i));
|
||||||
if (item->fInfo && item->fInfo->addon == info.addon && item->fInfo->flavor_id == info.flavor_id) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fIsVideo&&!isInput&&outputID>-1) {
|
if (!fIsVideo&&!isInput&&outputID>-1) {
|
||||||
BMenuItem *item;
|
BMenuItem *item;
|
||||||
while ((item = fMenu3->RemoveItem((int32)0)) != NULL)
|
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 node;
|
||||||
media_node_id node_id;
|
media_node_id node_id;
|
||||||
status_t err;
|
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);
|
err = roster->InstantiateDormantNode(info, &node, B_FLAVOR_IS_GLOBAL);
|
||||||
else
|
else
|
||||||
err = roster->GetNodeFor(node_id, &node);
|
err = roster->GetNodeFor(node_id, &node);
|
||||||
|
|
||||||
if (err == B_OK) {
|
if (err == B_OK) {
|
||||||
media_input inputs[16];
|
media_input inputs[16];
|
||||||
int32 inputCount = 16;
|
int32 inputCount = 16;
|
||||||
if (roster->GetAllInputsFor(node, inputs, 16, &inputCount)==B_OK) {
|
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)
|
char shortcut, uint32 modifiers)
|
||||||
: BMenuItem(info->name, message, shortcut, modifiers),
|
: BMenuItem(info->name, message, shortcut, modifiers),
|
||||||
fInfo(info)
|
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)
|
char shortcut, uint32 modifiers)
|
||||||
: BMenuItem(input->name, message, shortcut, modifiers),
|
: BMenuItem(input->name, message, shortcut, modifiers),
|
||||||
fInfo(info),
|
fInfo(info),
|
||||||
fInput(input)
|
fInput(input)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ const uint32 ML_INIT_MEDIA = 'MlIM';
|
|||||||
|
|
||||||
// MediaWindow - Constructor
|
// MediaWindow - Constructor
|
||||||
MediaWindow::MediaWindow(BRect frame)
|
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),
|
B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
|
||||||
fCurrentNode(NULL),
|
fCurrentNode(NULL),
|
||||||
fParamWeb(NULL),
|
fParamWeb(NULL),
|
||||||
@@ -69,17 +69,17 @@ MediaWindow::~MediaWindow()
|
|||||||
delete static_cast<dormant_node_info *>(fVideoOutputs.ItemAt(i));
|
delete static_cast<dormant_node_info *>(fVideoOutputs.ItemAt(i));
|
||||||
for (int i = 0; i<fVideoInputs.CountItems(); i++)
|
for (int i = 0; i<fVideoInputs.CountItems(); i++)
|
||||||
delete static_cast<dormant_node_info *>(fVideoInputs.ItemAt(i));
|
delete static_cast<dormant_node_info *>(fVideoInputs.ItemAt(i));
|
||||||
|
|
||||||
BMediaRoster *roster = BMediaRoster::Roster();
|
BMediaRoster *roster = BMediaRoster::Roster();
|
||||||
if (roster && fCurrentNode)
|
if (roster && fCurrentNode)
|
||||||
roster->ReleaseNode(*fCurrentNode);
|
roster->ReleaseNode(*fCurrentNode);
|
||||||
|
|
||||||
char buffer[512];
|
char buffer[512];
|
||||||
BRect rect = Frame();
|
BRect rect = Frame();
|
||||||
PRINT_OBJECT(rect);
|
PRINT_OBJECT(rect);
|
||||||
sprintf(buffer, "# MediaPrefs Settings\n rect = %i,%i,%i,%i\n",
|
sprintf(buffer, "# MediaPrefs Settings\n rect = %i,%i,%i,%i\n",
|
||||||
int(rect.left), int(rect.top), int(rect.right), int(rect.bottom));
|
int(rect.left), int(rect.top), int(rect.right), int(rect.bottom));
|
||||||
|
|
||||||
BPath path;
|
BPath path;
|
||||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
|
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) {
|
||||||
path.Append(SETTINGS_FILE);
|
path.Append(SETTINGS_FILE);
|
||||||
@@ -100,20 +100,20 @@ MediaWindow::FindNodes(media_type type, uint64 kind, BList &list)
|
|||||||
media_format *format1 = NULL, *format2 = NULL;
|
media_format *format1 = NULL, *format2 = NULL;
|
||||||
BMediaRoster *roster = BMediaRoster::Roster();
|
BMediaRoster *roster = BMediaRoster::Roster();
|
||||||
format.type = type;
|
format.type = type;
|
||||||
|
|
||||||
if (kind & B_PHYSICAL_OUTPUT)
|
if (kind & B_PHYSICAL_OUTPUT)
|
||||||
format1 = &format;
|
format1 = &format;
|
||||||
else if (kind & B_PHYSICAL_INPUT)
|
else if (kind & B_PHYSICAL_INPUT)
|
||||||
format2 = &format;
|
format2 = &format;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (roster->GetDormantNodes(node_info, &node_info_count, format1, format2,
|
if (roster->GetDormantNodes(node_info, &node_info_count, format1, format2,
|
||||||
NULL, kind)!=B_OK) {
|
NULL, kind)!=B_OK) {
|
||||||
fprintf(stderr, "error\n");
|
fprintf(stderr, "error\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32 i = 0; i<node_info_count; i++) {
|
for (int32 i = 0; i<node_info_count; i++) {
|
||||||
PRINT(("node : %s, media_addon %i, flavor_id %i\n",
|
PRINT(("node : %s, media_addon %i, flavor_id %i\n",
|
||||||
node_info[i].name, node_info[i].addon, node_info[i].flavor_id));
|
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 = new BListView("media_list_view");
|
||||||
fListView->SetSelectionMessage(new BMessage(ML_SELECTED_NODE));
|
fListView->SetSelectionMessage(new BMessage(ML_SELECTED_NODE));
|
||||||
|
|
||||||
// Add ScrollView to Media Menu
|
// Add ScrollView to Media Menu
|
||||||
BScrollView *scrollView = new BScrollView("listscroller",
|
BScrollView *scrollView = new BScrollView("listscroller",
|
||||||
fListView, 0, false, false, B_FANCY_BORDER);
|
fListView, 0, false, false, B_FANCY_BORDER);
|
||||||
@@ -198,20 +198,20 @@ MediaWindow::InitWindow(void)
|
|||||||
B_PLAIN_BORDER);
|
B_PLAIN_BORDER);
|
||||||
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
||||||
GetLayout()->AddView(fBox);
|
GetLayout()->AddView(fBox);
|
||||||
|
|
||||||
// StringViews
|
// StringViews
|
||||||
rgb_color titleFontColor = { 0, 0, 0, 0 };
|
rgb_color titleFontColor = { 0, 0, 0, 0 };
|
||||||
fTitleView = new BStringView("AudioSettings",
|
fTitleView = new BStringView("AudioSettings",
|
||||||
TR("Audio settings"), B_WILL_DRAW);
|
B_TRANSLATE("Audio settings"), B_WILL_DRAW);
|
||||||
fTitleView->SetFont(be_bold_font);
|
fTitleView->SetFont(be_bold_font);
|
||||||
fTitleView->SetHighColor(titleFontColor);
|
fTitleView->SetHighColor(titleFontColor);
|
||||||
|
|
||||||
fContentView = new BBox("contentView", B_WILL_DRAW | B_FRAME_EVENTS,
|
fContentView = new BBox("contentView", B_WILL_DRAW | B_FRAME_EVENTS,
|
||||||
B_NO_BORDER);
|
B_NO_BORDER);
|
||||||
|
|
||||||
fAudioView = new SettingsView(false);
|
fAudioView = new SettingsView(false);
|
||||||
fVideoView = new SettingsView(true);
|
fVideoView = new SettingsView(true);
|
||||||
|
|
||||||
fBar = new BarView();
|
fBar = new BarView();
|
||||||
BGroupView* titleGroupView = new BGroupView(B_HORIZONTAL);
|
BGroupView* titleGroupView = new BGroupView(B_HORIZONTAL);
|
||||||
titleGroupView->GroupLayout()->AddView(fTitleView);
|
titleGroupView->GroupLayout()->AddView(fTitleView);
|
||||||
@@ -223,15 +223,15 @@ MediaWindow::InitWindow(void)
|
|||||||
rightView->GroupLayout()->AddView(titleGroupView);
|
rightView->GroupLayout()->AddView(titleGroupView);
|
||||||
rightView->GroupLayout()->AddView(fBar, 0);
|
rightView->GroupLayout()->AddView(fBar, 0);
|
||||||
rightView->GroupLayout()->AddView(fContentView);
|
rightView->GroupLayout()->AddView(fContentView);
|
||||||
|
|
||||||
BGroupLayout* rootLayout = new BGroupLayout(B_HORIZONTAL);
|
BGroupLayout* rootLayout = new BGroupLayout(B_HORIZONTAL);
|
||||||
rootLayout->SetInsets(14, 14, 14, 14);
|
rootLayout->SetInsets(14, 14, 14, 14);
|
||||||
fBox->SetLayout(rootLayout);
|
fBox->SetLayout(rootLayout);
|
||||||
|
|
||||||
rootLayout->AddView(scrollView);
|
rootLayout->AddView(scrollView);
|
||||||
|
|
||||||
rootLayout->AddView(rightView);
|
rootLayout->AddView(rightView);
|
||||||
|
|
||||||
// Start the window
|
// Start the window
|
||||||
fInitCheck = InitMedia(true);
|
fInitCheck = InitMedia(true);
|
||||||
if (fInitCheck != B_OK) {
|
if (fInitCheck != B_OK) {
|
||||||
@@ -251,37 +251,41 @@ MediaWindow::InitMedia(bool first)
|
|||||||
{
|
{
|
||||||
status_t err = B_OK;
|
status_t err = B_OK;
|
||||||
BMediaRoster *roster = BMediaRoster::Roster(&err);
|
BMediaRoster *roster = BMediaRoster::Roster(&err);
|
||||||
|
|
||||||
if (first && err != B_OK) {
|
if (first && err != B_OK) {
|
||||||
BAlert *alert = new BAlert("start_media_server",
|
BAlert *alert = new BAlert("start_media_server",
|
||||||
TR("Could not connect to the media server.\n"
|
B_TRANSLATE("Could not connect to the media server.\n"
|
||||||
"Would you like to start it ?"), TR("Quit"),
|
"Would you like to start it ?"),
|
||||||
TR("Start media server"), NULL,
|
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)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
fAlert = new MediaAlert(BRect(0, 0, 300, 60),
|
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();
|
fAlert->Show();
|
||||||
|
|
||||||
Show();
|
Show();
|
||||||
|
|
||||||
launch_media_server();
|
launch_media_server();
|
||||||
}
|
}
|
||||||
|
|
||||||
Lock();
|
Lock();
|
||||||
|
|
||||||
bool isVideoSelected = true;
|
bool isVideoSelected = true;
|
||||||
if (!first && fListView->ItemAt(0) && fListView->ItemAt(0)->IsSelected())
|
if (!first && fListView->ItemAt(0) && fListView->ItemAt(0)->IsSelected())
|
||||||
isVideoSelected = false;
|
isVideoSelected = false;
|
||||||
|
|
||||||
if ((!first || (first && err) ) && fAlert) {
|
if ((!first || (first && err) ) && fAlert) {
|
||||||
BAutolock locker(fAlert);
|
BAutolock locker(fAlert);
|
||||||
if (locker.IsLocked())
|
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;
|
void *listItem;
|
||||||
while ((listItem = fListView->RemoveItem((int32)0)))
|
while ((listItem = fListView->RemoveItem((int32)0)))
|
||||||
delete static_cast<MediaListItem *>(listItem);
|
delete static_cast<MediaListItem *>(listItem);
|
||||||
@@ -293,7 +297,7 @@ MediaWindow::InitMedia(bool first)
|
|||||||
delete static_cast<dormant_node_info *>(listItem);
|
delete static_cast<dormant_node_info *>(listItem);
|
||||||
while ((listItem = fVideoInputs.RemoveItem((int32)0)))
|
while ((listItem = fVideoInputs.RemoveItem((int32)0)))
|
||||||
delete static_cast<dormant_node_info *>(listItem);
|
delete static_cast<dormant_node_info *>(listItem);
|
||||||
|
|
||||||
MediaListItem *item, *mixer, *audio, *video;
|
MediaListItem *item, *mixer, *audio, *video;
|
||||||
|
|
||||||
// Grab Media Info
|
// Grab Media Info
|
||||||
@@ -312,25 +316,25 @@ MediaWindow::InitMedia(bool first)
|
|||||||
AddNodes(fVideoInputs, true);
|
AddNodes(fVideoInputs, true);
|
||||||
AddNodes(fAudioOutputs, false);
|
AddNodes(fAudioOutputs, false);
|
||||||
AddNodes(fAudioInputs, false);
|
AddNodes(fAudioInputs, false);
|
||||||
|
|
||||||
fAudioView->AddNodes(fAudioOutputs, false);
|
fAudioView->AddNodes(fAudioOutputs, false);
|
||||||
fAudioView->AddNodes(fAudioInputs, true);
|
fAudioView->AddNodes(fAudioInputs, true);
|
||||||
fVideoView->AddNodes(fVideoOutputs, false);
|
fVideoView->AddNodes(fVideoOutputs, false);
|
||||||
fVideoView->AddNodes(fVideoInputs, true);
|
fVideoView->AddNodes(fVideoInputs, true);
|
||||||
|
|
||||||
fListView->AddItem(audio = new MediaListItem("Audio settings", 0, false, &fIcons));
|
fListView->AddItem(audio = new MediaListItem("Audio settings", 0, false, &fIcons));
|
||||||
fListView->AddItem(video = new MediaListItem("Video settings", 0, true, &fIcons));
|
fListView->AddItem(video = new MediaListItem("Video settings", 0, true, &fIcons));
|
||||||
|
|
||||||
fListView->AddItem(mixer = new MediaListItem("Audio mixer", 1, false, &fIcons));
|
fListView->AddItem(mixer = new MediaListItem("Audio mixer", 1, false, &fIcons));
|
||||||
mixer->SetAudioMixer(true);
|
mixer->SetAudioMixer(true);
|
||||||
|
|
||||||
fListView->SortItems(&MediaListItem::Compare);
|
fListView->SortItems(&MediaListItem::Compare);
|
||||||
|
|
||||||
media_node default_node;
|
media_node default_node;
|
||||||
dormant_node_info node_info;
|
dormant_node_info node_info;
|
||||||
int32 outputID;
|
int32 outputID;
|
||||||
BString outputName;
|
BString outputName;
|
||||||
|
|
||||||
if (roster->GetAudioInput(&default_node)==B_OK) {
|
if (roster->GetAudioInput(&default_node)==B_OK) {
|
||||||
roster->GetDormantNodeFor(default_node, &node_info);
|
roster->GetDormantNodeFor(default_node, &node_info);
|
||||||
item = FindMediaListItem(&node_info);
|
item = FindMediaListItem(&node_info);
|
||||||
@@ -338,7 +342,7 @@ MediaWindow::InitMedia(bool first)
|
|||||||
item->SetDefault(true, true);
|
item->SetDefault(true, true);
|
||||||
fAudioView->SetDefault(node_info, true);
|
fAudioView->SetDefault(node_info, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roster->GetAudioOutput(&default_node, &outputID, &outputName)==B_OK) {
|
if (roster->GetAudioOutput(&default_node, &outputID, &outputName)==B_OK) {
|
||||||
roster->GetDormantNodeFor(default_node, &node_info);
|
roster->GetDormantNodeFor(default_node, &node_info);
|
||||||
item = FindMediaListItem(&node_info);
|
item = FindMediaListItem(&node_info);
|
||||||
@@ -346,7 +350,7 @@ MediaWindow::InitMedia(bool first)
|
|||||||
item->SetDefault(true, false);
|
item->SetDefault(true, false);
|
||||||
fAudioView->SetDefault(node_info, false, outputID);
|
fAudioView->SetDefault(node_info, false, outputID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roster->GetVideoInput(&default_node)==B_OK) {
|
if (roster->GetVideoInput(&default_node)==B_OK) {
|
||||||
roster->GetDormantNodeFor(default_node, &node_info);
|
roster->GetDormantNodeFor(default_node, &node_info);
|
||||||
item = FindMediaListItem(&node_info);
|
item = FindMediaListItem(&node_info);
|
||||||
@@ -354,7 +358,7 @@ MediaWindow::InitMedia(bool first)
|
|||||||
item->SetDefault(true, true);
|
item->SetDefault(true, true);
|
||||||
fVideoView->SetDefault(node_info, true);
|
fVideoView->SetDefault(node_info, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (roster->GetVideoOutput(&default_node)==B_OK) {
|
if (roster->GetVideoOutput(&default_node)==B_OK) {
|
||||||
roster->GetDormantNodeFor(default_node, &node_info);
|
roster->GetDormantNodeFor(default_node, &node_info);
|
||||||
item = FindMediaListItem(&node_info);
|
item = FindMediaListItem(&node_info);
|
||||||
@@ -362,7 +366,7 @@ MediaWindow::InitMedia(bool first)
|
|||||||
item->SetDefault(true, false);
|
item->SetDefault(true, false);
|
||||||
fVideoView->SetDefault(node_info, false);
|
fVideoView->SetDefault(node_info, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (first) {
|
if (first) {
|
||||||
fListView->Select(fListView->IndexOf(mixer));
|
fListView->Select(fListView->IndexOf(mixer));
|
||||||
} else {
|
} else {
|
||||||
@@ -370,21 +374,21 @@ MediaWindow::InitMedia(bool first)
|
|||||||
fAudioView->fRestartView->Hide();
|
fAudioView->fRestartView->Hide();
|
||||||
if (!fVideoView->fRestartView->IsHidden())
|
if (!fVideoView->fRestartView->IsHidden())
|
||||||
fVideoView->fRestartView->Hide();
|
fVideoView->fRestartView->Hide();
|
||||||
|
|
||||||
if (isVideoSelected)
|
if (isVideoSelected)
|
||||||
fListView->Select(fListView->IndexOf(video));
|
fListView->Select(fListView->IndexOf(video));
|
||||||
else
|
else
|
||||||
fListView->Select(fListView->IndexOf(audio));
|
fListView->Select(fListView->IndexOf(audio));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fAlert) {
|
if (fAlert) {
|
||||||
snooze(800000);
|
snooze(800000);
|
||||||
fAlert->PostMessage(B_QUIT_REQUESTED);
|
fAlert->PostMessage(B_QUIT_REQUESTED);
|
||||||
}
|
}
|
||||||
fAlert = NULL;
|
fAlert = NULL;
|
||||||
|
|
||||||
Unlock();
|
Unlock();
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,7 +422,8 @@ MediaWindow::FrameResized (float width, float height)
|
|||||||
void
|
void
|
||||||
ErrorAlert(char* errorMessage) {
|
ErrorAlert(char* errorMessage) {
|
||||||
printf("%s\n", 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();
|
alert->Go();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -440,11 +445,11 @@ MediaWindow::MessageReceived (BMessage *message)
|
|||||||
if (message->FindInt32("index", &index)!=B_OK)
|
if (message->FindInt32("index", &index)!=B_OK)
|
||||||
break;
|
break;
|
||||||
Settings2Item *item = static_cast<Settings2Item *>(fAudioView->fMenu3->ItemAt(index));
|
Settings2Item *item = static_cast<Settings2Item *>(fAudioView->fMenu3->ItemAt(index));
|
||||||
|
|
||||||
if (item) {
|
if (item) {
|
||||||
BMediaRoster *roster = BMediaRoster::Roster();
|
BMediaRoster *roster = BMediaRoster::Roster();
|
||||||
roster->SetAudioOutput(*item->fInput);
|
roster->SetAudioOutput(*item->fInput);
|
||||||
|
|
||||||
if (fAudioView->fRestartView->IsHidden())
|
if (fAudioView->fRestartView->IsHidden())
|
||||||
fAudioView->fRestartView->Show();
|
fAudioView->fRestartView->Show();
|
||||||
} else
|
} else
|
||||||
@@ -465,7 +470,7 @@ MediaWindow::MessageReceived (BMessage *message)
|
|||||||
SettingsView *settingsView = isVideo ? fVideoView : fAudioView;
|
SettingsView *settingsView = isVideo ? fVideoView : fAudioView;
|
||||||
BMenu *menu = isInput ? settingsView->fMenu1 : settingsView->fMenu2;
|
BMenu *menu = isInput ? settingsView->fMenu1 : settingsView->fMenu2;
|
||||||
SettingsItem *item = static_cast<SettingsItem *>(menu->ItemAt(index));
|
SettingsItem *item = static_cast<SettingsItem *>(menu->ItemAt(index));
|
||||||
|
|
||||||
if (item) {
|
if (item) {
|
||||||
PRINT(("isVideo %i isInput %i\n", isVideo, isInput));
|
PRINT(("isVideo %i isInput %i\n", isVideo, isInput));
|
||||||
BMediaRoster *roster = BMediaRoster::Roster();
|
BMediaRoster *roster = BMediaRoster::Roster();
|
||||||
@@ -482,7 +487,7 @@ MediaWindow::MessageReceived (BMessage *message)
|
|||||||
fAudioView->SetDefault(*item->fInfo, false, 0);
|
fAudioView->SetDefault(*item->fInfo, false, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaListItem *oldListItem = NULL;
|
MediaListItem *oldListItem = NULL;
|
||||||
for (int32 j = 0; j<fListView->CountItems(); j++) {
|
for (int32 j = 0; j<fListView->CountItems(); j++) {
|
||||||
oldListItem = static_cast<MediaListItem *>(fListView->ItemAt(j));
|
oldListItem = static_cast<MediaListItem *>(fListView->ItemAt(j));
|
||||||
@@ -494,14 +499,14 @@ MediaWindow::MessageReceived (BMessage *message)
|
|||||||
oldListItem->SetDefault(false, isInput);
|
oldListItem->SetDefault(false, isInput);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "oldListItem not found\n");
|
fprintf(stderr, "oldListItem not found\n");
|
||||||
|
|
||||||
MediaListItem *listItem = FindMediaListItem(item->fInfo);
|
MediaListItem *listItem = FindMediaListItem(item->fInfo);
|
||||||
if (listItem) {
|
if (listItem) {
|
||||||
listItem->SetDefault(true, isInput);
|
listItem->SetDefault(true, isInput);
|
||||||
} else
|
} else
|
||||||
fprintf(stderr, "MediaListItem not found\n");
|
fprintf(stderr, "MediaListItem not found\n");
|
||||||
fListView->Invalidate();
|
fListView->Invalidate();
|
||||||
|
|
||||||
if (settingsView->fRestartView->IsHidden())
|
if (settingsView->fRestartView->IsHidden())
|
||||||
settingsView->fRestartView->Show();
|
settingsView->fRestartView->Show();
|
||||||
} else
|
} else
|
||||||
@@ -530,13 +535,15 @@ MediaWindow::MessageReceived (BMessage *message)
|
|||||||
status = deskbar.AddItem(&ref, &id);
|
status = deskbar.AddItem(&ref, &id);
|
||||||
|
|
||||||
if (status != B_OK) {
|
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));
|
strerror(status));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
status_t status = deskbar.RemoveItem("MediaReplicant");
|
status_t status = deskbar.RemoveItem("MediaReplicant");
|
||||||
if (status != B_OK) {
|
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));
|
strerror(status));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -559,11 +566,11 @@ MediaWindow::MessageReceived (BMessage *message)
|
|||||||
roster->SetRealtimeFlags(flags);
|
roster->SetRealtimeFlags(flags);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case B_MEDIA_WEB_CHANGED:
|
case B_MEDIA_WEB_CHANGED:
|
||||||
case ML_SELECTED_NODE:
|
case ML_SELECTED_NODE:
|
||||||
{
|
{
|
||||||
PRINT_OBJECT(*message);
|
PRINT_OBJECT(*message);
|
||||||
|
|
||||||
MediaListItem *item = static_cast<MediaListItem *>(fListView->ItemAt(fListView->CurrentSelection()));
|
MediaListItem *item = static_cast<MediaListItem *>(fListView->ItemAt(fListView->CurrentSelection()));
|
||||||
if (!item)
|
if (!item)
|
||||||
break;
|
break;
|
||||||
@@ -582,46 +589,47 @@ MediaWindow::MessageReceived (BMessage *message)
|
|||||||
if (fParamWeb)
|
if (fParamWeb)
|
||||||
delete fParamWeb;
|
delete fParamWeb;
|
||||||
fParamWeb = NULL;
|
fParamWeb = NULL;
|
||||||
|
|
||||||
fTitleView->SetText(item->GetLabel());
|
fTitleView->SetText(item->GetLabel());
|
||||||
|
|
||||||
if (item->OutlineLevel() == 0) {
|
if (item->OutlineLevel() == 0) {
|
||||||
if (item->IsVideo())
|
if (item->IsVideo())
|
||||||
fContentView->AddChild(fVideoView);
|
fContentView->AddChild(fVideoView);
|
||||||
else
|
else
|
||||||
fContentView->AddChild(fAudioView);
|
fContentView->AddChild(fAudioView);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (!fCurrentNode)
|
if (!fCurrentNode)
|
||||||
fCurrentNode = new media_node();
|
fCurrentNode = new media_node();
|
||||||
media_node_id node_id;
|
media_node_id node_id;
|
||||||
if (item->IsAudioMixer())
|
if (item->IsAudioMixer())
|
||||||
roster->GetAudioMixer(fCurrentNode);
|
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);
|
roster->InstantiateDormantNode(*(item->fInfo), fCurrentNode, B_FLAVOR_IS_GLOBAL);
|
||||||
else
|
else
|
||||||
roster->GetNodeFor(node_id, fCurrentNode);
|
roster->GetNodeFor(node_id, fCurrentNode);
|
||||||
|
|
||||||
if (roster->GetParameterWebFor(*fCurrentNode, &fParamWeb)==B_OK
|
if (roster->GetParameterWebFor(*fCurrentNode, &fParamWeb)==B_OK
|
||||||
&& (paramView = BMediaTheme::PreferredTheme()->ViewFor(fParamWeb)) != NULL) {
|
&& (paramView = BMediaTheme::PreferredTheme()->ViewFor(fParamWeb)) != NULL) {
|
||||||
fContentView->AddChild(paramView);
|
fContentView->AddChild(paramView);
|
||||||
paramView->ResizeTo(fContentView->Bounds().Width(), fContentView->Bounds().Height() - 10);
|
paramView->ResizeTo(fContentView->Bounds().Width(), fContentView->Bounds().Height() - 10);
|
||||||
|
|
||||||
roster->StartWatching(this, *fCurrentNode, B_MEDIA_WILDCARD);
|
roster->StartWatching(this, *fCurrentNode, B_MEDIA_WILDCARD);
|
||||||
} else {
|
} else {
|
||||||
if (fParamWeb)
|
if (fParamWeb)
|
||||||
delete fParamWeb;
|
delete fParamWeb;
|
||||||
fParamWeb = NULL;
|
fParamWeb = NULL;
|
||||||
BRect bounds = fContentView->Bounds();
|
BRect bounds = fContentView->Bounds();
|
||||||
BStringView* stringView = new BStringView(bounds,
|
BStringView* stringView = new BStringView(bounds,
|
||||||
"noControls", TR("This hardware has no controls."), B_FOLLOW_V_CENTER | B_FOLLOW_H_CENTER);
|
"noControls", B_TRANSLATE("This hardware has no controls."),
|
||||||
|
B_FOLLOW_V_CENTER | B_FOLLOW_H_CENTER);
|
||||||
stringView->ResizeToPreferred();
|
stringView->ResizeToPreferred();
|
||||||
fContentView->AddChild(stringView);
|
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);
|
(bounds.Height()-stringView->Bounds().Height())/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool barChanged = (item->OutlineLevel() == 0 || fParamWeb == NULL || fParamWeb->CountGroups()<2);
|
bool barChanged = (item->OutlineLevel() == 0 || fParamWeb == NULL || fParamWeb->CountGroups()<2);
|
||||||
if (barChanged != fBar->fDisplay) {
|
if (barChanged != fBar->fDisplay) {
|
||||||
fBar->fDisplay = barChanged;
|
fBar->fDisplay = barChanged;
|
||||||
@@ -634,10 +642,11 @@ MediaWindow::MessageReceived (BMessage *message)
|
|||||||
PRINT_OBJECT(*message);
|
PRINT_OBJECT(*message);
|
||||||
const char *mimeSig;
|
const char *mimeSig;
|
||||||
if (fAlert && message->FindString("be:signature", &mimeSig)==B_OK
|
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)) {
|
|| strcmp(mimeSig, "application/x-vnd.Be.media-server")==0)) {
|
||||||
fAlert->Lock();
|
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();
|
fAlert->Unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -647,14 +656,14 @@ MediaWindow::MessageReceived (BMessage *message)
|
|||||||
PRINT_OBJECT(*message);
|
PRINT_OBJECT(*message);
|
||||||
const char *mimeSig;
|
const char *mimeSig;
|
||||||
if (message->FindString("be:signature", &mimeSig)==B_OK) {
|
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) {
|
|| strcmp(mimeSig, "application/x-vnd.Be.media-server")==0) {
|
||||||
BMediaRoster* roster = BMediaRoster::CurrentRoster();
|
BMediaRoster* roster = BMediaRoster::CurrentRoster();
|
||||||
if (roster&&roster->Lock())
|
if (roster&&roster->Lock())
|
||||||
roster->Quit();
|
roster->Quit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -664,27 +673,29 @@ MediaWindow::MessageReceived (BMessage *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
MediaWindow::RestartMediaServices(void *data)
|
MediaWindow::RestartMediaServices(void *data)
|
||||||
{
|
{
|
||||||
MediaWindow *window = (MediaWindow *)data;
|
MediaWindow *window = (MediaWindow *)data;
|
||||||
window->fAlert = new MediaAlert(BRect(0, 0, 300, 60),
|
window->fAlert = new MediaAlert(BRect(0, 0, 300, 60),
|
||||||
"restart_alert", TR("Restarting media services\nShutting down media server\n"));
|
"restart_alert", B_TRANSLATE(
|
||||||
|
"Restarting media services\nShutting down media server\n"));
|
||||||
|
|
||||||
window->fAlert->Show();
|
window->fAlert->Show();
|
||||||
|
|
||||||
shutdown_media_server(B_INFINITE_TIMEOUT, MediaWindow::UpdateProgress, window->fAlert);
|
shutdown_media_server(B_INFINITE_TIMEOUT, MediaWindow::UpdateProgress, window->fAlert);
|
||||||
|
|
||||||
{
|
{
|
||||||
BAutolock locker(window->fAlert);
|
BAutolock locker(window->fAlert);
|
||||||
if (locker.IsLocked())
|
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();
|
launch_media_server();
|
||||||
|
|
||||||
return window->PostMessage(ML_INIT_MEDIA);
|
return window->PostMessage(ML_INIT_MEDIA);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
MediaWindow::UpdateProgress(int stage, const char * message, void * cookie)
|
MediaWindow::UpdateProgress(int stage, const char * message, void * cookie)
|
||||||
{
|
{
|
||||||
MediaAlert *alert = static_cast<MediaAlert*>(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";
|
const char *string = "Unknown stage";
|
||||||
switch (stage) {
|
switch (stage) {
|
||||||
case 10:
|
case 10:
|
||||||
string = TR("Stopping media server" B_UTF8_ELLIPSIS);
|
string = B_TRANSLATE("Stopping media server" B_UTF8_ELLIPSIS);
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
string = TR("Telling media_addon_server to quit.");
|
string = B_TRANSLATE("Telling media_addon_server to quit.");
|
||||||
break;
|
break;
|
||||||
case 40:
|
case 40:
|
||||||
string = TR("Waiting for media_server to quit.");
|
string = B_TRANSLATE("Waiting for media_server to quit.");
|
||||||
break;
|
break;
|
||||||
case 70:
|
case 70:
|
||||||
string = TR("Cleaning up.");
|
string = B_TRANSLATE("Cleaning up.");
|
||||||
break;
|
break;
|
||||||
case 100:
|
case 100:
|
||||||
string = TR("Done shutting down.");
|
string = B_TRANSLATE("Done shutting down.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
BAutolock locker(alert);
|
BAutolock locker(alert);
|
||||||
if (locker.IsLocked())
|
if (locker.IsLocked())
|
||||||
alert->TextView()->SetText(string);
|
alert->TextView()->SetText(string);
|
||||||
|
|||||||
Reference in New Issue
Block a user