MythTV  master
Signals | Public Member Functions | Protected Member Functions | Protected Attributes | Private Slots | List of all members
SlideBuffer Class Reference

Provides a queue/pool of slides. More...

#include <galleryslide.h>

Inheritance diagram for SlideBuffer:
Inheritance graph
[legend]
Collaboration diagram for SlideBuffer:
Collaboration graph
[legend]

Signals

void SlideReady (int count)
 Signals that buffer has (count) loaded slides awaiting display. More...
 

Public Member Functions

 SlideBuffer ()=default
 
 ~SlideBuffer () override
 
void Initialise (MythUIImage &image)
 Construct buffer. More...
 
void Teardown ()
 
bool Load (const ImagePtrK &im, int direction)
 Assign an image to next available slide, start loading and signal when done. More...
 
void Preload (const ImagePtrK &im)
 Load an image in next available slide. More...
 
void ReleaseCurrent ()
 Move head slide to back of queue and flush waiting slides. More...
 
SlideGetCurrent ()
 
SlideGetNext ()
 

Protected Member Functions

QString BufferState ()
 Determines buffer state for debug logging. More...
 

Protected Attributes

QMutex m_mutexQ {QMutex::Recursive}
 Queue protection. More...
 
QQueue< Slide * > m_queue
 Queue of slides. More...
 
int m_nextLoad {0}
 Index of first spare slide, (or last slide if none spare) More...
 

Private Slots

void Flush (Slide *slide, const QString &reason="Loaded")
 Signal if any slides are waiting to be displayed. More...
 

Detailed Description

Provides a queue/pool of slides.

Slides are cloned from a theme-provided image definition, so are created at start-up and re-used (a pool). Image requests are assigned to successive slides. When loaded a slide becomes available for display in requested order (a queue). The head slide is the one displayed, its successor is also displayed during a transition. When a transition completes the head slide is removed and returned to the tail for re-use. If a rapid batch of requests fill the buffer then subsequent requests overwrite the last slide, discarding the previous image (jumping behaviour).

Definition at line 215 of file galleryslide.h.

Constructor & Destructor Documentation

◆ SlideBuffer()

SlideBuffer::SlideBuffer ( )
default

◆ ~SlideBuffer()

SlideBuffer::~SlideBuffer ( )
override

Definition at line 573 of file galleryslide.cpp.

Member Function Documentation

◆ Initialise()

void SlideBuffer::Initialise ( MythUIImage image)

Construct buffer.

Slides are cloned from an XML image and become children of it.

Parameters
imageParent image used as a template for slides

Definition at line 593 of file galleryslide.cpp.

Referenced by GallerySlideView::Create().

◆ Teardown()

void SlideBuffer::Teardown ( )

Definition at line 579 of file galleryslide.cpp.

Referenced by GallerySlideView::Close().

◆ Load()

bool SlideBuffer::Load ( const ImagePtrK im,
int  direction 
)

Assign an image to next available slide, start loading and signal when done.

Parameters
imImage to load
directionNavigation causing the load
Returns
bool True if image is already loaded

Definition at line 654 of file galleryslide.cpp.

Referenced by GallerySlideView::ShowSlide().

◆ Preload()

void SlideBuffer::Preload ( const ImagePtrK im)

Load an image in next available slide.

Parameters
imImage to load

Definition at line 679 of file galleryslide.cpp.

Referenced by GallerySlideView::TransitionComplete().

◆ ReleaseCurrent()

void SlideBuffer::ReleaseCurrent ( )

Move head slide to back of queue and flush waiting slides.

Returns
int Number of slides waiting for display at head

Definition at line 701 of file galleryslide.cpp.

Referenced by GallerySlideView::TransitionComplete().

◆ GetCurrent()

Slide& SlideBuffer::GetCurrent ( )
inline

◆ GetNext()

Slide& SlideBuffer::GetNext ( )
inline

Definition at line 233 of file galleryslide.h.

Referenced by GallerySlideView::SlideAvailable().

◆ SlideReady

void SlideBuffer::SlideReady ( int  count)
signal

Signals that buffer has (count) loaded slides awaiting display.

Referenced by Flush().

◆ Flush

void SlideBuffer::Flush ( Slide slide,
const QString &  reason = "Loaded" 
)
privateslot

Signal if any slides are waiting to be displayed.

Parameters
slideThe slide that has loaded or being tested
reasonDebug text describing reason for test
Returns
int Number of slides available for display

Definition at line 729 of file galleryslide.cpp.

Referenced by Initialise(), and ReleaseCurrent().

◆ BufferState()

QString SlideBuffer::BufferState ( )
protected

Determines buffer state for debug logging.

Returns
String showing state of each slide

Definition at line 633 of file galleryslide.cpp.

Referenced by Flush(), Load(), and Preload().

Member Data Documentation

◆ m_mutexQ

QMutex SlideBuffer::m_mutexQ {QMutex::Recursive}
protected

Queue protection.

Definition at line 250 of file galleryslide.h.

Referenced by BufferState(), Flush(), GetCurrent(), GetNext(), Load(), Preload(), ReleaseCurrent(), and Teardown().

◆ m_queue

QQueue<Slide*> SlideBuffer::m_queue
protected

Queue of slides.

Definition at line 251 of file galleryslide.h.

Referenced by BufferState(), Flush(), GetCurrent(), GetNext(), Initialise(), Load(), Preload(), ReleaseCurrent(), and Teardown().

◆ m_nextLoad

int SlideBuffer::m_nextLoad {0}
protected

Index of first spare slide, (or last slide if none spare)

Definition at line 252 of file galleryslide.h.

Referenced by BufferState(), Initialise(), Load(), Preload(), and ReleaseCurrent().


The documentation for this class was generated from the following files: