Fixed all warnings and did some minor style updates (only those next to
the fixed warnings :). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@6139 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -28,13 +28,13 @@ Media::Media()
|
||||
BRect rect(32,64,637,442);
|
||||
|
||||
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);
|
||||
BFile file(path.Path(),B_READ_ONLY);
|
||||
if(file.InitCheck()==B_OK) {
|
||||
if (file.InitCheck()==B_OK) {
|
||||
char buffer[255];
|
||||
ssize_t size = 0;
|
||||
while((size = file.Read(buffer, 255))>0) {
|
||||
while ((size = file.Read(buffer, 255)) > 0) {
|
||||
int32 i=0;
|
||||
while(buffer[i]=='#') {
|
||||
while(i<size&&buffer[i]!='\n')
|
||||
@@ -42,12 +42,12 @@ Media::Media()
|
||||
i++;
|
||||
}
|
||||
int32 a,b,c,d;
|
||||
if(sscanf(&buffer[i], " rect = %i,%i,%i,%i", &a, &b, &c, &d)>0){
|
||||
if(c-a>=int(rect.Width())) {
|
||||
if (sscanf(&buffer[i], " rect = %li,%li,%li,%li", &a, &b, &c, &d) > 0) {
|
||||
if (c-a >= rect.IntegerWidth()) {
|
||||
rect.left = a;
|
||||
rect.right = c;
|
||||
}
|
||||
if(d-b>=int(rect.Height())) {
|
||||
if (d-b >= rect.IntegerHeight()) {
|
||||
rect.top = b;
|
||||
rect.bottom = d;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// MediaListItem - Constructor
|
||||
MediaListItem::MediaListItem(dormant_node_info *info, uint32 level, bool isVideo, BList *icons, uint32 modifiers=0)
|
||||
: BListItem(level),
|
||||
mIsVideo(isVideo),
|
||||
mIsAudioMixer(false),
|
||||
mIsVideo(isVideo),
|
||||
mIsDefaultInput(false),
|
||||
mIsDefaultOutput(false)
|
||||
{
|
||||
@@ -36,11 +36,11 @@ MediaListItem::MediaListItem(dormant_node_info *info, uint32 level, bool isVideo
|
||||
SetHeight(16 + kITEM_MARGIN);
|
||||
}
|
||||
|
||||
MediaListItem::MediaListItem(const char* label, uint32 level, bool isVideo, BList *icons, uint32 modifiers=0)
|
||||
MediaListItem::MediaListItem(const char *label, uint32 level, bool isVideo, BList *icons, uint32 modifiers=0)
|
||||
: BListItem(level),
|
||||
mIsVideo(isVideo),
|
||||
mLabel(label),
|
||||
mIsAudioMixer(false),
|
||||
mIsVideo(isVideo),
|
||||
mIsDefaultInput(false),
|
||||
mIsDefaultOutput(false)
|
||||
{
|
||||
@@ -62,15 +62,12 @@ MediaListItem::DrawItem(BView *owner, BRect frame, bool complete)
|
||||
{
|
||||
rgb_color kHighlight = { 140,140,140,0 };
|
||||
rgb_color kBlack = { 0,0,0,0 };
|
||||
rgb_color kWhite = { 255,255,255,0 };
|
||||
|
||||
|
||||
BRect r(frame);
|
||||
|
||||
if (IsSelected() || complete)
|
||||
{
|
||||
|
||||
if (IsSelected() || complete) {
|
||||
rgb_color color;
|
||||
if (IsSelected())
|
||||
{
|
||||
if (IsSelected()) {
|
||||
color = kHighlight;
|
||||
} else {
|
||||
color = owner->ViewColor();
|
||||
@@ -79,7 +76,6 @@ MediaListItem::DrawItem(BView *owner, BRect frame, bool complete)
|
||||
owner->SetLowColor(color);
|
||||
owner->FillRect(r);
|
||||
owner->SetHighColor(kBlack);
|
||||
|
||||
} else {
|
||||
owner->SetLowColor(owner->ViewColor());
|
||||
}
|
||||
|
||||
@@ -12,32 +12,34 @@
|
||||
// Created : June 25, 2003
|
||||
//
|
||||
// ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
|
||||
|
||||
|
||||
#ifndef __MEDIALISTITEM_H__
|
||||
#define __MEDIALISTITEM_H__
|
||||
|
||||
|
||||
#include <ListItem.h>
|
||||
#include <MediaAddOn.h>
|
||||
|
||||
class MediaListItem : public BListItem
|
||||
{
|
||||
|
||||
class MediaListItem : public BListItem {
|
||||
public:
|
||||
MediaListItem(dormant_node_info *info, uint32 level, bool isVideo, BList *icons, uint32 modifiers=0);
|
||||
MediaListItem(const char* label, uint32 level, bool isVideo, BList *icons, uint32 modifiers=0);
|
||||
~MediaListItem();
|
||||
|
||||
virtual void Update(BView *owner, const BFont *finfo);
|
||||
virtual void DrawItem(BView *owner, BRect frame, bool complete = false);
|
||||
|
||||
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; }
|
||||
|
||||
const char *GetLabel() { return mLabel; }
|
||||
|
||||
dormant_node_info *mInfo;
|
||||
|
||||
|
||||
static int Compare(const void *firstArg, const void *secondArg);
|
||||
|
||||
private:
|
||||
const char *mLabel;
|
||||
bool mIsAudioMixer;
|
||||
@@ -48,5 +50,4 @@ class MediaListItem : public BListItem
|
||||
BList *mIcons;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* __MEDIALISTITEM_H__ */
|
||||
|
||||
@@ -161,14 +161,14 @@ SettingsView::AddNodes(BList &list, bool isInput)
|
||||
{
|
||||
BMenu *menu = isInput ? mMenu1 : mMenu2;
|
||||
void *item;
|
||||
while(item = menu->RemoveItem((int32)0))
|
||||
while ((item = menu->RemoveItem((int32)0)) != NULL)
|
||||
delete item;
|
||||
|
||||
|
||||
BMessage message(ML_DEFAULT_CHANGE);
|
||||
message.AddBool("isVideo", mIsVideo);
|
||||
message.AddBool("isInput", isInput);
|
||||
|
||||
for(int32 i=0; i<list.CountItems(); i++) {
|
||||
|
||||
for (int32 i = 0; i < list.CountItems(); i++) {
|
||||
dormant_node_info *info = static_cast<dormant_node_info *>(list.ItemAt(i));
|
||||
menu->AddItem(new SettingsItem(info, new BMessage(message)));
|
||||
}
|
||||
@@ -179,7 +179,7 @@ SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID)
|
||||
{
|
||||
BMenu *menu = isInput ? mMenu1 : mMenu2;
|
||||
|
||||
for(int32 i=0; i<menu->CountItems(); i++) {
|
||||
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) {
|
||||
item->SetMarked(true);
|
||||
@@ -187,26 +187,26 @@ SettingsView::SetDefault(dormant_node_info &info, bool isInput, int32 outputID)
|
||||
}
|
||||
}
|
||||
|
||||
if(!mIsVideo&&!isInput&&outputID>-1) {
|
||||
if (!mIsVideo&&!isInput&&outputID>-1) {
|
||||
BMenuItem *item;
|
||||
while(item = mMenu3->RemoveItem((int32)0))
|
||||
while ((item = mMenu3->RemoveItem((int32)0)) != NULL)
|
||||
delete item;
|
||||
BMediaRoster *roster = BMediaRoster::Roster();
|
||||
media_node node;
|
||||
media_node_id node_id;
|
||||
status_t err;
|
||||
if(roster->GetInstancesFor(info.addon, info.flavor_id, &node_id)!=B_OK)
|
||||
if (roster->GetInstancesFor(info.addon, info.flavor_id, &node_id)!=B_OK)
|
||||
err = roster->InstantiateDormantNode(info, &node, B_FLAVOR_IS_GLOBAL);
|
||||
else
|
||||
err = roster->GetNodeFor(node_id, &node);
|
||||
|
||||
if(err == B_OK) {
|
||||
if (err == B_OK) {
|
||||
media_input inputs[16];
|
||||
int32 inputCount = 16;
|
||||
if(roster->GetAllInputsFor(node, inputs, 16, &inputCount)==B_OK) {
|
||||
if (roster->GetAllInputsFor(node, inputs, 16, &inputCount)==B_OK) {
|
||||
BMessage message(ML_DEFAULTOUTPUT_CHANGE);
|
||||
Settings2Item *listItem;
|
||||
for(int32 i=0; i<inputCount; i++) {
|
||||
|
||||
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)));
|
||||
@@ -239,4 +239,4 @@ Settings2Item::~Settings2Item()
|
||||
{
|
||||
delete mInput;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -641,7 +641,7 @@ MediaWindow::UpdateProgress(int stage, const char * message, void * cookie)
|
||||
MediaAlert *alert = static_cast<MediaAlert*>(cookie);
|
||||
PRINT(("stage : %i\n", stage));
|
||||
char *string = "Unknown stage";
|
||||
switch(stage) {
|
||||
switch (stage) {
|
||||
case 10:
|
||||
string = "Stopping Media Server...";
|
||||
break;
|
||||
@@ -660,7 +660,8 @@ MediaWindow::UpdateProgress(int stage, const char * message, void * cookie)
|
||||
}
|
||||
|
||||
BAutolock locker(alert);
|
||||
if(locker.IsLocked())
|
||||
if (locker.IsLocked())
|
||||
alert->TextView()->SetText(string);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user