* Added support for dropped queries - the queries will be evaluated once, only
(ie. no live mode). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38768 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -111,6 +111,7 @@ Application MediaPlayer :
|
|||||||
VideoView.cpp
|
VideoView.cpp
|
||||||
|
|
||||||
: be game locale media tracker translation textencoding $(TARGET_LIBSTDC++)
|
: be game locale media tracker translation textencoding $(TARGET_LIBSTDC++)
|
||||||
|
libshared.a
|
||||||
: MediaPlayer.rdef
|
: MediaPlayer.rdef
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,8 @@
|
|||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
|
#include <QueryFile.h>
|
||||||
|
|
||||||
#include "FilePlaylistItem.h"
|
#include "FilePlaylistItem.h"
|
||||||
#include "FileReadWrite.h"
|
#include "FileReadWrite.h"
|
||||||
|
|
||||||
@@ -436,13 +438,18 @@ Playlist::AppendRefs(const BMessage* refsReceivedMessage, int32 appendIndex)
|
|||||||
for (int i = 0; refsReceivedMessage->FindRef("refs", i, &ref) == B_OK;
|
for (int i = 0; refsReceivedMessage->FindRef("refs", i, &ref) == B_OK;
|
||||||
i++) {
|
i++) {
|
||||||
Playlist subPlaylist;
|
Playlist subPlaylist;
|
||||||
if (_IsPlaylist(_MIMEString(&ref))) {
|
BString type = _MIMEString(&ref);
|
||||||
|
if (_IsPlaylist(type)) {
|
||||||
AppendPlaylistToPlaylist(ref, &subPlaylist);
|
AppendPlaylistToPlaylist(ref, &subPlaylist);
|
||||||
// Do not sort the whole playlist anymore, as that
|
// Do not sort the whole playlist anymore, as that
|
||||||
// will screw up the ordering in the saved playlist.
|
// will screw up the ordering in the saved playlist.
|
||||||
sortPlaylist = false;
|
sortPlaylist = false;
|
||||||
} else {
|
} else {
|
||||||
AppendToPlaylistRecursive(ref, &subPlaylist);
|
if (_IsQuery(type))
|
||||||
|
AppendQueryToPlaylist(ref, &subPlaylist);
|
||||||
|
else
|
||||||
|
AppendToPlaylistRecursive(ref, &subPlaylist);
|
||||||
|
|
||||||
// At least sort this subsection of the playlist
|
// At least sort this subsection of the playlist
|
||||||
// if the whole playlist is not sorted anymore.
|
// if the whole playlist is not sorted anymore.
|
||||||
if (!sortPlaylist)
|
if (!sortPlaylist)
|
||||||
@@ -538,6 +545,22 @@ Playlist::AppendPlaylistToPlaylist(const entry_ref& ref, Playlist* playlist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*static*/ void
|
||||||
|
Playlist::AppendQueryToPlaylist(const entry_ref& ref, Playlist* playlist)
|
||||||
|
{
|
||||||
|
BQueryFile query(&ref);
|
||||||
|
if (query.InitCheck() != B_OK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
entry_ref foundRef;
|
||||||
|
while (query.GetNextRef(&foundRef) == B_OK) {
|
||||||
|
PlaylistItem* item = new (std::nothrow) FilePlaylistItem(foundRef);
|
||||||
|
if (item == NULL || !playlist->AddItem(item))
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Playlist::NotifyImportFailed()
|
Playlist::NotifyImportFailed()
|
||||||
{
|
{
|
||||||
@@ -605,6 +628,13 @@ Playlist::_IsPlaylist(const BString& mimeString)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*static*/ bool
|
||||||
|
Playlist::_IsQuery(const BString& mimeString)
|
||||||
|
{
|
||||||
|
return mimeString.Compare(BQueryFile::MimeType()) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*static*/ BString
|
/*static*/ BString
|
||||||
Playlist::_MIMEString(const entry_ref* ref)
|
Playlist::_MIMEString(const entry_ref* ref)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ public:
|
|||||||
Playlist* playlist);
|
Playlist* playlist);
|
||||||
static void AppendPlaylistToPlaylist(const entry_ref& ref,
|
static void AppendPlaylistToPlaylist(const entry_ref& ref,
|
||||||
Playlist* playlist);
|
Playlist* playlist);
|
||||||
|
static void AppendQueryToPlaylist(const entry_ref& ref,
|
||||||
|
Playlist* playlist);
|
||||||
|
|
||||||
void NotifyImportFailed();
|
void NotifyImportFailed();
|
||||||
|
|
||||||
@@ -119,6 +121,7 @@ private:
|
|||||||
static bool _IsTextPlaylist(const BString& mimeString);
|
static bool _IsTextPlaylist(const BString& mimeString);
|
||||||
static bool _IsBinaryPlaylist(const BString& mimeString);
|
static bool _IsBinaryPlaylist(const BString& mimeString);
|
||||||
static bool _IsPlaylist(const BString& mimeString);
|
static bool _IsPlaylist(const BString& mimeString);
|
||||||
|
static bool _IsQuery(const BString& mimeString);
|
||||||
static BString _MIMEString(const entry_ref* ref);
|
static BString _MIMEString(const entry_ref* ref);
|
||||||
|
|
||||||
void _NotifyItemAdded(PlaylistItem*,
|
void _NotifyItemAdded(PlaylistItem*,
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ void
|
|||||||
PlaylistListView::RefsReceived(BMessage* message, int32 appendIndex)
|
PlaylistListView::RefsReceived(BMessage* message, int32 appendIndex)
|
||||||
{
|
{
|
||||||
if (fCommandStack->Perform(new (nothrow) ImportPLItemsCommand(fPlaylist,
|
if (fCommandStack->Perform(new (nothrow) ImportPLItemsCommand(fPlaylist,
|
||||||
message, appendIndex)) != B_OK) {
|
message, appendIndex)) != B_OK) {
|
||||||
fPlaylist->NotifyImportFailed();
|
fPlaylist->NotifyImportFailed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user