Add "URI" property that returns the URI of the currently playing item.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35302 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz 2010-01-26 21:23:33 +00:00
parent 959abd1c51
commit 63bcd0d0c3
1 changed files with 25 additions and 0 deletions

View File

@ -131,6 +131,10 @@ static property_info sPropertyInfo[] = {
{ B_DIRECT_SPECIFIER, 0 }, "Gets/sets the volume (0.0-2.0).", 0,
{ B_FLOAT_TYPE }
},
{ "URI", { B_GET_PROPERTY, 0 },
{ B_DIRECT_SPECIFIER, 0 },
"Gets the URI of the currently playing item.", 0, { B_STRING_TYPE }
},
{ 0, { 0 }, { 0 }, 0, 0 }
};
@ -479,6 +483,26 @@ MainWin::MessageReceived(BMessage* msg)
break;
}
case 8:
{
if (msg->what == B_GET_PROPERTY) {
const PlaylistItem* item = fController->Item();
if (item == NULL) {
result = B_NO_INIT;
break;
}
result = reply.AddString("result", item->LocationURI());
} else if (msg->what == B_SET_PROPERTY) {
float newVolume;
result = msg->FindFloat("data", &newVolume);
if (result == B_OK)
fController->SetVolume(newVolume);
}
break;
}
default:
return BWindow::MessageReceived(msg);
}
@ -1063,6 +1087,7 @@ MainWin::ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier,
case 5:
case 6:
case 7:
case 8:
return this;
}