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:
@@ -14,7 +14,6 @@
|
|||||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||||
#include "MediaViews.h"
|
#include "MediaViews.h"
|
||||||
|
|
||||||
#include <Alert.h>
|
|
||||||
#include <AutoDeleter.h>
|
#include <AutoDeleter.h>
|
||||||
#include <Box.h>
|
#include <Box.h>
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
@@ -48,11 +47,9 @@
|
|||||||
|
|
||||||
SettingsView::SettingsView()
|
SettingsView::SettingsView()
|
||||||
:
|
:
|
||||||
BGridView(B_USE_DEFAULT_SPACING, B_USE_DEFAULT_SPACING),
|
BGroupView(B_VERTICAL, B_USE_DEFAULT_SPACING),
|
||||||
fRealtimeCheckBox(NULL),
|
|
||||||
fInputMenu(NULL),
|
fInputMenu(NULL),
|
||||||
fOutputMenu(NULL),
|
fOutputMenu(NULL)
|
||||||
fRestartView(NULL)
|
|
||||||
{
|
{
|
||||||
// input menu
|
// input menu
|
||||||
fInputMenu = new BPopUpMenu(B_TRANSLATE("<none>"));
|
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*
|
BButton*
|
||||||
SettingsView::MakeRestartButton()
|
SettingsView::MakeRestartButton()
|
||||||
{
|
{
|
||||||
@@ -179,7 +123,6 @@ SettingsView::MessageReceived(BMessage* message)
|
|||||||
NodeMenuItem* item
|
NodeMenuItem* item
|
||||||
= static_cast<NodeMenuItem*>(fInputMenu->ItemAt(index));
|
= static_cast<NodeMenuItem*>(fInputMenu->ItemAt(index));
|
||||||
SetDefaultInput(item->NodeInfo());
|
SetDefaultInput(item->NodeInfo());
|
||||||
RestartRequired(true);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MEDIA_DEFAULT_OUTPUT_CHANGE:
|
case MEDIA_DEFAULT_OUTPUT_CHANGE:
|
||||||
@@ -190,18 +133,10 @@ SettingsView::MessageReceived(BMessage* message)
|
|||||||
NodeMenuItem* item
|
NodeMenuItem* item
|
||||||
= static_cast<NodeMenuItem*>(fOutputMenu->ItemAt(index));
|
= static_cast<NodeMenuItem*>(fOutputMenu->ItemAt(index));
|
||||||
SetDefaultOutput(item->NodeInfo());
|
SetDefaultOutput(item->NodeInfo());
|
||||||
RestartRequired(true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case ML_ENABLE_REAL_TIME:
|
|
||||||
{
|
|
||||||
uint32 flags = 0;
|
|
||||||
if (message->FindUInt32("flags", &flags) == B_OK)
|
|
||||||
_FlipRealtimeFlag(flags);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
BGridView::MessageReceived(message);
|
BGroupView::MessageReceived(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,17 +147,6 @@ SettingsView::AttachedToWindow()
|
|||||||
BMessenger thisMessenger(this);
|
BMessenger thisMessenger(this);
|
||||||
fInputMenu->SetTargetForItems(thisMessenger);
|
fInputMenu->SetTargetForItems(thisMessenger);
|
||||||
fOutputMenu->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
|
void
|
||||||
SettingsView::_EmptyMenu(BMenu* menu)
|
SettingsView::_EmptyMenu(BMenu* menu)
|
||||||
{
|
{
|
||||||
@@ -372,30 +274,22 @@ AudioSettingsView::AudioSettingsView()
|
|||||||
B_TRANSLATE("Audio output:"), OutputMenu(), NULL);
|
B_TRANSLATE("Audio output:"), OutputMenu(), NULL);
|
||||||
|
|
||||||
BLayoutBuilder::Grid<>(defaultsGridView)
|
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(inputMenuField, 0, 0, B_ALIGN_HORIZONTAL_UNSET, 1, 3, 1)
|
||||||
.AddMenuField(outputMenuField, 0, 1)
|
.AddMenuField(outputMenuField, 0, 1)
|
||||||
.AddMenuField(_MakeChannelMenu(), 2, 1)
|
.AddMenuField(_MakeChannelMenu(), 2, 1);
|
||||||
.Add(MakeRestartMessageView(), 0, 2, 4, 1);
|
|
||||||
|
|
||||||
defaultsBox->AddChild(defaultsGridView);
|
defaultsBox->AddChild(defaultsGridView);
|
||||||
|
|
||||||
const char* realtimeLabel = B_TRANSLATE("Enable real-time audio");
|
BLayoutBuilder::Group<>(this)
|
||||||
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)
|
|
||||||
.SetInsets(0, 0, 0, 0)
|
.SetInsets(0, 0, 0, 0)
|
||||||
.Add(defaultsBox, 0, 0, 2, 1)
|
.Add(defaultsBox)
|
||||||
.Add(MakeRealtimeBox(realtimeInfo, B_MEDIA_REALTIME_AUDIO,
|
.AddGroup(B_HORIZONTAL)
|
||||||
realtimeLabel), 0, 1, 2, 1)
|
.Add(_MakeVolumeCheckBox())
|
||||||
.Add(_MakeVolumeCheckBox(),0, 2, 1, 1)
|
.Add(MakeRestartButton())
|
||||||
.Add(MakeRestartButton(), 1, 2, 1, 1)
|
.End()
|
||||||
.SetRowWeight(1, 10);
|
.AddGlue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -420,13 +314,6 @@ AudioSettingsView::AttachedToWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BString
|
|
||||||
AudioSettingsView::UnimplementedRealtimeError()
|
|
||||||
{
|
|
||||||
return B_TRANSLATE("Real-time audio is currently unimplemented in Haiku.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioSettingsView::MessageReceived(BMessage* message)
|
AudioSettingsView::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
@@ -441,7 +328,6 @@ AudioSettingsView::MessageReceived(BMessage* message)
|
|||||||
if (item) {
|
if (item) {
|
||||||
BMediaRoster* roster = BMediaRoster::Roster();
|
BMediaRoster* roster = BMediaRoster::Roster();
|
||||||
roster->SetAudioOutput(*item->Input());
|
roster->SetAudioOutput(*item->Input());
|
||||||
RestartRequired(true);
|
|
||||||
} else
|
} else
|
||||||
fprintf(stderr, "ChannelMenuItem not found\n");
|
fprintf(stderr, "ChannelMenuItem not found\n");
|
||||||
}
|
}
|
||||||
@@ -615,27 +501,21 @@ VideoSettingsView::VideoSettingsView()
|
|||||||
B_TRANSLATE("Video output:"), OutputMenu(), NULL);
|
B_TRANSLATE("Video output:"), OutputMenu(), NULL);
|
||||||
|
|
||||||
BLayoutBuilder::Grid<>(defaultsGridView)
|
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(inputMenuField, 0, 0)
|
||||||
.AddMenuField(outputMenuField, 0, 1)
|
.AddMenuField(outputMenuField, 0, 1);
|
||||||
.Add(MakeRestartMessageView(), 0, 2, 2, 1);
|
|
||||||
|
|
||||||
defaultsBox->AddChild(defaultsGridView);
|
defaultsBox->AddChild(defaultsGridView);
|
||||||
|
|
||||||
const char* realtimeLabel = B_TRANSLATE("Enable real-time video");
|
BLayoutBuilder::Group<>(this)
|
||||||
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)
|
|
||||||
.SetInsets(0, 0, 0, 0)
|
.SetInsets(0, 0, 0, 0)
|
||||||
.Add(defaultsBox, 0, 0, 2, 1)
|
.Add(defaultsBox)
|
||||||
.Add(MakeRealtimeBox(realtimeInfo, B_MEDIA_REALTIME_VIDEO,
|
.AddGroup(B_HORIZONTAL)
|
||||||
realtimeLabel), 0, 1, 2, 1)
|
.AddGlue()
|
||||||
.Add(MakeRestartButton(), 1, 2, 1, 1)
|
.Add(MakeRestartButton())
|
||||||
.SetRowWeight(1, 10);
|
.End()
|
||||||
|
.AddGlue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -655,11 +535,3 @@ VideoSettingsView::SetDefaultOutput(const dormant_node_info* info)
|
|||||||
_MediaWindow()->UpdateOutputListItem(MediaListItem::VIDEO_TYPE, info);
|
_MediaWindow()->UpdateOutputListItem(MediaListItem::VIDEO_TYPE, info);
|
||||||
BMediaRoster::Roster()->SetVideoOutput(*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__
|
#ifndef __MEDIAVIEWS_H__
|
||||||
#define __MEDIAVIEWS_H__
|
#define __MEDIAVIEWS_H__
|
||||||
#include <GridView.h>
|
#include <GroupView.h>
|
||||||
#include <MediaAddOn.h>
|
#include <MediaAddOn.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
|
|
||||||
@@ -33,7 +33,6 @@ class MediaWindow;
|
|||||||
|
|
||||||
|
|
||||||
const uint32 ML_RESTART_MEDIA_SERVER = 'resr';
|
const uint32 ML_RESTART_MEDIA_SERVER = 'resr';
|
||||||
const uint32 ML_ENABLE_REAL_TIME = 'enrt';
|
|
||||||
const uint32 ML_DEFAULT_CHANNEL_CHANGED = 'chch';
|
const uint32 ML_DEFAULT_CHANNEL_CHANGED = 'chch';
|
||||||
|
|
||||||
|
|
||||||
@@ -70,7 +69,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SettingsView : public BGridView
|
class SettingsView : public BGroupView
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef BObjectList<dormant_node_info> NodeList;
|
typedef BObjectList<dormant_node_info> NodeList;
|
||||||
@@ -85,37 +84,26 @@ public:
|
|||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
|
|
||||||
void RestartRequired(bool required);
|
|
||||||
virtual BString UnimplementedRealtimeError() = 0;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
BMenu* InputMenu() {return fInputMenu;}
|
BMenu* InputMenu() {return fInputMenu;}
|
||||||
BMenu* OutputMenu() {return fOutputMenu;}
|
BMenu* OutputMenu() {return fOutputMenu;}
|
||||||
|
|
||||||
BBox* MakeRealtimeBox(const char* info,
|
|
||||||
uint32 realtimeMask,
|
|
||||||
const char* checkboxLabel);
|
|
||||||
BStringView* MakeRestartMessageView();
|
|
||||||
BButton* MakeRestartButton();
|
BButton* MakeRestartButton();
|
||||||
|
|
||||||
void _EmptyMenu(BMenu* menu);
|
void _EmptyMenu(BMenu* menu);
|
||||||
MediaWindow* _MediaWindow() const;
|
MediaWindow* _MediaWindow() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _FlipRealtimeFlag(uint32 mask);
|
|
||||||
|
|
||||||
void _PopulateMenu(BMenu* menu, NodeList& nodes,
|
void _PopulateMenu(BMenu* menu, NodeList& nodes,
|
||||||
const BMessage& message);
|
const BMessage& message);
|
||||||
NodeMenuItem* _FindNodeItem(BMenu* menu,
|
NodeMenuItem* _FindNodeItem(BMenu* menu,
|
||||||
const dormant_node_info* nodeInfo);
|
const dormant_node_info* nodeInfo);
|
||||||
void _ClearMenuSelection(BMenu* menu);
|
void _ClearMenuSelection(BMenu* menu);
|
||||||
|
|
||||||
BCheckBox* fRealtimeCheckBox;
|
|
||||||
|
|
||||||
BMenu* fInputMenu;
|
BMenu* fInputMenu;
|
||||||
BMenu* fOutputMenu;
|
BMenu* fOutputMenu;
|
||||||
BStringView* fRestartView;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -132,8 +120,6 @@ public:
|
|||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
|
|
||||||
virtual BString UnimplementedRealtimeError();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BMenuField* _MakeChannelMenu();
|
BMenuField* _MakeChannelMenu();
|
||||||
BCheckBox* _MakeVolumeCheckBox();
|
BCheckBox* _MakeVolumeCheckBox();
|
||||||
@@ -156,8 +142,6 @@ public:
|
|||||||
|
|
||||||
virtual void SetDefaultInput(const dormant_node_info* info);
|
virtual void SetDefaultInput(const dormant_node_info* info);
|
||||||
virtual void SetDefaultOutput(const dormant_node_info* info);
|
virtual void SetDefaultOutput(const dormant_node_info* info);
|
||||||
|
|
||||||
virtual BString UnimplementedRealtimeError();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -531,9 +531,6 @@ MediaWindow::InitMedia(bool first)
|
|||||||
if (first) {
|
if (first) {
|
||||||
fListView->Select(fListView->IndexOf(mixer));
|
fListView->Select(fListView->IndexOf(mixer));
|
||||||
} else {
|
} else {
|
||||||
fAudioView->RestartRequired(false);
|
|
||||||
fVideoView->RestartRequired(false);
|
|
||||||
|
|
||||||
if (isVideoSelected)
|
if (isVideoSelected)
|
||||||
fListView->Select(fListView->IndexOf(video));
|
fListView->Select(fListView->IndexOf(video));
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user