Implemented rewind functionality so that slide show no longer stops when it reaches the last file in the directory
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7453 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1925,9 +1925,7 @@ ShowImageView::SetTrackerSelectionToCurrent()
|
|||||||
bool
|
bool
|
||||||
ShowImageView::FindNextImage(entry_ref *in_current, entry_ref *ref, bool next, bool rewind)
|
ShowImageView::FindNextImage(entry_ref *in_current, entry_ref *ref, bool next, bool rewind)
|
||||||
{
|
{
|
||||||
// shamelessly stolen, I mean copied from BeMail!
|
// Based on similar function from BeMail!
|
||||||
// XXX rewind is not implemented yet => slide show will stop with last image
|
|
||||||
|
|
||||||
if (!fTrackerMessenger.IsValid())
|
if (!fTrackerMessenger.IsValid())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -1937,32 +1935,37 @@ ShowImageView::FindNextImage(entry_ref *in_current, entry_ref *ref, bool next, b
|
|||||||
// image is found.
|
// image is found.
|
||||||
//
|
//
|
||||||
entry_ref nextRef = *in_current;
|
entry_ref nextRef = *in_current;
|
||||||
bool foundRef = false;
|
bool foundRef = false;
|
||||||
while (!foundRef)
|
while (!foundRef)
|
||||||
{
|
{
|
||||||
BMessage request(B_GET_PROPERTY);
|
BMessage request(B_GET_PROPERTY);
|
||||||
BMessage spc;
|
BMessage spc;
|
||||||
if (next)
|
if (rewind)
|
||||||
|
spc.what = B_DIRECT_SPECIFIER;
|
||||||
|
else if (next)
|
||||||
spc.what = 'snxt';
|
spc.what = 'snxt';
|
||||||
else
|
else
|
||||||
spc.what = 'sprv';
|
spc.what = 'sprv';
|
||||||
|
|
||||||
spc.AddString("property", "Entry");
|
spc.AddString("property", "Entry");
|
||||||
spc.AddRef("data", &nextRef);
|
if (rewind)
|
||||||
|
// if rewinding, ask for the ref to the
|
||||||
|
// first item in the directory
|
||||||
|
spc.AddInt32("data", 0);
|
||||||
|
else
|
||||||
|
spc.AddRef("data", &nextRef);
|
||||||
request.AddSpecifier(&spc);
|
request.AddSpecifier(&spc);
|
||||||
|
|
||||||
BMessage reply;
|
BMessage reply;
|
||||||
if (fTrackerMessenger.SendMessage(&request, &reply) != B_OK) {
|
if (fTrackerMessenger.SendMessage(&request, &reply) != B_OK)
|
||||||
return false;
|
return false;
|
||||||
}
|
if (reply.FindRef("result", &nextRef) != B_OK)
|
||||||
|
|
||||||
if (reply.FindRef("result", &nextRef) != B_OK) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
if (IsImage(&nextRef))
|
||||||
if (IsImage(&nextRef)) {
|
|
||||||
foundRef = true;
|
foundRef = true;
|
||||||
}
|
|
||||||
|
rewind = false;
|
||||||
|
// stop asking for the first ref in the directory
|
||||||
}
|
}
|
||||||
|
|
||||||
*ref = nextRef;
|
*ref = nextRef;
|
||||||
|
|||||||
Reference in New Issue
Block a user