Remove the realtime stuff from the media preflet, as these controls actually have no effect whatsoever. Also remove the message to restart the media server after default audio/video inputs or outputs are changed, as these changes take effect immediately. fixes #6012
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40687 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
3116b031dc
commit
c97121d35b
@ -14,7 +14,6 @@
|
||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||
#include "MediaViews.h"
|
||||
|
||||
#include <Alert.h>
|
||||
#include <AutoDeleter.h>
|
||||
#include <Box.h>
|
||||
#include <Button.h>
|
||||
@ -48,11 +47,9 @@
|
||||
|
||||
SettingsView::SettingsView()
|
||||
:
|
||||
BGridView(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING),
|
||||
fRealtimeCheckBox(NULL),
|
||||
BGroupView(B_VERTICAL, B_USE_DEFAULT_SPACING),
|
||||
fInputMenu(NULL),
|
||||
fOutputMenu(NULL),
|
||||
fRestartView(NULL)
|
||||
fOutputMenu(NULL)
|
||||
{
|
||||
// input menu
|
||||
fInputMenu = new BPopUpMenu(B_TRANSLATE("<none>"));
|
||||
@ -64,59 +61,6 @@ SettingsView::SettingsView()
|
||||
}
|
||||
|
||||
|
||||
BBox*
|
||||
SettingsView::MakeRealtimeBox(const char* info, uint32 realtimeMask,
|
||||
const char* checkBoxLabel)
|
||||
{
|
||||
// create the realtime box
|
||||
BBox* realtimeBox = new BBox("realtime");
|
||||
realtimeBox->SetLabel(B_TRANSLATE("Real-time"));
|
||||
|
||||
BMessage* checkBoxMessage = new BMessage(ML_ENABLE_REAL_TIME);
|
||||
checkBoxMessage->AddUInt32("flags", realtimeMask);
|
||||
fRealtimeCheckBox = new BCheckBox("realtimeCheckBox", checkBoxLabel,
|
||||
checkBoxMessage);
|
||||
|
||||
uint32 flags = 0;
|
||||
BMediaRoster::Roster()->GetRealtimeFlags(&flags);
|
||||
if (flags & realtimeMask)
|
||||
fRealtimeCheckBox->SetValue(B_CONTROL_ON);
|
||||
|
||||
BTextView* textView = new BTextView("stringView");
|
||||
textView->Insert(info);
|
||||
textView->MakeEditable(false);
|
||||
textView->MakeSelectable(false);
|
||||
textView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
|
||||
BGroupView* realtimeGroup = new BGroupView(B_VERTICAL);
|
||||
BLayoutBuilder::Group<>(realtimeGroup)
|
||||
.SetInsets(B_USE_DEFAULT_SPACING, 0, B_USE_DEFAULT_SPACING,
|
||||
B_USE_DEFAULT_SPACING)
|
||||
.Add(fRealtimeCheckBox)
|
||||
.Add(textView);
|
||||
|
||||
realtimeBox->AddChild(realtimeGroup);
|
||||
return realtimeBox;
|
||||
}
|
||||
|
||||
|
||||
BStringView*
|
||||
SettingsView::MakeRestartMessageView()
|
||||
{
|
||||
// note: this ought to display at the bottom of the default box...
|
||||
fRestartView = new BStringView("restartStringView",
|
||||
B_TRANSLATE("Restart the media server to apply changes."));
|
||||
fRestartView->SetHighColor(ui_color(B_FAILURE_COLOR));
|
||||
// not exactly failure, but sort of.
|
||||
fRestartView->Hide();
|
||||
fRestartView->SetExplicitAlignment(BAlignment(B_ALIGN_HORIZONTAL_CENTER,
|
||||
B_ALIGN_VERTICAL_CENTER));
|
||||
fRestartView->SetAlignment(B_ALIGN_HORIZONTAL_CENTER);
|
||||
fRestartView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
|
||||
return fRestartView;
|
||||
}
|
||||
|
||||
|
||||
BButton*
|
||||
SettingsView::MakeRestartButton()
|
||||
{
|
||||
@ -179,7 +123,6 @@ SettingsView::MessageReceived(BMessage* message)
|
||||
NodeMenuItem* item
|
||||
= static_cast<NodeMenuItem*>(fInputMenu->ItemAt(index));
|
||||
SetDefaultInput(item->NodeInfo());
|
||||
RestartRequired(true);
|
||||
break;
|
||||
}
|
||||
case MEDIA_DEFAULT_OUTPUT_CHANGE:
|
||||
@ -190,18 +133,10 @@ SettingsView::MessageReceived(BMessage* message)
|
||||
NodeMenuItem* item
|
||||
= static_cast<NodeMenuItem*>(fOutputMenu->ItemAt(index));
|
||||
SetDefaultOutput(item->NodeInfo());
|
||||
RestartRequired(true);
|
||||
break;
|
||||
}
|
||||
case ML_ENABLE_REAL_TIME:
|
||||
{
|
||||
uint32 flags = 0;
|
||||
if (message->FindUInt32("flags", &flags) == B_OK)
|
||||
_FlipRealtimeFlag(flags);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BGridView::MessageReceived(message);
|
||||
BGroupView::MessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,17 +147,6 @@ SettingsView::AttachedToWindow()
|
||||
BMessenger thisMessenger(this);
|
||||
fInputMenu->SetTargetForItems(thisMessenger);
|
||||
fOutputMenu->SetTargetForItems(thisMessenger);
|
||||
fRealtimeCheckBox->SetTarget(thisMessenger);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SettingsView::RestartRequired(bool required)
|
||||
{
|
||||
if (required)
|
||||
fRestartView->Show();
|
||||
else
|
||||
fRestartView->Hide();
|
||||
}
|
||||
|
||||
|
||||
@ -233,28 +157,6 @@ SettingsView::_MediaWindow() const
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SettingsView::_FlipRealtimeFlag(uint32 mask)
|
||||
{
|
||||
fRealtimeCheckBox->SetValue(B_CONTROL_OFF);
|
||||
BAlert* alert = new BAlert("realtime alert", UnimplementedRealtimeError(),
|
||||
B_TRANSLATE("OK"), NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
|
||||
alert->Go();
|
||||
|
||||
#if 0
|
||||
// TODO: error codes
|
||||
uint32 flags = 0;
|
||||
BMediaRoster* roster = BMediaRoster::Roster();
|
||||
roster->GetRealtimeFlags(&flags);
|
||||
if (flags & mask)
|
||||
flags &= ~mask;
|
||||
else
|
||||
flags |= mask;
|
||||
roster->SetRealtimeFlags(flags);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SettingsView::_EmptyMenu(BMenu* menu)
|
||||
{
|
||||
@ -372,30 +274,22 @@ AudioSettingsView::AudioSettingsView()
|
||||
B_TRANSLATE("Audio output:"), OutputMenu(), NULL);
|
||||
|
||||
BLayoutBuilder::Grid<>(defaultsGridView)
|
||||
.SetInsets(B_USE_DEFAULT_SPACING, 0, B_USE_DEFAULT_SPACING, 0)
|
||||
.SetInsets(B_USE_DEFAULT_SPACING, 0, B_USE_DEFAULT_SPACING,
|
||||
B_USE_DEFAULT_SPACING)
|
||||
.AddMenuField(inputMenuField, 0, 0, B_ALIGN_HORIZONTAL_UNSET, 1, 3, 1)
|
||||
.AddMenuField(outputMenuField, 0, 1)
|
||||
.AddMenuField(_MakeChannelMenu(), 2, 1)
|
||||
.Add(MakeRestartMessageView(), 0, 2, 4, 1);
|
||||
.AddMenuField(_MakeChannelMenu(), 2, 1);
|
||||
|
||||
defaultsBox->AddChild(defaultsGridView);
|
||||
|
||||
const char* realtimeLabel = B_TRANSLATE("Enable real-time audio");
|
||||
const char* realtimeInfo = 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.");
|
||||
|
||||
|
||||
BLayoutBuilder::Grid<>(this)
|
||||
BLayoutBuilder::Group<>(this)
|
||||
.SetInsets(0, 0, 0, 0)
|
||||
.Add(defaultsBox, 0, 0, 2, 1)
|
||||
.Add(MakeRealtimeBox(realtimeInfo, B_MEDIA_REALTIME_AUDIO,
|
||||
realtimeLabel), 0, 1, 2, 1)
|
||||
.Add(_MakeVolumeCheckBox(),0, 2, 1, 1)
|
||||
.Add(MakeRestartButton(), 1, 2, 1, 1)
|
||||
.SetRowWeight(1, 10);
|
||||
.Add(defaultsBox)
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.Add(_MakeVolumeCheckBox())
|
||||
.Add(MakeRestartButton())
|
||||
.End()
|
||||
.AddGlue();
|
||||
}
|
||||
|
||||
|
||||
@ -420,13 +314,6 @@ AudioSettingsView::AttachedToWindow()
|
||||
}
|
||||
|
||||
|
||||
BString
|
||||
AudioSettingsView::UnimplementedRealtimeError()
|
||||
{
|
||||
return B_TRANSLATE("Real-time audio is currently unimplemented in Haiku.");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AudioSettingsView::MessageReceived(BMessage* message)
|
||||
{
|
||||
@ -441,7 +328,6 @@ AudioSettingsView::MessageReceived(BMessage* message)
|
||||
if (item) {
|
||||
BMediaRoster* roster = BMediaRoster::Roster();
|
||||
roster->SetAudioOutput(*item->Input());
|
||||
RestartRequired(true);
|
||||
} else
|
||||
fprintf(stderr, "ChannelMenuItem not found\n");
|
||||
}
|
||||
@ -615,27 +501,21 @@ VideoSettingsView::VideoSettingsView()
|
||||
B_TRANSLATE("Video output:"), OutputMenu(), NULL);
|
||||
|
||||
BLayoutBuilder::Grid<>(defaultsGridView)
|
||||
.SetInsets(B_USE_DEFAULT_SPACING, 0, B_USE_DEFAULT_SPACING, 0)
|
||||
.SetInsets(B_USE_DEFAULT_SPACING, 0, B_USE_DEFAULT_SPACING,
|
||||
B_USE_DEFAULT_SPACING)
|
||||
.AddMenuField(inputMenuField, 0, 0)
|
||||
.AddMenuField(outputMenuField, 0, 1)
|
||||
.Add(MakeRestartMessageView(), 0, 2, 2, 1);
|
||||
.AddMenuField(outputMenuField, 0, 1);
|
||||
|
||||
defaultsBox->AddChild(defaultsGridView);
|
||||
|
||||
const char* realtimeLabel = B_TRANSLATE("Enable real-time video");
|
||||
const char* realtimeInfo = 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\n"
|
||||
"Only enable this feature if you need the lowest latency possible.");
|
||||
|
||||
BLayoutBuilder::Grid<>(this)
|
||||
BLayoutBuilder::Group<>(this)
|
||||
.SetInsets(0, 0, 0, 0)
|
||||
.Add(defaultsBox, 0, 0, 2, 1)
|
||||
.Add(MakeRealtimeBox(realtimeInfo, B_MEDIA_REALTIME_VIDEO,
|
||||
realtimeLabel), 0, 1, 2, 1)
|
||||
.Add(MakeRestartButton(), 1, 2, 1, 1)
|
||||
.SetRowWeight(1, 10);
|
||||
.Add(defaultsBox)
|
||||
.AddGroup(B_HORIZONTAL)
|
||||
.AddGlue()
|
||||
.Add(MakeRestartButton())
|
||||
.End()
|
||||
.AddGlue();
|
||||
}
|
||||
|
||||
|
||||
@ -655,11 +535,3 @@ VideoSettingsView::SetDefaultOutput(const dormant_node_info* info)
|
||||
_MediaWindow()->UpdateOutputListItem(MediaListItem::VIDEO_TYPE, info);
|
||||
BMediaRoster::Roster()->SetVideoOutput(*info);
|
||||
}
|
||||
|
||||
|
||||
BString
|
||||
VideoSettingsView::UnimplementedRealtimeError()
|
||||
{
|
||||
return B_TRANSLATE("Real-time video is currently unimplemented in Haiku.");
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||
#ifndef __MEDIAVIEWS_H__
|
||||
#define __MEDIAVIEWS_H__
|
||||
#include <GridView.h>
|
||||
#include <GroupView.h>
|
||||
#include <MediaAddOn.h>
|
||||
#include <MenuItem.h>
|
||||
|
||||
@ -33,7 +33,6 @@ class MediaWindow;
|
||||
|
||||
|
||||
const uint32 ML_RESTART_MEDIA_SERVER = 'resr';
|
||||
const uint32 ML_ENABLE_REAL_TIME = 'enrt';
|
||||
const uint32 ML_DEFAULT_CHANNEL_CHANGED = 'chch';
|
||||
|
||||
|
||||
@ -70,7 +69,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class SettingsView : public BGridView
|
||||
class SettingsView : public BGroupView
|
||||
{
|
||||
public:
|
||||
typedef BObjectList<dormant_node_info> NodeList;
|
||||
@ -85,37 +84,26 @@ public:
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void AttachedToWindow();
|
||||
|
||||
void RestartRequired(bool required);
|
||||
virtual BString UnimplementedRealtimeError() = 0;
|
||||
|
||||
protected:
|
||||
|
||||
BMenu* InputMenu() {return fInputMenu;}
|
||||
BMenu* OutputMenu() {return fOutputMenu;}
|
||||
|
||||
BBox* MakeRealtimeBox(const char* info,
|
||||
uint32 realtimeMask,
|
||||
const char* checkboxLabel);
|
||||
BStringView* MakeRestartMessageView();
|
||||
BButton* MakeRestartButton();
|
||||
|
||||
void _EmptyMenu(BMenu* menu);
|
||||
MediaWindow* _MediaWindow() const;
|
||||
|
||||
private:
|
||||
void _FlipRealtimeFlag(uint32 mask);
|
||||
|
||||
void _PopulateMenu(BMenu* menu, NodeList& nodes,
|
||||
const BMessage& message);
|
||||
NodeMenuItem* _FindNodeItem(BMenu* menu,
|
||||
const dormant_node_info* nodeInfo);
|
||||
void _ClearMenuSelection(BMenu* menu);
|
||||
|
||||
BCheckBox* fRealtimeCheckBox;
|
||||
|
||||
BMenu* fInputMenu;
|
||||
BMenu* fOutputMenu;
|
||||
BStringView* fRestartView;
|
||||
};
|
||||
|
||||
|
||||
@ -132,8 +120,6 @@ public:
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void AttachedToWindow();
|
||||
|
||||
virtual BString UnimplementedRealtimeError();
|
||||
|
||||
private:
|
||||
BMenuField* _MakeChannelMenu();
|
||||
BCheckBox* _MakeVolumeCheckBox();
|
||||
@ -156,8 +142,6 @@ public:
|
||||
|
||||
virtual void SetDefaultInput(const dormant_node_info* info);
|
||||
virtual void SetDefaultOutput(const dormant_node_info* info);
|
||||
|
||||
virtual BString UnimplementedRealtimeError();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -531,9 +531,6 @@ MediaWindow::InitMedia(bool first)
|
||||
if (first) {
|
||||
fListView->Select(fListView->IndexOf(mixer));
|
||||
} else {
|
||||
fAudioView->RestartRequired(false);
|
||||
fVideoView->RestartRequired(false);
|
||||
|
||||
if (isVideoSelected)
|
||||
fListView->Select(fListView->IndexOf(video));
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user