From 63bcd0d0c3280f02be7f8d56de9e8ce612c66969 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Tue, 26 Jan 2010 21:23:33 +0000 Subject: [PATCH] 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 --- src/apps/mediaplayer/MainWin.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/apps/mediaplayer/MainWin.cpp b/src/apps/mediaplayer/MainWin.cpp index e661ce9afe..e4d1d1defb 100644 --- a/src/apps/mediaplayer/MainWin.cpp +++ b/src/apps/mediaplayer/MainWin.cpp @@ -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; }