fixed naming of variables
fixed some font sensitiveness issues git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16462 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
38b52de937
commit
b4a124700c
@ -14,7 +14,7 @@ Preference Media :
|
||||
MediaViews.cpp
|
||||
MediaListItem.cpp
|
||||
MediaAlert.cpp
|
||||
: be media
|
||||
: media be
|
||||
: media.rdef
|
||||
;
|
||||
|
||||
|
@ -56,8 +56,8 @@ Media::Media()
|
||||
}
|
||||
}
|
||||
|
||||
mWindow = new MediaWindow(rect);
|
||||
mWindow->SetSizeLimits(605.0, 10000.0, 378.0, 10000.0);
|
||||
fWindow = new MediaWindow(rect);
|
||||
fWindow->SetSizeLimits(605.0, 10000.0, 378.0, 10000.0);
|
||||
|
||||
be_roster->StartWatching(BMessenger(this));
|
||||
}
|
||||
@ -72,8 +72,8 @@ Media::~Media()
|
||||
status_t
|
||||
Media::InitCheck()
|
||||
{
|
||||
if (mWindow)
|
||||
return mWindow->InitCheck();
|
||||
if (fWindow)
|
||||
return fWindow->InitCheck();
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ void Media::MessageReceived (BMessage *message)
|
||||
{
|
||||
case B_SOME_APP_LAUNCHED:
|
||||
case B_SOME_APP_QUIT:
|
||||
mWindow->PostMessage(message);
|
||||
fWindow->PostMessage(message);
|
||||
break;
|
||||
default:
|
||||
BApplication::MessageReceived(message); // pass it along ...
|
||||
|
@ -32,7 +32,7 @@ class Media : public BApplication
|
||||
status_t InitCheck();
|
||||
|
||||
private:
|
||||
MediaWindow *mWindow;
|
||||
MediaWindow *fWindow;
|
||||
|
||||
};
|
||||
|
||||
|
@ -26,28 +26,28 @@
|
||||
// MediaListItem - Constructor
|
||||
MediaListItem::MediaListItem(dormant_node_info *info, uint32 level, bool isVideo, BList *icons, uint32 modifiers)
|
||||
: BListItem(level),
|
||||
mIsAudioMixer(false),
|
||||
mIsVideo(isVideo),
|
||||
mIsDefaultInput(false),
|
||||
mIsDefaultOutput(false)
|
||||
fIsAudioMixer(false),
|
||||
fIsVideo(isVideo),
|
||||
fIsDefaultInput(false),
|
||||
fIsDefaultOutput(false)
|
||||
{
|
||||
mIcons = icons;
|
||||
mInfo = info;
|
||||
mLabel = mInfo->name;
|
||||
fIcons = icons;
|
||||
fInfo = info;
|
||||
fLabel = fInfo->name;
|
||||
|
||||
SetHeight(16 + kITEM_MARGIN);
|
||||
}
|
||||
|
||||
MediaListItem::MediaListItem(const char *label, uint32 level, bool isVideo, BList *icons, uint32 modifiers)
|
||||
: BListItem(level),
|
||||
mLabel(label),
|
||||
mIsAudioMixer(false),
|
||||
mIsVideo(isVideo),
|
||||
mIsDefaultInput(false),
|
||||
mIsDefaultOutput(false)
|
||||
fLabel(label),
|
||||
fIsAudioMixer(false),
|
||||
fIsVideo(isVideo),
|
||||
fIsDefaultInput(false),
|
||||
fIsDefaultOutput(false)
|
||||
{
|
||||
mIcons = icons;
|
||||
mInfo = NULL;
|
||||
fIcons = icons;
|
||||
fInfo = NULL;
|
||||
|
||||
SetHeight(16 + kITEM_MARGIN);
|
||||
}
|
||||
@ -86,32 +86,32 @@ MediaListItem::DrawItem(BView *owner, BRect frame, bool complete)
|
||||
BRect iconFrame(frame);
|
||||
iconFrame.Set(iconFrame.left, iconFrame.top+1, iconFrame.left+15, iconFrame.top+16);
|
||||
uint32 index = 0;
|
||||
if(OutlineLevel()==0 || (mIsDefaultInput&&mIsDefaultOutput)) {
|
||||
if(mIsDefaultInput && mIsVideo)
|
||||
if(OutlineLevel()==0 || (fIsDefaultInput && fIsDefaultOutput)) {
|
||||
if(fIsDefaultInput && fIsVideo)
|
||||
index = 4;
|
||||
else if(mIsDefaultInput && !mIsVideo)
|
||||
else if(fIsDefaultInput && !fIsVideo)
|
||||
index = 2;
|
||||
owner->SetDrawingMode(B_OP_OVER);
|
||||
owner->DrawBitmap(static_cast<BBitmap*>(mIcons->ItemAt(index)), iconFrame);
|
||||
owner->DrawBitmap(static_cast<BBitmap*>(fIcons->ItemAt(index)), iconFrame);
|
||||
owner->SetDrawingMode(B_OP_COPY);
|
||||
}
|
||||
iconFrame.OffsetBy(16, 0);
|
||||
if(mIsDefaultInput || mIsDefaultOutput || mIsAudioMixer) {
|
||||
if(mIsAudioMixer)
|
||||
if(fIsDefaultInput || fIsDefaultOutput || fIsAudioMixer) {
|
||||
if(fIsAudioMixer)
|
||||
index = 1;
|
||||
else if(mIsDefaultOutput) {
|
||||
if(mIsVideo)
|
||||
else if(fIsDefaultOutput) {
|
||||
if(fIsVideo)
|
||||
index = 5;
|
||||
else
|
||||
index = 3;
|
||||
} else {
|
||||
if(mIsVideo)
|
||||
if(fIsVideo)
|
||||
index = 4;
|
||||
else
|
||||
index = 2;
|
||||
}
|
||||
owner->SetDrawingMode(B_OP_OVER);
|
||||
owner->DrawBitmap(static_cast<BBitmap*>(mIcons->ItemAt(index)), iconFrame);
|
||||
owner->DrawBitmap(static_cast<BBitmap*>(fIcons->ItemAt(index)), iconFrame);
|
||||
owner->SetDrawingMode(B_OP_COPY);
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ MediaListItem::DrawItem(BView *owner, BRect frame, bool complete)
|
||||
owner->SetFont(&font);
|
||||
owner->MovePenTo(frame.left+8, frame.top + ((frame.Height() - (finfo.ascent + finfo.descent + finfo.leading)) / 2) +
|
||||
(finfo.ascent + finfo.descent) - 1);
|
||||
owner->DrawString(mLabel);
|
||||
owner->DrawString(fLabel);
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------------------//
|
||||
|
||||
@ -132,15 +132,15 @@ void
|
||||
MediaListItem::SetDefault(bool isDefault, bool isInput)
|
||||
{
|
||||
if(isInput)
|
||||
mIsDefaultInput = isDefault;
|
||||
fIsDefaultInput = isDefault;
|
||||
else
|
||||
mIsDefaultOutput = isDefault;
|
||||
fIsDefaultOutput = isDefault;
|
||||
}
|
||||
|
||||
void
|
||||
MediaListItem::SetAudioMixer(bool isAudioMixer)
|
||||
{
|
||||
mIsAudioMixer = isAudioMixer;
|
||||
fIsAudioMixer = isAudioMixer;
|
||||
}
|
||||
|
||||
void
|
||||
@ -159,11 +159,11 @@ MediaListItem::Compare(const void *firstArg, const void *secondArg)
|
||||
{
|
||||
const MediaListItem *item1 = *static_cast<const MediaListItem * const *>(firstArg);
|
||||
const MediaListItem *item2 = *static_cast<const MediaListItem * const *>(secondArg);
|
||||
if(item1->mIsVideo != item2->mIsVideo)
|
||||
return item1->mIsVideo ? 1 : -1;
|
||||
if(item1->fIsVideo != item2->fIsVideo)
|
||||
return item1->fIsVideo ? 1 : -1;
|
||||
if(item1->OutlineLevel()!=item2->OutlineLevel())
|
||||
return item1->OutlineLevel()>item2->OutlineLevel() ? 1 : -1;
|
||||
if(item1->mIsAudioMixer!=item2->mIsAudioMixer)
|
||||
return item2->mIsAudioMixer ? 1 : -1;
|
||||
return strcmp(item1->mLabel, item2->mLabel);
|
||||
if(item1->fIsAudioMixer!=item2->fIsAudioMixer)
|
||||
return item2->fIsAudioMixer ? 1 : -1;
|
||||
return strcmp(item1->fLabel, item2->fLabel);
|
||||
}
|
||||
|
@ -31,23 +31,23 @@ class MediaListItem : public BListItem {
|
||||
|
||||
void SetDefault(bool isDefaultInput, bool isInput);
|
||||
void SetAudioMixer(bool isAudioMixer);
|
||||
bool IsDefault(bool isInput) { return isInput ? mIsDefaultInput : mIsDefaultOutput; }
|
||||
bool IsAudioMixer() { return mIsAudioMixer; }
|
||||
bool IsVideo() { return mIsVideo; }
|
||||
const char *GetLabel() { return mLabel; }
|
||||
bool IsDefault(bool isInput) { return isInput ? fIsDefaultInput : fIsDefaultOutput; }
|
||||
bool IsAudioMixer() { return fIsAudioMixer; }
|
||||
bool IsVideo() { return fIsVideo; }
|
||||
const char *GetLabel() { return fLabel; }
|
||||
|
||||
dormant_node_info *mInfo;
|
||||
dormant_node_info *fInfo;
|
||||
|
||||
static int Compare(const void *firstArg, const void *secondArg);
|
||||
|
||||
private:
|
||||
const char *mLabel;
|
||||
bool mIsAudioMixer;
|
||||
bool mIsVideo;
|
||||
bool mIsDefaultInput;
|
||||
bool mIsDefaultOutput;
|
||||
dormant_node_info node_info;
|
||||
BList *mIcons;
|
||||
const char *fLabel;
|
||||
bool fIsAudioMixer;
|
||||
bool fIsVideo;
|
||||
bool fIsDefaultInput;
|
||||
bool fIsDefaultOutput;
|
||||
//dormant_node_info fNodeInfo;
|
||||
BList *fIcons;
|
||||
};
|
||||
|
||||
#endif /* __MEDIALISTITEM_H__ */
|
||||
|
@ -17,7 +17,6 @@
|
||||
// Includes -------------------------------------------------------------------------------------------------- //
|
||||
#include <Box.h>
|
||||
#include <Button.h>
|
||||
#include <TextView.h>
|
||||
#include <MenuField.h>
|
||||
#include <PopUpMenu.h>
|
||||
#include <MediaRoster.h>
|
||||
@ -26,11 +25,12 @@
|
||||
#include <stdio.h>
|
||||
#include <MediaAddOn.h>
|
||||
#include <String.h>
|
||||
#include <TextView.h>
|
||||
#include "MediaViews.h"
|
||||
|
||||
BarView::BarView(BRect frame)
|
||||
: BView (frame, "barView", B_FOLLOW_LEFT_RIGHT, B_WILL_DRAW ),
|
||||
mDisplay(true)
|
||||
fDisplay(true)
|
||||
{
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ BarView::Draw(BRect updateRect)
|
||||
{
|
||||
BRect r = Bounds();
|
||||
|
||||
if(mDisplay) {
|
||||
if(fDisplay) {
|
||||
// Display the 3D Look Divider Bar
|
||||
SetHighColor(140,140,140,0);
|
||||
StrokeLine(BPoint(r.left,r.top),BPoint(r.right,r.top));
|
||||
@ -55,7 +55,7 @@ BarView::Draw(BRect updateRect)
|
||||
|
||||
SettingsView::SettingsView (BRect frame, bool isVideo)
|
||||
: BView (frame, "SettingsView", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW ),
|
||||
mIsVideo(isVideo)
|
||||
fIsVideo(isVideo)
|
||||
{
|
||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
BRect rect(frame);
|
||||
@ -64,48 +64,47 @@ SettingsView::SettingsView (BRect frame, bool isVideo)
|
||||
rect.right -=21;
|
||||
rect.bottom = rect.top + 104;
|
||||
BBox *defaultsBox = new BBox(rect, "defaults");
|
||||
defaultsBox->SetLabel(mIsVideo ? "Default Nodes" : "Defaults");
|
||||
defaultsBox->SetLabel(fIsVideo ? "Default Nodes" : "Defaults");
|
||||
AddChild(defaultsBox);
|
||||
|
||||
BRect defaultRect(20, 22, 250, 40);
|
||||
float divider = StringWidth(mIsVideo ? "Video Output:" : "Audio Output:") + 5;
|
||||
mMenu1 = new BPopUpMenu("<none>");
|
||||
mMenu1->SetLabelFromMarked(true);
|
||||
float divider = StringWidth(fIsVideo ? "Video Output:" : "Audio Output:") + 5;
|
||||
fMenu1 = new BPopUpMenu("<none>");
|
||||
fMenu1->SetLabelFromMarked(true);
|
||||
BMenuField *menuField1 = new BMenuField(defaultRect, "menuField1",
|
||||
mIsVideo ? "Video Input:" : "Audio Input:", mMenu1);
|
||||
fIsVideo ? "Video Input:" : "Audio Input:", fMenu1);
|
||||
defaultsBox->AddChild(menuField1);
|
||||
menuField1->SetDivider(divider);
|
||||
|
||||
defaultRect.OffsetBy(0, 26);
|
||||
mMenu2 = new BPopUpMenu("<none>");
|
||||
mMenu2->SetLabelFromMarked(true);
|
||||
fMenu2 = new BPopUpMenu("<none>");
|
||||
fMenu2->SetLabelFromMarked(true);
|
||||
BMenuField *menuField2 = new BMenuField(defaultRect, "menuField2",
|
||||
mIsVideo ? "Video Output:" : "Audio Output:", mMenu2);
|
||||
fIsVideo ? "Video Output:" : "Audio Output:", fMenu2);
|
||||
defaultsBox->AddChild(menuField2);
|
||||
menuField2->SetDivider(divider);
|
||||
|
||||
if(!mIsVideo) {
|
||||
if(!fIsVideo) {
|
||||
defaultRect.OffsetBy(186, 0);
|
||||
mMenu3 = new BPopUpMenu("<none>");
|
||||
mMenu3->SetLabelFromMarked(true);
|
||||
BMenuField *mMenuField3 = new BMenuField(defaultRect, "menuField3",
|
||||
"Channel:", mMenu3);
|
||||
defaultsBox->AddChild(mMenuField3);
|
||||
mMenuField3->SetDivider(StringWidth("Channel:")+5);
|
||||
defaultRect.right -= 30;
|
||||
fMenu3 = new BPopUpMenu("<none>");
|
||||
fMenu3->SetLabelFromMarked(true);
|
||||
BMenuField *menuField3 = new BMenuField(defaultRect, "menuField3",
|
||||
"Channel:", fMenu3);
|
||||
defaultsBox->AddChild(menuField3);
|
||||
menuField3->SetDivider(StringWidth("Channel:")+5);
|
||||
defaultRect.right += 30;
|
||||
defaultRect.OffsetBy(-186, 0);
|
||||
}
|
||||
|
||||
defaultRect.OffsetBy(0, 32);
|
||||
BRect restartTextRect(defaultRect);
|
||||
restartTextRect.OffsetTo(B_ORIGIN);
|
||||
restartTextRect.InsetBy(1,1);
|
||||
defaultRect.right += 100;
|
||||
rgb_color red_color = {222, 32, 33};
|
||||
mRestartTextView = new BTextView(defaultRect, "restartTextView", restartTextRect,
|
||||
be_plain_font, &red_color, B_FOLLOW_ALL, B_WILL_DRAW);
|
||||
mRestartTextView->Insert("Restart the Media Server to apply changes.");
|
||||
mRestartTextView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||
defaultsBox->AddChild(mRestartTextView);
|
||||
mRestartTextView->Hide();
|
||||
fRestartView = new BStringView(defaultRect, "restartStringView", "Restart the Media Server to apply changes.",
|
||||
B_FOLLOW_ALL, B_WILL_DRAW);
|
||||
fRestartView->SetHighColor(red_color);
|
||||
defaultsBox->AddChild(fRestartView);
|
||||
fRestartView->Hide();
|
||||
|
||||
rect.top = rect.bottom + 10;
|
||||
rect.bottom = rect.top + 162;
|
||||
@ -114,25 +113,28 @@ SettingsView::SettingsView (BRect frame, bool isVideo)
|
||||
AddChild(realtimeBox);
|
||||
|
||||
BMessage *message = new BMessage(ML_ENABLE_REAL_TIME);
|
||||
message->AddBool("isVideo", mIsVideo);
|
||||
message->AddBool("isVideo", fIsVideo);
|
||||
BRect rect2(22,20, 190, 40);
|
||||
mRealtimeCheckBox = new BCheckBox(rect2, "realtimeCheckBox",
|
||||
mIsVideo ? "Enable Real-Time Video" : "Enable Real-Time Audio", message);
|
||||
realtimeBox->AddChild(mRealtimeCheckBox);
|
||||
fRealtimeCheckBox = new BCheckBox(rect2, "realtimeCheckBox",
|
||||
fIsVideo ? "Enable Real-Time Video" : "Enable Real-Time Audio", message);
|
||||
realtimeBox->AddChild(fRealtimeCheckBox);
|
||||
|
||||
uint32 flags;
|
||||
BMediaRoster::Roster()->GetRealtimeFlags(&flags);
|
||||
if(flags & (mIsVideo ? B_MEDIA_REALTIME_VIDEO : B_MEDIA_REALTIME_AUDIO))
|
||||
mRealtimeCheckBox->SetValue(B_CONTROL_ON);
|
||||
if(flags & (fIsVideo ? B_MEDIA_REALTIME_VIDEO : B_MEDIA_REALTIME_AUDIO))
|
||||
fRealtimeCheckBox->SetValue(B_CONTROL_ON);
|
||||
|
||||
rect2.top += 26;
|
||||
rect2.bottom = rect.Height() - 5;
|
||||
rect2.right = rect.right - 15;
|
||||
BRect textRect(3, 3, rect2.Width() - 3, rect2.Height() - 3);
|
||||
BTextView *textView = new BTextView(rect2, "textView", textRect, B_FOLLOW_ALL, B_WILL_DRAW);
|
||||
textView->Insert(mIsVideo ? "Enabling Real-Time Video allows the BeOS to perform video operations as fast and smoothly as possible. It achieves optimum performance by using more RAM."
|
||||
: "Enabling Real-time Audio allows BeOS to record and play audio as fast as possible. It achieves this performance by using more CPU and RAM.");
|
||||
textView->Insert("\n\nOnly enable this feature if you need the lowest latency possible.");
|
||||
BTextView *textView = new BTextView(rect2, "stringView", textRect, B_FOLLOW_ALL, B_WILL_DRAW);
|
||||
textView->Insert(fIsVideo ? "Enabling Real-Time Video allows the BeOS 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."
|
||||
: "Enabling Real-time Audio allows BeOS 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));
|
||||
realtimeBox->AddChild(textView);
|
||||
|
||||
@ -143,30 +145,32 @@ SettingsView::SettingsView (BRect frame, bool isVideo)
|
||||
"Restart Media Services", new BMessage(ML_RESTART_MEDIA_SERVER));
|
||||
AddChild(restartButton);
|
||||
|
||||
if(!mIsVideo) {
|
||||
if(!fIsVideo) {
|
||||
rect.right = rect.left - 10;
|
||||
rect.top += 4;
|
||||
rect.left = frame.left + 33;
|
||||
rect.right = rect.left + 180;
|
||||
if (StringWidth("Show Volume Control on Deskbar") > rect.Width() - 30)
|
||||
rect.left -= 10;
|
||||
|
||||
mVolumeCheckBox = new BCheckBox(rect, "volumeCheckBox",
|
||||
fVolumeCheckBox = new BCheckBox(rect, "volumeCheckBox",
|
||||
"Show Volume Control on Deskbar", new BMessage(ML_SHOW_VOLUME_CONTROL));
|
||||
AddChild(mVolumeCheckBox);
|
||||
AddChild(fVolumeCheckBox);
|
||||
|
||||
if(BDeskbar().HasItem("MediaReplicant"))
|
||||
mVolumeCheckBox->SetValue(B_CONTROL_ON);
|
||||
fVolumeCheckBox->SetValue(B_CONTROL_ON);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SettingsView::AddNodes(BList &list, bool isInput)
|
||||
{
|
||||
BMenu *menu = isInput ? mMenu1 : mMenu2;
|
||||
BMenu *menu = isInput ? fMenu1 : fMenu2;
|
||||
void *item;
|
||||
while ((item = menu->RemoveItem((int32)0)) != NULL)
|
||||
delete static_cast<dormant_node_info *>(item);
|
||||
|
||||
BMessage message(ML_DEFAULT_CHANGE);
|
||||
message.AddBool("isVideo", mIsVideo);
|
||||
message.AddBool("isVideo", fIsVideo);
|
||||
message.AddBool("isInput", isInput);
|
||||
|
||||
for (int32 i = 0; i < list.CountItems(); i++) {
|
||||
@ -178,19 +182,19 @@ SettingsView::AddNodes(BList &list, bool isInput)
|
||||
void
|
||||
SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID)
|
||||
{
|
||||
BMenu *menu = isInput ? mMenu1 : mMenu2;
|
||||
BMenu *menu = isInput ? fMenu1 : fMenu2;
|
||||
|
||||
for (int32 i = 0; i < menu->CountItems(); i++) {
|
||||
SettingsItem *item = static_cast<SettingsItem *>(menu->ItemAt(i));
|
||||
if(item->mInfo && item->mInfo->addon == info.addon && item->mInfo->flavor_id == info.flavor_id) {
|
||||
if(item->fInfo && item->fInfo->addon == info.addon && item->fInfo->flavor_id == info.flavor_id) {
|
||||
item->SetMarked(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!mIsVideo&&!isInput&&outputID>-1) {
|
||||
if (!fIsVideo&&!isInput&&outputID>-1) {
|
||||
BMenuItem *item;
|
||||
while ((item = mMenu3->RemoveItem((int32)0)) != NULL)
|
||||
while ((item = fMenu3->RemoveItem((int32)0)) != NULL)
|
||||
delete item;
|
||||
BMediaRoster *roster = BMediaRoster::Roster();
|
||||
media_node node;
|
||||
@ -210,7 +214,7 @@ SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID)
|
||||
for (int32 i = 0; i < inputCount; i++) {
|
||||
media_input *input = new media_input();
|
||||
memcpy(input, &inputs[i], sizeof(*input));
|
||||
mMenu3->AddItem(item = new Settings2Item(&info, input, new BMessage(message)));
|
||||
fMenu3->AddItem(item = new Settings2Item(&info, input, new BMessage(message)));
|
||||
if(inputs[i].destination.id == outputID)
|
||||
item->SetMarked(true);
|
||||
}
|
||||
@ -222,7 +226,7 @@ SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID)
|
||||
SettingsItem::SettingsItem(dormant_node_info *info, BMessage *message,
|
||||
char shortcut, uint32 modifiers)
|
||||
: BMenuItem(info->name, message, shortcut, modifiers),
|
||||
mInfo(info)
|
||||
fInfo(info)
|
||||
{
|
||||
|
||||
}
|
||||
@ -230,14 +234,14 @@ SettingsItem::SettingsItem(dormant_node_info *info, BMessage *message,
|
||||
Settings2Item::Settings2Item(dormant_node_info *info, media_input *input, BMessage *message,
|
||||
char shortcut, uint32 modifiers)
|
||||
: BMenuItem(input->name, message, shortcut, modifiers),
|
||||
mInfo(info),
|
||||
mInput(input)
|
||||
fInfo(info),
|
||||
fInput(input)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Settings2Item::~Settings2Item()
|
||||
{
|
||||
delete mInput;
|
||||
delete fInput;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#define __MEDIAVIEWS_H__
|
||||
#include <CheckBox.h>
|
||||
#include <MenuItem.h>
|
||||
#include <TextView.h>
|
||||
#include <StringView.h>
|
||||
#include <View.h>
|
||||
|
||||
const uint32 ML_RESTART_MEDIA_SERVER = 'resr';
|
||||
@ -32,7 +32,7 @@ class BarView : public BView
|
||||
public:
|
||||
BarView(BRect frame);
|
||||
virtual void Draw(BRect updateRect);
|
||||
bool mDisplay;
|
||||
bool fDisplay;
|
||||
};
|
||||
|
||||
class SettingsItem : public BMenuItem
|
||||
@ -40,7 +40,7 @@ class SettingsItem : public BMenuItem
|
||||
public:
|
||||
SettingsItem(dormant_node_info *info, BMessage *message,
|
||||
char shortcut = 0, uint32 modifiers = 0);
|
||||
dormant_node_info *mInfo;
|
||||
dormant_node_info *fInfo;
|
||||
};
|
||||
|
||||
class Settings2Item : public BMenuItem
|
||||
@ -49,8 +49,8 @@ class Settings2Item : public BMenuItem
|
||||
Settings2Item(dormant_node_info *info, media_input *input, BMessage *message,
|
||||
char shortcut = 0, uint32 modifiers = 0);
|
||||
~Settings2Item();
|
||||
dormant_node_info *mInfo;
|
||||
media_input *mInput;
|
||||
dormant_node_info *fInfo;
|
||||
media_input *fInput;
|
||||
};
|
||||
|
||||
class SettingsView : public BView
|
||||
@ -59,15 +59,15 @@ class SettingsView : public BView
|
||||
SettingsView(BRect frame, bool isVideo);
|
||||
void AddNodes(BList &list, bool isInput);
|
||||
void SetDefault(dormant_node_info &info, bool isInput, int32 outputID = -1);
|
||||
BCheckBox *mRealtimeCheckBox;
|
||||
BCheckBox *mVolumeCheckBox;
|
||||
BMenu *mMenu1;
|
||||
BMenu *mMenu2;
|
||||
BMenu *mMenu3;
|
||||
BTextView *mRestartTextView;
|
||||
BCheckBox *fRealtimeCheckBox;
|
||||
BCheckBox *fVolumeCheckBox;
|
||||
BMenu *fMenu1;
|
||||
BMenu *fMenu2;
|
||||
BMenu *fMenu3;
|
||||
BStringView *fRestartView;
|
||||
|
||||
private:
|
||||
bool mIsVideo;
|
||||
bool fIsVideo;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -34,10 +34,10 @@ const uint32 ML_INIT_MEDIA = 'MlIM';
|
||||
// MediaWindow - Constructor
|
||||
MediaWindow::MediaWindow(BRect frame)
|
||||
: BWindow (frame, "Media", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS),
|
||||
mCurrentNode(NULL),
|
||||
mParamWeb(NULL),
|
||||
mAlert(NULL),
|
||||
mInitCheck(B_OK)
|
||||
fCurrentNode(NULL),
|
||||
fParamWeb(NULL),
|
||||
fAlert(NULL),
|
||||
fInitCheck(B_OK)
|
||||
{
|
||||
InitWindow();
|
||||
}
|
||||
@ -46,25 +46,25 @@ MediaWindow::MediaWindow(BRect frame)
|
||||
status_t
|
||||
MediaWindow::InitCheck()
|
||||
{
|
||||
return mInitCheck;
|
||||
return fInitCheck;
|
||||
}
|
||||
|
||||
|
||||
// MediaWindow - Destructor
|
||||
MediaWindow::~MediaWindow()
|
||||
{
|
||||
for(int i=0; i<mAudioOutputs.CountItems(); i++)
|
||||
delete static_cast<dormant_node_info *>(mAudioOutputs.ItemAt(i));
|
||||
for(int i=0; i<mAudioInputs.CountItems(); i++)
|
||||
delete static_cast<dormant_node_info *>(mAudioInputs.ItemAt(i));
|
||||
for(int i=0; i<mVideoOutputs.CountItems(); i++)
|
||||
delete static_cast<dormant_node_info *>(mVideoOutputs.ItemAt(i));
|
||||
for(int i=0; i<mVideoInputs.CountItems(); i++)
|
||||
delete static_cast<dormant_node_info *>(mVideoInputs.ItemAt(i));
|
||||
for(int i=0; i<fAudioOutputs.CountItems(); i++)
|
||||
delete static_cast<dormant_node_info *>(fAudioOutputs.ItemAt(i));
|
||||
for(int i=0; i<fAudioInputs.CountItems(); i++)
|
||||
delete static_cast<dormant_node_info *>(fAudioInputs.ItemAt(i));
|
||||
for(int i=0; i<fVideoOutputs.CountItems(); i++)
|
||||
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 && mCurrentNode)
|
||||
roster->ReleaseNode(*mCurrentNode);
|
||||
if(roster && fCurrentNode)
|
||||
roster->ReleaseNode(*fCurrentNode);
|
||||
|
||||
char buffer[512];
|
||||
BRect rect = Frame();
|
||||
@ -119,9 +119,9 @@ MediaWindow::FindNodes(media_type type, uint64 kind, BList &list)
|
||||
MediaListItem *
|
||||
MediaWindow::FindMediaListItem(dormant_node_info *info)
|
||||
{
|
||||
for(int32 j=0; j<mListView->CountItems(); j++) {
|
||||
MediaListItem *item = static_cast<MediaListItem *>(mListView->ItemAt(j));
|
||||
if(item->mInfo && item->mInfo->addon == info->addon && item->mInfo->flavor_id == info->flavor_id) {
|
||||
for(int32 j=0; j<fListView->CountItems(); j++) {
|
||||
MediaListItem *item = static_cast<MediaListItem *>(fListView->ItemAt(j));
|
||||
if(item->fInfo && item->fInfo->addon == info->addon && item->fInfo->flavor_id == info->flavor_id) {
|
||||
return item;
|
||||
break;
|
||||
}
|
||||
@ -136,7 +136,7 @@ MediaWindow::AddNodes(BList &list, bool isVideo)
|
||||
for(int32 i=0; i<list.CountItems(); i++) {
|
||||
dormant_node_info *info = static_cast<dormant_node_info *>(list.ItemAt(i));
|
||||
if(!FindMediaListItem(info))
|
||||
mListView->AddItem(new MediaListItem(info, 1, isVideo, &mIcons));
|
||||
fListView->AddItem(new MediaListItem(info, 1, isVideo, &fIcons));
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,22 +149,22 @@ MediaWindow::InitWindow(void)
|
||||
BRect iconRect(0,0,15,15);
|
||||
BBitmap *icon = new BBitmap(iconRect, B_CMAP8);
|
||||
icon->SetBits(kDevicesBits, kDevicesWidth*kDevicesHeight, 0, kDevicesColorSpace);
|
||||
mIcons.AddItem(icon);
|
||||
fIcons.AddItem(icon);
|
||||
icon = new BBitmap(iconRect, B_CMAP8);
|
||||
icon->SetBits(kMixerBits, kMixerWidth*kMixerHeight, 0, kMixerColorSpace);
|
||||
mIcons.AddItem(icon);
|
||||
fIcons.AddItem(icon);
|
||||
icon = new BBitmap(iconRect, B_CMAP8);
|
||||
icon->SetBits(kMicBits, kMicWidth*kMicHeight, 0, kMicColorSpace);
|
||||
mIcons.AddItem(icon);
|
||||
fIcons.AddItem(icon);
|
||||
icon = new BBitmap(iconRect, B_CMAP8);
|
||||
icon->SetBits(kSpeakerBits, kSpeakerWidth*kSpeakerHeight, 0, kSpeakerColorSpace);
|
||||
mIcons.AddItem(icon);
|
||||
fIcons.AddItem(icon);
|
||||
icon = new BBitmap(iconRect, B_CMAP8);
|
||||
icon->SetBits(kCamBits, kCamWidth*kCamHeight, 0, kCamColorSpace);
|
||||
mIcons.AddItem(icon);
|
||||
fIcons.AddItem(icon);
|
||||
icon = new BBitmap(iconRect, B_CMAP8);
|
||||
icon->SetBits(kTVBits, kTVWidth*kTVHeight, 0, kTVColorSpace);
|
||||
mIcons.AddItem(icon);
|
||||
fIcons.AddItem(icon);
|
||||
|
||||
|
||||
BRect bounds = Bounds(); // the whole view
|
||||
@ -172,43 +172,43 @@ MediaWindow::InitWindow(void)
|
||||
// Create the OutlineView
|
||||
BRect menuRect(bounds.left+14,bounds.top+14,bounds.left+146,bounds.bottom-14);
|
||||
BRect titleRect(menuRect.right+14,menuRect.top,bounds.right-10,menuRect.top+16);
|
||||
BRect availableRect(menuRect.right+15,titleRect.bottom+12,bounds.right-14,bounds.bottom-14);
|
||||
BRect availableRect(menuRect.right+15,titleRect.bottom+12,bounds.right-14,bounds.bottom-4);
|
||||
BRect barRect(titleRect.left,titleRect.bottom+10,titleRect.right-2,titleRect.bottom+11);
|
||||
|
||||
mListView = new BListView(menuRect,"audio_list", B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES);
|
||||
mListView->SetSelectionMessage(new BMessage(ML_SELECTED_NODE));
|
||||
fListView = new BListView(menuRect,"audio_list", B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES);
|
||||
fListView->SetSelectionMessage(new BMessage(ML_SELECTED_NODE));
|
||||
|
||||
// Add ScrollView to Media Menu
|
||||
BScrollView *scrollView = new BScrollView("scroll_audio", mListView, B_FOLLOW_LEFT|B_FOLLOW_TOP_BOTTOM, 0, false, false, B_FANCY_BORDER);
|
||||
BScrollView *scrollView = new BScrollView("scroll_audio", fListView, B_FOLLOW_LEFT|B_FOLLOW_TOP_BOTTOM, 0, false, false, B_FANCY_BORDER);
|
||||
|
||||
// Create the Views
|
||||
mBox = new BBox(bounds, "mediaView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
|
||||
fBox = new BBox(bounds, "mediaView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER);
|
||||
|
||||
// Add Child(ren)
|
||||
AddChild(mBox);
|
||||
mBox->AddChild(scrollView);
|
||||
AddChild(fBox);
|
||||
fBox->AddChild(scrollView);
|
||||
|
||||
// StringViews
|
||||
rgb_color titleFontColor = { 0,0,0,0 };
|
||||
mTitleView = new BStringView(titleRect, "AudioSettings", "Audio Settings", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
|
||||
mTitleView->SetFont(be_bold_font);
|
||||
mTitleView->SetFontSize(12.0);
|
||||
mTitleView->SetHighColor(titleFontColor);
|
||||
fTitleView = new BStringView(titleRect, "AudioSettings", "Audio Settings", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW);
|
||||
fTitleView->SetFont(be_bold_font);
|
||||
fTitleView->SetFontSize(12.0);
|
||||
fTitleView->SetHighColor(titleFontColor);
|
||||
|
||||
mBox->AddChild(mTitleView);
|
||||
fBox->AddChild(fTitleView);
|
||||
|
||||
mContentView = new BBox(availableRect, "contentView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS, B_NO_BORDER);
|
||||
mBox->AddChild(mContentView);
|
||||
fContentView = new BBox(availableRect, "contentView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS, B_NO_BORDER);
|
||||
fBox->AddChild(fContentView);
|
||||
|
||||
BRect settingsRect(0, 0, 442, 330);
|
||||
mAudioView = new SettingsView(settingsRect, false);
|
||||
mVideoView = new SettingsView(settingsRect, true);
|
||||
BRect settingsRect(0, 0, 442, 335);
|
||||
fAudioView = new SettingsView(settingsRect, false);
|
||||
fVideoView = new SettingsView(settingsRect, true);
|
||||
|
||||
mBar = new BarView(barRect);
|
||||
mBox->AddChild(mBar);
|
||||
fBar = new BarView(barRect);
|
||||
fBox->AddChild(fBar);
|
||||
|
||||
mInitCheck = InitMedia(true);
|
||||
if (mInitCheck != B_OK) {
|
||||
fInitCheck = InitMedia(true);
|
||||
if (fInitCheck != B_OK) {
|
||||
PostMessage(B_QUIT_REQUESTED);
|
||||
} else {
|
||||
if (IsHidden())
|
||||
@ -231,9 +231,9 @@ MediaWindow::InitMedia(bool first)
|
||||
if(alert->Go()==0)
|
||||
return B_ERROR;
|
||||
|
||||
mAlert = new MediaAlert(BRect(0,0,300,60),
|
||||
fAlert = new MediaAlert(BRect(0,0,300,60),
|
||||
"restart_alert", "Restarting Media Services\nStarting Media Server...\n");
|
||||
mAlert->Show();
|
||||
fAlert->Show();
|
||||
|
||||
Show();
|
||||
|
||||
@ -243,58 +243,58 @@ MediaWindow::InitMedia(bool first)
|
||||
Lock();
|
||||
|
||||
bool isVideoSelected = true;
|
||||
if(!first && mListView->ItemAt(0) && mListView->ItemAt(0)->IsSelected())
|
||||
if(!first && fListView->ItemAt(0) && fListView->ItemAt(0)->IsSelected())
|
||||
isVideoSelected = false;
|
||||
|
||||
if((!first || (first && err) ) && mAlert) {
|
||||
BAutolock locker(mAlert);
|
||||
if((!first || (first && err) ) && fAlert) {
|
||||
BAutolock locker(fAlert);
|
||||
if(locker.IsLocked())
|
||||
mAlert->TextView()->SetText("Ready For Use...");
|
||||
fAlert->TextView()->SetText("Ready For Use...");
|
||||
}
|
||||
|
||||
void *listItem;
|
||||
while((listItem = mListView->RemoveItem((int32)0)))
|
||||
while((listItem = fListView->RemoveItem((int32)0)))
|
||||
delete static_cast<MediaListItem *>(listItem);
|
||||
while((listItem = mAudioOutputs.RemoveItem((int32)0)))
|
||||
while((listItem = fAudioOutputs.RemoveItem((int32)0)))
|
||||
delete static_cast<dormant_node_info *>(listItem);
|
||||
while((listItem = mAudioInputs.RemoveItem((int32)0)))
|
||||
while((listItem = fAudioInputs.RemoveItem((int32)0)))
|
||||
delete static_cast<dormant_node_info *>(listItem);
|
||||
while((listItem = mVideoOutputs.RemoveItem((int32)0)))
|
||||
while((listItem = fVideoOutputs.RemoveItem((int32)0)))
|
||||
delete static_cast<dormant_node_info *>(listItem);
|
||||
while((listItem = mVideoInputs.RemoveItem((int32)0)))
|
||||
while((listItem = fVideoInputs.RemoveItem((int32)0)))
|
||||
delete static_cast<dormant_node_info *>(listItem);
|
||||
|
||||
MediaListItem *item, *mixer, *audio, *video;
|
||||
|
||||
// Grab Media Info
|
||||
FindNodes(B_MEDIA_RAW_AUDIO, B_PHYSICAL_OUTPUT, mAudioOutputs);
|
||||
FindNodes(B_MEDIA_RAW_AUDIO, B_PHYSICAL_INPUT, mAudioInputs);
|
||||
FindNodes(B_MEDIA_ENCODED_AUDIO, B_PHYSICAL_OUTPUT, mAudioOutputs);
|
||||
FindNodes(B_MEDIA_ENCODED_AUDIO, B_PHYSICAL_INPUT, mAudioInputs);
|
||||
FindNodes(B_MEDIA_RAW_VIDEO, B_PHYSICAL_OUTPUT, mVideoOutputs);
|
||||
FindNodes(B_MEDIA_RAW_VIDEO, B_PHYSICAL_INPUT, mVideoInputs);
|
||||
FindNodes(B_MEDIA_ENCODED_VIDEO, B_PHYSICAL_OUTPUT, mVideoOutputs);
|
||||
FindNodes(B_MEDIA_ENCODED_VIDEO, B_PHYSICAL_INPUT, mVideoInputs);
|
||||
FindNodes(B_MEDIA_RAW_AUDIO, B_PHYSICAL_OUTPUT, fAudioOutputs);
|
||||
FindNodes(B_MEDIA_RAW_AUDIO, B_PHYSICAL_INPUT, fAudioInputs);
|
||||
FindNodes(B_MEDIA_ENCODED_AUDIO, B_PHYSICAL_OUTPUT, fAudioOutputs);
|
||||
FindNodes(B_MEDIA_ENCODED_AUDIO, B_PHYSICAL_INPUT, fAudioInputs);
|
||||
FindNodes(B_MEDIA_RAW_VIDEO, B_PHYSICAL_OUTPUT, fVideoOutputs);
|
||||
FindNodes(B_MEDIA_RAW_VIDEO, B_PHYSICAL_INPUT, fVideoInputs);
|
||||
FindNodes(B_MEDIA_ENCODED_VIDEO, B_PHYSICAL_OUTPUT, fVideoOutputs);
|
||||
FindNodes(B_MEDIA_ENCODED_VIDEO, B_PHYSICAL_INPUT, fVideoInputs);
|
||||
|
||||
// Add video nodes first. They might have an additional audio
|
||||
// output or input, but still should be listed as video node.
|
||||
AddNodes(mVideoOutputs, true);
|
||||
AddNodes(mVideoInputs, true);
|
||||
AddNodes(mAudioOutputs, false);
|
||||
AddNodes(mAudioInputs, false);
|
||||
AddNodes(fVideoOutputs, true);
|
||||
AddNodes(fVideoInputs, true);
|
||||
AddNodes(fAudioOutputs, false);
|
||||
AddNodes(fAudioInputs, false);
|
||||
|
||||
mAudioView->AddNodes(mAudioOutputs, false);
|
||||
mAudioView->AddNodes(mAudioInputs, true);
|
||||
mVideoView->AddNodes(mVideoOutputs, false);
|
||||
mVideoView->AddNodes(mVideoInputs, true);
|
||||
fAudioView->AddNodes(fAudioOutputs, false);
|
||||
fAudioView->AddNodes(fAudioInputs, true);
|
||||
fVideoView->AddNodes(fVideoOutputs, false);
|
||||
fVideoView->AddNodes(fVideoInputs, true);
|
||||
|
||||
mListView->AddItem(audio = new MediaListItem("Audio Settings", 0, false, &mIcons));
|
||||
mListView->AddItem(video = new MediaListItem("Video Settings", 0, true, &mIcons));
|
||||
fListView->AddItem(audio = new MediaListItem("Audio Settings", 0, false, &fIcons));
|
||||
fListView->AddItem(video = new MediaListItem("Video Settings", 0, true, &fIcons));
|
||||
|
||||
mListView->AddItem(mixer = new MediaListItem("Audio Mixer", 1, false, &mIcons));
|
||||
fListView->AddItem(mixer = new MediaListItem("Audio Mixer", 1, false, &fIcons));
|
||||
mixer->SetAudioMixer(true);
|
||||
|
||||
mListView->SortItems(&MediaListItem::Compare);
|
||||
fListView->SortItems(&MediaListItem::Compare);
|
||||
|
||||
media_node default_node;
|
||||
dormant_node_info node_info;
|
||||
@ -306,7 +306,7 @@ MediaWindow::InitMedia(bool first)
|
||||
item = FindMediaListItem(&node_info);
|
||||
if(item)
|
||||
item->SetDefault(true, true);
|
||||
mAudioView->SetDefault(node_info, true);
|
||||
fAudioView->SetDefault(node_info, true);
|
||||
}
|
||||
|
||||
if(roster->GetAudioOutput(&default_node, &outputID, &outputName)==B_OK) {
|
||||
@ -314,7 +314,7 @@ MediaWindow::InitMedia(bool first)
|
||||
item = FindMediaListItem(&node_info);
|
||||
if(item)
|
||||
item->SetDefault(true, false);
|
||||
mAudioView->SetDefault(node_info, false, outputID);
|
||||
fAudioView->SetDefault(node_info, false, outputID);
|
||||
}
|
||||
|
||||
if(roster->GetVideoInput(&default_node)==B_OK) {
|
||||
@ -322,7 +322,7 @@ MediaWindow::InitMedia(bool first)
|
||||
item = FindMediaListItem(&node_info);
|
||||
if(item)
|
||||
item->SetDefault(true, true);
|
||||
mVideoView->SetDefault(node_info, true);
|
||||
fVideoView->SetDefault(node_info, true);
|
||||
}
|
||||
|
||||
if(roster->GetVideoOutput(&default_node)==B_OK) {
|
||||
@ -330,28 +330,28 @@ MediaWindow::InitMedia(bool first)
|
||||
item = FindMediaListItem(&node_info);
|
||||
if(item)
|
||||
item->SetDefault(true, false);
|
||||
mVideoView->SetDefault(node_info, false);
|
||||
fVideoView->SetDefault(node_info, false);
|
||||
}
|
||||
|
||||
if(first) {
|
||||
mListView->Select(mListView->IndexOf(mixer));
|
||||
fListView->Select(fListView->IndexOf(mixer));
|
||||
} else {
|
||||
if(!mAudioView->mRestartTextView->IsHidden())
|
||||
mAudioView->mRestartTextView->Hide();
|
||||
if(!mVideoView->mRestartTextView->IsHidden())
|
||||
mVideoView->mRestartTextView->Hide();
|
||||
if(!fAudioView->fRestartView->IsHidden())
|
||||
fAudioView->fRestartView->Hide();
|
||||
if(!fVideoView->fRestartView->IsHidden())
|
||||
fVideoView->fRestartView->Hide();
|
||||
|
||||
if(isVideoSelected)
|
||||
mListView->Select(mListView->IndexOf(video));
|
||||
fListView->Select(fListView->IndexOf(video));
|
||||
else
|
||||
mListView->Select(mListView->IndexOf(audio));
|
||||
fListView->Select(fListView->IndexOf(audio));
|
||||
}
|
||||
|
||||
if(mAlert) {
|
||||
if(fAlert) {
|
||||
snooze(800000);
|
||||
mAlert->PostMessage(B_QUIT_REQUESTED);
|
||||
fAlert->PostMessage(B_QUIT_REQUESTED);
|
||||
}
|
||||
mAlert = NULL;
|
||||
fAlert = NULL;
|
||||
|
||||
Unlock();
|
||||
|
||||
@ -365,8 +365,8 @@ MediaWindow::QuitRequested()
|
||||
{
|
||||
// stop watching the MediaRoster
|
||||
BMediaRoster *roster = BMediaRoster::CurrentRoster();
|
||||
if (roster && mCurrentNode) {
|
||||
roster->StopWatching(this, *mCurrentNode, B_MEDIA_WILDCARD);
|
||||
if (roster && fCurrentNode) {
|
||||
roster->StopWatching(this, *fCurrentNode, B_MEDIA_WILDCARD);
|
||||
}
|
||||
be_app->PostMessage(B_QUIT_REQUESTED);
|
||||
return true;
|
||||
@ -409,14 +409,14 @@ MediaWindow::MessageReceived (BMessage *message)
|
||||
int32 index;
|
||||
if(message->FindInt32("index", &index)!=B_OK)
|
||||
break;
|
||||
Settings2Item *item = static_cast<Settings2Item *>(mAudioView->mMenu3->ItemAt(index));
|
||||
Settings2Item *item = static_cast<Settings2Item *>(fAudioView->fMenu3->ItemAt(index));
|
||||
|
||||
if(item) {
|
||||
BMediaRoster *roster = BMediaRoster::Roster();
|
||||
roster->SetAudioOutput(*item->mInput);
|
||||
roster->SetAudioOutput(*item->fInput);
|
||||
|
||||
if(mAudioView->mRestartTextView->IsHidden())
|
||||
mAudioView->mRestartTextView->Show();
|
||||
if(fAudioView->fRestartView->IsHidden())
|
||||
fAudioView->fRestartView->Show();
|
||||
} else
|
||||
fprintf(stderr, "Settings2Item not found\n");
|
||||
}
|
||||
@ -432,8 +432,8 @@ MediaWindow::MessageReceived (BMessage *message)
|
||||
int32 index;
|
||||
if(message->FindInt32("index", &index)!=B_OK)
|
||||
break;
|
||||
SettingsView *settingsView = isVideo ? mVideoView : mAudioView;
|
||||
BMenu *menu = isInput ? settingsView->mMenu1 : settingsView->mMenu2;
|
||||
SettingsView *settingsView = isVideo ? fVideoView : fAudioView;
|
||||
BMenu *menu = isInput ? settingsView->fMenu1 : settingsView->fMenu2;
|
||||
SettingsItem *item = static_cast<SettingsItem *>(menu->ItemAt(index));
|
||||
|
||||
if(item) {
|
||||
@ -441,22 +441,22 @@ MediaWindow::MessageReceived (BMessage *message)
|
||||
BMediaRoster *roster = BMediaRoster::Roster();
|
||||
if(isVideo) {
|
||||
if(isInput)
|
||||
roster->SetVideoInput(*item->mInfo);
|
||||
roster->SetVideoInput(*item->fInfo);
|
||||
else
|
||||
roster->SetVideoOutput(*item->mInfo);
|
||||
roster->SetVideoOutput(*item->fInfo);
|
||||
} else {
|
||||
if(isInput)
|
||||
roster->SetAudioInput(*item->mInfo);
|
||||
roster->SetAudioInput(*item->fInfo);
|
||||
else {
|
||||
roster->SetAudioOutput(*item->mInfo);
|
||||
mAudioView->SetDefault(*item->mInfo, false, 0);
|
||||
roster->SetAudioOutput(*item->fInfo);
|
||||
fAudioView->SetDefault(*item->fInfo, false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
MediaListItem *oldListItem = NULL;
|
||||
for(int32 j=0; j<mListView->CountItems(); j++) {
|
||||
oldListItem = static_cast<MediaListItem *>(mListView->ItemAt(j));
|
||||
if(oldListItem->mInfo && oldListItem->IsVideo() == isVideo
|
||||
for(int32 j=0; j<fListView->CountItems(); j++) {
|
||||
oldListItem = static_cast<MediaListItem *>(fListView->ItemAt(j));
|
||||
if(oldListItem->fInfo && oldListItem->IsVideo() == isVideo
|
||||
&& oldListItem->IsDefault(isInput))
|
||||
break;
|
||||
}
|
||||
@ -465,15 +465,15 @@ MediaWindow::MessageReceived (BMessage *message)
|
||||
else
|
||||
fprintf(stderr, "oldListItem not found\n");
|
||||
|
||||
MediaListItem *listItem = FindMediaListItem(item->mInfo);
|
||||
MediaListItem *listItem = FindMediaListItem(item->fInfo);
|
||||
if(listItem) {
|
||||
listItem->SetDefault(true, isInput);
|
||||
} else
|
||||
fprintf(stderr, "MediaListItem not found\n");
|
||||
mListView->Invalidate();
|
||||
fListView->Invalidate();
|
||||
|
||||
if(settingsView->mRestartTextView->IsHidden())
|
||||
settingsView->mRestartTextView->Show();
|
||||
if(settingsView->fRestartView->IsHidden())
|
||||
settingsView->fRestartView->Show();
|
||||
} else
|
||||
fprintf(stderr, "SettingsItem not found\n");
|
||||
}
|
||||
@ -491,7 +491,7 @@ MediaWindow::MessageReceived (BMessage *message)
|
||||
case ML_SHOW_VOLUME_CONTROL:
|
||||
{
|
||||
BDeskbar deskbar;
|
||||
if (mAudioView->mVolumeCheckBox->Value() == B_CONTROL_ON) {
|
||||
if (fAudioView->fVolumeCheckBox->Value() == B_CONTROL_ON) {
|
||||
BEntry entry("/bin/desklink", true);
|
||||
int32 id;
|
||||
entry_ref ref;
|
||||
@ -517,12 +517,12 @@ MediaWindow::MessageReceived (BMessage *message)
|
||||
bool isVideo = true;
|
||||
if(message->FindBool("isVideo", &isVideo)!=B_OK)
|
||||
break;
|
||||
SettingsView *settingsView = isVideo ? mVideoView : mAudioView;
|
||||
SettingsView *settingsView = isVideo ? fVideoView : fAudioView;
|
||||
uint32 flags;
|
||||
uint32 realtimeFlag = isVideo ? B_MEDIA_REALTIME_VIDEO : B_MEDIA_REALTIME_AUDIO;
|
||||
BMediaRoster *roster = BMediaRoster::Roster();
|
||||
roster->GetRealtimeFlags(&flags);
|
||||
if(settingsView->mRealtimeCheckBox->Value()==B_CONTROL_ON)
|
||||
if(settingsView->fRealtimeCheckBox->Value()==B_CONTROL_ON)
|
||||
flags |= realtimeFlag;
|
||||
else
|
||||
flags &= ~realtimeFlag;
|
||||
@ -534,68 +534,68 @@ MediaWindow::MessageReceived (BMessage *message)
|
||||
{
|
||||
PRINT_OBJECT(*message);
|
||||
|
||||
MediaListItem *item = static_cast<MediaListItem *>(mListView->ItemAt(mListView->CurrentSelection()));
|
||||
MediaListItem *item = static_cast<MediaListItem *>(fListView->ItemAt(fListView->CurrentSelection()));
|
||||
if(!item)
|
||||
break;
|
||||
BMediaRoster* roster = BMediaRoster::Roster();
|
||||
if(mCurrentNode) {
|
||||
if(fCurrentNode) {
|
||||
// stop watching the MediaRoster
|
||||
roster->StopWatching(this, *mCurrentNode, B_MEDIA_WILDCARD);
|
||||
roster->ReleaseNode(*mCurrentNode);
|
||||
roster->StopWatching(this, *fCurrentNode, B_MEDIA_WILDCARD);
|
||||
roster->ReleaseNode(*fCurrentNode);
|
||||
}
|
||||
mCurrentNode = NULL;
|
||||
BView *paramView = mContentView->ChildAt(0);
|
||||
fCurrentNode = NULL;
|
||||
BView *paramView = fContentView->ChildAt(0);
|
||||
if(paramView!=NULL) {
|
||||
mContentView->RemoveChild(paramView);
|
||||
fContentView->RemoveChild(paramView);
|
||||
}
|
||||
paramView = NULL;
|
||||
if(mParamWeb)
|
||||
delete mParamWeb;
|
||||
mParamWeb = NULL;
|
||||
if(fParamWeb)
|
||||
delete fParamWeb;
|
||||
fParamWeb = NULL;
|
||||
|
||||
mTitleView->SetText(item->GetLabel());
|
||||
fTitleView->SetText(item->GetLabel());
|
||||
|
||||
if(item->OutlineLevel() == 0) {
|
||||
if(item->IsVideo())
|
||||
mContentView->AddChild(mVideoView);
|
||||
fContentView->AddChild(fVideoView);
|
||||
else
|
||||
mContentView->AddChild(mAudioView);
|
||||
fContentView->AddChild(fAudioView);
|
||||
} else {
|
||||
|
||||
if(!mCurrentNode)
|
||||
mCurrentNode = new media_node();
|
||||
if(!fCurrentNode)
|
||||
fCurrentNode = new media_node();
|
||||
media_node_id node_id;
|
||||
if(item->IsAudioMixer())
|
||||
roster->GetAudioMixer(mCurrentNode);
|
||||
else if(roster->GetInstancesFor(item->mInfo->addon, item->mInfo->flavor_id, &node_id)!=B_OK)
|
||||
roster->InstantiateDormantNode(*(item->mInfo), mCurrentNode, B_FLAVOR_IS_GLOBAL);
|
||||
roster->GetAudioMixer(fCurrentNode);
|
||||
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, mCurrentNode);
|
||||
roster->GetNodeFor(node_id, fCurrentNode);
|
||||
|
||||
|
||||
if(roster->GetParameterWebFor(*mCurrentNode, &mParamWeb)==B_OK) {
|
||||
if(roster->GetParameterWebFor(*fCurrentNode, &fParamWeb)==B_OK) {
|
||||
BMediaTheme* theme = BMediaTheme::PreferredTheme();
|
||||
paramView = theme->ViewFor(mParamWeb);
|
||||
mContentView->AddChild(paramView);
|
||||
paramView->ResizeTo(mContentView->Bounds().Width(), mContentView->Bounds().Height());
|
||||
paramView = theme->ViewFor(fParamWeb);
|
||||
fContentView->AddChild(paramView);
|
||||
paramView->ResizeTo(fContentView->Bounds().Width(), fContentView->Bounds().Height() - 10);
|
||||
|
||||
roster->StartWatching(this, *mCurrentNode, B_MEDIA_WILDCARD);
|
||||
roster->StartWatching(this, *fCurrentNode, B_MEDIA_WILDCARD);
|
||||
} else {
|
||||
mParamWeb = NULL;
|
||||
BRect bounds = mContentView->Bounds();
|
||||
fParamWeb = NULL;
|
||||
BRect bounds = fContentView->Bounds();
|
||||
BStringView* stringView = new BStringView(bounds,
|
||||
"noControls", "This hardware has no controls.", B_FOLLOW_V_CENTER | B_FOLLOW_H_CENTER);
|
||||
stringView->ResizeToPreferred();
|
||||
mContentView->AddChild(stringView);
|
||||
fContentView->AddChild(stringView);
|
||||
stringView->MoveBy((bounds.Width()-stringView->Bounds().Width())/2,
|
||||
(bounds.Height()-stringView->Bounds().Height())/2);
|
||||
}
|
||||
}
|
||||
|
||||
bool barChanged = (item->OutlineLevel() == 0 || mParamWeb == NULL || mParamWeb->CountGroups()<2);
|
||||
if(barChanged != mBar->mDisplay) {
|
||||
mBar->mDisplay = barChanged;
|
||||
mBar->Invalidate();
|
||||
bool barChanged = (item->OutlineLevel() == 0 || fParamWeb == NULL || fParamWeb->CountGroups()<2);
|
||||
if(barChanged != fBar->fDisplay) {
|
||||
fBar->fDisplay = barChanged;
|
||||
fBar->Invalidate();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -603,12 +603,12 @@ MediaWindow::MessageReceived (BMessage *message)
|
||||
{
|
||||
PRINT_OBJECT(*message);
|
||||
const char *mimeSig;
|
||||
if(mAlert && 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.media-server")==0)) {
|
||||
mAlert->Lock();
|
||||
mAlert->TextView()->SetText("Starting Media Server...");
|
||||
mAlert->Unlock();
|
||||
fAlert->Lock();
|
||||
fAlert->TextView()->SetText("Starting Media Server...");
|
||||
fAlert->Unlock();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -637,17 +637,17 @@ status_t
|
||||
MediaWindow::RestartMediaServices(void *data)
|
||||
{
|
||||
MediaWindow *window = (MediaWindow *)data;
|
||||
window->mAlert = new MediaAlert(BRect(0,0,300,60),
|
||||
window->fAlert = new MediaAlert(BRect(0,0,300,60),
|
||||
"restart_alert", "Restarting Media Services\nShutting down Media Server\n");
|
||||
|
||||
window->mAlert->Show();
|
||||
window->fAlert->Show();
|
||||
|
||||
shutdown_media_server(B_INFINITE_TIMEOUT, MediaWindow::UpdateProgress, window->mAlert);
|
||||
shutdown_media_server(B_INFINITE_TIMEOUT, MediaWindow::UpdateProgress, window->fAlert);
|
||||
|
||||
{
|
||||
BAutolock locker(window->mAlert);
|
||||
BAutolock locker(window->fAlert);
|
||||
if(locker.IsLocked())
|
||||
window->mAlert->TextView()->SetText("Starting Media Server...");
|
||||
window->fAlert->TextView()->SetText("Starting Media Server...");
|
||||
}
|
||||
launch_media_server();
|
||||
|
||||
|
@ -47,25 +47,25 @@ class MediaWindow : public BWindow
|
||||
static status_t RestartMediaServices(void *data);
|
||||
static bool UpdateProgress(int stage, const char * message, void * cookie);
|
||||
|
||||
BBox * mBox;
|
||||
BListView* mListView;
|
||||
BStringView* mTitleView;
|
||||
BView* mContentView;
|
||||
SettingsView* mAudioView;
|
||||
SettingsView* mVideoView;
|
||||
BarView* mBar;
|
||||
BBox * fBox;
|
||||
BListView* fListView;
|
||||
BStringView* fTitleView;
|
||||
BView* fContentView;
|
||||
SettingsView* fAudioView;
|
||||
SettingsView* fVideoView;
|
||||
BarView* fBar;
|
||||
|
||||
media_node* mCurrentNode;
|
||||
BParameterWeb* mParamWeb;
|
||||
media_node* fCurrentNode;
|
||||
BParameterWeb* fParamWeb;
|
||||
|
||||
BList mAudioInputs;
|
||||
BList mAudioOutputs;
|
||||
BList mVideoInputs;
|
||||
BList mVideoOutputs;
|
||||
BList fAudioInputs;
|
||||
BList fAudioOutputs;
|
||||
BList fVideoInputs;
|
||||
BList fVideoOutputs;
|
||||
|
||||
BList mIcons;
|
||||
MediaAlert *mAlert;
|
||||
status_t mInitCheck;
|
||||
BList fIcons;
|
||||
MediaAlert *fAlert;
|
||||
status_t fInitCheck;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user