MythTV  master
galleryslide.cpp
Go to the documentation of this file.
1 #include "galleryslide.h"
2 
3 #include <cmath> // for roundf
4 #include "mythmainwindow.h"
5 #include "mythlogging.h"
6 
7 #include "imagemetadata.h"
8 
9 #define LOC QString("Slide: ")
10 #define SBLOC QString("SlideBuffer: ")
11 
12 
13 // Number of slides to use for buffering image requests.
14 // When browsing quickly the buffer will load consecutive slides until it fills.
15 // If too large, rapid browsing will be stodgy (sequential access) for images that
16 // aren't cached (Cached images are always fast).
17 // If too small, rapid browsing will result in skipping slides rather than flicking
18 // quickly through them.
19 // Minimum is 4: 3 for displaying a transition, 1 to handle load requests
20 #define SLIDE_BUFFER_SIZE 9
21 
22 
28 void AbstractAnimation::Start(bool forwards, float speed)
29 {
30  m_forwards = forwards;
31  m_speed = speed;
32  m_running = true;
33 }
34 
35 
44 void Animation::Set(const QVariant& from, const QVariant& to,
45  std::chrono::milliseconds duration,
46  const QEasingCurve& curve, UIEffects::Centre centre)
47 {
48  setStartValue(from);
49  setEndValue(to);
50  m_centre = centre;
51  setDuration(duration.count());
52  setEasingCurve(curve);
53 }
54 
55 
61 void Animation::Start(bool forwards, float speed)
62 {
63  auto duration_ms = std::chrono::milliseconds(duration());
64  if (duration_ms == 0ms)
65  return;
66 
67  m_elapsed = forwards ? 0ms : duration_ms;
68  setCurrentTime(m_elapsed.count());
69 
70  AbstractAnimation::Start(forwards, speed);
71 }
72 
73 
77 {
78  if (!m_running)
79  return;
80 
81  std::chrono::milliseconds current = MythDate::currentMSecsSinceEpochAsDuration();
82  std::chrono::milliseconds interval = std::min(current - m_lastUpdate, 50ms);
84  m_elapsed += (m_forwards ? interval : -interval) * static_cast<int>(m_speed);
85  setCurrentTime(m_elapsed.count());
86 
87  // Detect completion
88  if ((m_forwards && m_elapsed.count() >= duration()) || (!m_forwards && m_elapsed <= 0ms))
89  Finished();
90 }
91 
92 
97 void Animation::updateCurrentValue(const QVariant &value)
98 {
99  if (m_parent && m_running)
100  {
102 
103  switch (m_type)
104  {
105  case None: break;
106  case Position: m_parent->SetPosition(value.toPoint()); break;
107  case Alpha: m_parent->SetAlpha(value.toInt()); break;
108  case Zoom: m_parent->SetZoom(value.toFloat()); break;
109  case HorizontalZoom: m_parent->SetHorizontalZoom(value.toFloat()); break;
110  case VerticalZoom: m_parent->SetVerticalZoom(value.toFloat()); break;
111  case Angle: m_parent->SetAngle(value.toFloat()); break;
112  }
113  }
114 }
115 
116 
122 {
123  // Signal group when child completes
124  m_group.append(child);
125  connect(child, &AbstractAnimation::finished, this, &GroupAnimation::Finished);
126 }
127 
128 
133 {
134  qDeleteAll(m_group);
135  m_group.clear();
136 }
137 
138 
142 {
143  if (!m_running || m_current < 0 || m_current >= m_group.size())
144  return;
145 
146  // Pulse current running child
147  m_group.at(m_current)->Pulse();
148 }
149 
150 
156 void SequentialAnimation::Start(bool forwards, float speed)
157 {
158  if (m_group.empty())
159  return;
160 
161  m_current = forwards ? 0 : m_group.size() - 1;
162 
163  // Start group, then first child
164  GroupAnimation::Start(forwards, speed);
165  m_group.at(m_current)->Start(m_forwards, m_speed);
166 }
167 
168 
174 {
175  // Set group speed for subsequent children
177 
178  // Set active child
179  if (!m_running || m_current < 0 || m_current >= m_group.size())
180  return;
181 
182  m_group.at(m_current)->SetSpeed(speed);
183 }
184 
185 
190 {
191  // Finish group when last child finishes
192  if ((m_forwards && ++m_current == m_group.size())
193  || (!m_forwards && --m_current < 0))
195  else
196  // Start next child
197  m_group.at(m_current)->Start(m_forwards, m_speed);
198 }
199 
200 
204 {
205  if (m_running)
206  {
207  // Pulse all children
208  for (AbstractAnimation *animation : qAsConst(m_group))
209  animation->Pulse();
210  }
211 }
212 
213 
219 void ParallelAnimation::Start(bool forwards, float speed)
220 {
221  if (m_group.empty())
222  return;
223 
224  m_finished = m_group.size();
225 
226  // Start group, then all children
227  GroupAnimation::Start(forwards, speed);
228  for (AbstractAnimation *animation : qAsConst(m_group))
229  animation->Start(m_forwards, m_speed);
230 }
231 
232 
238 {
239  // Set group speed, then all children
241  for (AbstractAnimation *animation : qAsConst(m_group))
242  animation->SetSpeed(m_speed);
243 }
244 
245 
250 {
251  // Finish group when last child finishes
252  if (--m_finished == 0)
254 }
255 
256 
261 void PanAnimation::updateCurrentValue(const QVariant &value)
262 {
263  if (m_parent && m_running)
264  {
265  Slide *image = m_parent;
266  image->SetPan(value.toPoint());
267  }
268 }
269 
270 
277 Slide::Slide(MythUIType *parent, const QString& name, MythUIImage *image)
278  : MythUIImage(parent, name)
279 {
280  // Clone from image
281  CopyFrom(image);
282 
283  // Null parent indicates we should become a child of the image (after
284  // copy to avoid recursion)
285  if (!parent)
286  {
287  // Slides sit on top of parent image area
288  SetArea(MythRect(image->GetArea().toQRect()));
289  m_area.moveTo(0, 0);
290  setParent(image);
291  m_parent = image;
292  image->AddChild(this);
293  }
294 
295  // Provide animations for pan & zoom
296  if (GetPainter()->SupportsAnimation())
297  {
299  m_panAnimation = new PanAnimation(this);
300  }
301 
302  connect(this, &MythUIImage::LoadComplete, this, &Slide::SlideLoaded);
303 }
304 
305 
310 {
311  delete m_zoomAnimation;
312  delete m_panAnimation;
313  LOG(VB_GUI, LOG_DEBUG, "Deleted Slide " + objectName());
314 }
315 
316 
321 {
322  m_state = kEmpty;
323  m_data.clear();
324  m_waitingFor.clear();
325  SetCropRect(0, 0, 0, 0);
326  SetVisible(false);
327 }
328 
329 
334 QChar Slide::GetDebugState() const
335 {
336  switch (m_state)
337  {
338  case kEmpty: return 'e';
339  case kFailed: return 'f';
340  case kLoaded: return m_waitingFor ? 'r' : 'a';
341  case kLoading: return m_waitingFor ? 'l' : 'p';
342  }
343  return '?';
344 }
345 
346 
359 bool Slide::LoadSlide(const ImagePtrK& im, int direction, bool notifyCompletion)
360 {
361  m_direction = direction;
362  m_waitingFor = notifyCompletion ? im : ImagePtrK();
363 
364  if (im == m_data)
365  {
366  LOG(VB_FILE, LOG_DEBUG, LOC + QString("Already loading/loaded %1 in %2")
367  .arg(im->m_filePath, objectName()));
368 
369  if (m_state >= kLoaded && notifyCompletion)
370  // Image has been pre-loaded
371  emit ImageLoaded(this);
372 
373  return (m_state >= kLoaded);
374  }
375 
376  // Is a different image loading ?
377  if (m_state == kLoading)
378  {
379  // Can't abort image loads, so must wait for it to finish
380  // before starting new load
381  m_waitingFor = im;
382 
383  LOG(VB_FILE, LOG_DEBUG, LOC + QString("Postponing load of %1 in %2")
384  .arg(im->m_filePath, objectName()));
385 
386  return false;
387  }
388 
389  // Start load
390  m_data = im;
391  m_state = kLoading;
392 
393  if (im->m_type == kVideoFile)
394  {
395  // Use thumbnail, which has already been orientated
396  SetFilename(im->m_thumbNails.at(0).second);
397  SetOrientation(1);
398  }
399  else
400  {
401  // Load image, compensating for any Qt auto-orientation
402  SetFilename(im->m_url);
403  SetOrientation(Orientation(m_data->m_orientation).GetCurrent(true));
404  }
405 
406  // Load in background
407  Load(true);
408  return false;
409 }
410 
411 
419 {
420  m_state = m_images[0] ? kLoaded : kFailed;
421  if (m_state == kFailed)
422  LOG(VB_GENERAL, LOG_ERR, LOC +
423  QString("Failed to load %1").arg(m_data->m_filePath));
424 
425  // Ignore superseded requests and preloads
426  if (m_data == m_waitingFor)
427  {
428  // Loaded image is the latest requested
429  emit ImageLoaded(this);
430  }
431  else if (m_waitingFor)
432  {
433  LOG(VB_FILE, LOG_DEBUG, LOC + QString("Starting delayed load %1")
434  .arg(m_waitingFor->m_filePath));
435 
436  // Start latest postponed load
438  }
439 }
440 
441 
447 void Slide::Zoom(int percentage)
448 {
449  // Sentinel indicates reset to default zoom
450  float newZoom = (percentage == 0)
451  ? 1.0F
452  : qMax(MIN_ZOOM,
453  qMin(MAX_ZOOM, m_zoom * (1.0F + percentage / 100.0F)));
454  if (newZoom != m_zoom)
455  {
456  if (m_zoomAnimation)
457  {
458  m_zoomAnimation->Set(m_zoom, newZoom, 250ms, QEasingCurve::OutQuad);
460  }
461  else
462  SetZoom(newZoom);
463  }
464 }
465 
466 
473 void Slide::SetZoom(float zoom)
474 {
475  m_zoom = zoom;
477 
478  // TODO
479  // MythUIImage displaces widget or doesn't centre for some combinations of
480  // zoom centre/cropping so frig centre for now.
482 
483  SetPan(m_pan);
484 }
485 
486 
491 void Slide::Pan(QPoint offset)
492 {
493  // Panning only possible when zoomed in
494  if (m_zoom > 1.0F)
495  {
496  QPoint start = m_pan;
497 
498  // Sentinel indicates reset to centre
499  // Panning is applied to original (unzoomed) image co-ords.
500  // Adjust offset for zoom so that pan moves a constant screen distance rather
501  // than constant image distance
502  QPoint dest = offset.isNull() ? QPoint(0, 0) : start + offset / m_zoom;
503 
504  if (m_panAnimation)
505  {
506  m_panAnimation->Set(start, dest, 250ms, QEasingCurve::Linear);
508  }
509  else
510  SetPan(dest);
511  }
512 }
513 
514 
521 void Slide::SetPan(QPoint pos)
522 {
523  if (m_state == kFailed)
524  {
525  m_pan = pos;
526  return;
527  }
528 
529  // Determine zoom of largest dimension
530  QRect imageArea = m_images[m_curPos]->rect();
531  float hRatio = float(imageArea.height()) / m_area.height();
532  float wRatio = float(imageArea.width()) / m_area.width();
533  float ratio = qMax(hRatio, wRatio);
534 
535  if (m_zoom != 0.0F)
536  ratio /= m_zoom;
537 
538  // Determine crop area
539  int h = qMin(int(roundf(m_area.height() * ratio)), imageArea.height());
540  int w = qMin(int(roundf(m_area.width() * ratio)), imageArea.width());
541  int x = imageArea.center().x() - w / 2;
542  int y = imageArea.center().y() - h / 2;
543 
544  // Constrain pan to boundaries
545  int limitX = (imageArea.width() - w) / 2;
546  int limitY = (imageArea.height() - h) / 2;
547  m_pan.setX(qMax(qMin(pos.x(), limitX), -limitX));
548  m_pan.setY(qMax(qMin(pos.y(), limitY), -limitY));
549 
550  SetCropRect(x + m_pan.x(), y + m_pan.y(), w, h);
551  SetRedraw();
552 }
553 
554 
559 {
560  // Update zoom/pan animations
561  if (m_zoomAnimation)
563 
564  if (m_panAnimation)
566 }
567 
568 
570 {
571  LOG(VB_GUI, LOG_DEBUG, "Deleted Slidebuffer");
572 }
573 
574 
576 {
577  QMutexLocker lock(&m_mutexQ);
578  for (Slide *s : qAsConst(m_queue))
579  s->Clear();
580  LOG(VB_GUI, LOG_DEBUG, "Aborted Slidebuffer");
581 }
582 
583 
590 {
591  // Require at least 4 slides: 2 for transitions, 1 to handle further requests
592  // and 1 to prevent solitary slide from being used whilst it is loading
593  int size = qMax(SLIDE_BUFFER_SIZE, 4);
594 
595  // Fill buffer with slides cloned from the XML image widget
596 
597  // Create first as a child of the XML image.
598  auto *slide = new Slide(nullptr, "slide0", &image);
599 
600  // Buffer is notified when it has loaded image
601  connect(slide, &Slide::ImageLoaded,
602  this, qOverload<Slide*>(&SlideBuffer::Flush));
603 
604  m_queue.enqueue(slide);
605 
606  // Rest are simple clones of first
607  for (int i = 1; i < size; ++i)
608  {
609  slide = new Slide(&image, QString("slide%1").arg(i), slide);
610 
611  // All slides (except first) start off hidden
612  slide->SetVisible(false);
613 
614  // Buffer is notified when it has loaded image
615  connect(slide, &Slide::ImageLoaded,
616  this, qOverload<Slide*>(&SlideBuffer::Flush));
617 
618  m_queue.enqueue(slide);
619  }
620 
621  m_nextLoad = 1;
622 }
623 
624 
630 {
631  QMutexLocker lock(&m_mutexQ);
632 
633  QString state;
634  for (int i = 0; i < m_queue.size(); ++i)
635  {
636  QChar code(m_queue.at(i)->GetDebugState());
637  state += (i == m_nextLoad ? code.toUpper() : code);
638  }
639  return QString("[%1] (%2)").arg(state, m_queue.head()->objectName());
640 }
641 
642 
650 bool SlideBuffer::Load(const ImagePtrK& im, int direction)
651 {
652  if (!im)
653  return false;
654 
655  QMutexLocker lock(&m_mutexQ);
656 
657  // Start loading image in next available slide
658  Slide *slide = m_queue.at(m_nextLoad);
659 
660  // Further load requests will go to same slide if no free ones are available
661  if (m_nextLoad < m_queue.size() - 1)
662  ++m_nextLoad;
663 
664  LOG(VB_FILE, LOG_DEBUG, SBLOC + QString("Loading %1 in %2, %3")
665  .arg(im->m_filePath, slide->objectName(), BufferState()));
666 
667  return slide->LoadSlide(im, direction, true);
668 }
669 
670 
676 {
677  if (!im)
678  return;
679 
680  QMutexLocker lock(&m_mutexQ);
681 
682  // Start loading image in next available slide
683  Slide *slide = m_queue.at(m_nextLoad);
684 
685  LOG(VB_FILE, LOG_DEBUG, SBLOC + QString("Preloading %1 in %2, %3")
686  .arg(im->m_filePath, slide->objectName(), BufferState()));
687 
688  // Load silently
689  slide->LoadSlide(im);
690 }
691 
692 
698 {
699  QMutexLocker lock(&m_mutexQ);
700 
701  // Reset slide & return to buffer for re-use
702  Slide *slide = m_queue.dequeue();
703  slide->Clear();
704  m_queue.enqueue(slide);
705 
706  QString name = slide->objectName();
707 
708  // Free constrained load ptr now a spare slide is available
709  if (!m_queue.at(--m_nextLoad)->IsEmpty())
710  ++m_nextLoad;
711 
712  LOG(VB_FILE, LOG_DEBUG, SBLOC + QString("Released %1").arg(name));
713 
714  // Flush any pending slides that originate from multiple requests (skipping)
715  Flush(m_queue.head(), "Pending");
716 }
717 
718 
725 void SlideBuffer::Flush(Slide *slide, const QString& reason)
726 {
727  QMutexLocker lock(&m_mutexQ);
728 
729  // Determine number of consecutive slides that are now available after head
730  // Include last slide to ensure transition speed is consistent: it will never
731  // be displayed because queue size is always > 2
732  int available = 1;
733  while (available < m_queue.size() && m_queue.at(available)->IsLoaded())
734  ++available;
735 
736  if (available == 1)
737  return;
738 
739  // Notify that more slides are available
740  ImagePtrK im = slide->GetImageData();
741  QString path = im ? im->m_filePath : "Unknown";
742 
743  LOG(VB_FILE, LOG_DEBUG, SBLOC + QString("%1 %2 in %3, %4")
744  .arg(reason, path, slide->objectName(), BufferState()));
745 
746  emit SlideReady(--available);
747 }
748 
750 {
751  Flush(slide, "Loaded");
752 };
Slide::kFailed
@ kFailed
Definition: galleryslide.h:188
Slide::~Slide
~Slide() override
Destructor.
Definition: galleryslide.cpp:309
MythUIType::m_area
MythRect m_area
Definition: mythuitype.h:271
Animation::m_elapsed
std::chrono::milliseconds m_elapsed
Current millisec position within animation, 0..duration.
Definition: galleryslide.h:84
ImagePtrK
QSharedPointer< ImageItemK > ImagePtrK
Definition: imagetypes.h:165
Slide
A specialised image for slideshows.
Definition: galleryslide.h:156
UIEffects::TopLeft
@ TopLeft
Definition: mythuianimation.h:15
build_compdb.dest
dest
Definition: build_compdb.py:9
Slide::SetZoom
void SetZoom(float zoom)
Sets slide zoom.
Definition: galleryslide.cpp:473
ParallelAnimation::SetSpeed
void SetSpeed(float speed) override
Change speed of group and all child animations.
Definition: galleryslide.cpp:237
Slide::m_pan
QPoint m_pan
Pan position (0,0) = no pan.
Definition: galleryslide.h:199
MythUIImage
Image widget, displays a single image or multiple images in sequence.
Definition: mythuiimage.h:97
MIN_ZOOM
#define MIN_ZOOM
Definition: galleryslide.h:19
kVideoFile
@ kVideoFile
A video.
Definition: imagetypes.h:40
AbstractAnimation::Finished
virtual void Finished()
To be called when animation completes.
Definition: galleryslide.h:39
Animation::m_centre
UIEffects::Centre m_centre
Definition: galleryslide.h:81
MythUIImage::m_images
QHash< int, MythImage * > m_images
Definition: mythuiimage.h:170
Animation::HorizontalZoom
@ HorizontalZoom
Definition: galleryslide.h:58
SequentialAnimation::Finished
void Finished() override
A child animation has completed.
Definition: galleryslide.cpp:189
MythRect::toQRect
QRect toQRect(void) const
Definition: mythrect.cpp:405
Slide::Pulse
void Pulse() override
Update pan & zoom animations.
Definition: galleryslide.cpp:558
SlideBuffer::SlideReady
void SlideReady(int count)
Signals that buffer has (count) loaded slides awaiting display.
SLIDE_BUFFER_SIZE
#define SLIDE_BUFFER_SIZE
Definition: galleryslide.cpp:20
ParallelAnimation::Finished
void Finished() override
A child animation has completed.
Definition: galleryslide.cpp:249
Slide::m_panAnimation
PanAnimation * m_panAnimation
Dedicated animation for panning, if supported.
Definition: galleryslide.h:198
Slide::Slide
Slide(MythUIType *parent, const QString &name, MythUIImage *image)
Clone slide from a theme MythUIImage.
Definition: galleryslide.cpp:277
MythUIImage::Load
bool Load(bool allowLoadInBackground=true, bool forceStat=false)
Load the image(s), wraps ImageLoader::LoadImage()
Definition: mythuiimage.cpp:968
Slide::SlideLoaded
void SlideLoaded()
An image has completed loading.
Definition: galleryslide.cpp:418
SequentialAnimation::m_current
int m_current
Index of child currently playing.
Definition: galleryslide.h:123
Animation::m_lastUpdate
std::chrono::milliseconds m_lastUpdate
Definition: galleryslide.h:85
MythUIType::GetPainter
virtual MythPainter * GetPainter(void)
Definition: mythuitype.cpp:1399
AbstractAnimation::m_forwards
bool m_forwards
Play direction.
Definition: galleryslide.h:46
MythUIImage::SetOrientation
void SetOrientation(int orientation)
Saves the exif orientation value of the first image in the widget.
Definition: mythuiimage.cpp:921
MythUIType::SetArea
virtual void SetArea(const MythRect &rect)
Definition: mythuitype.cpp:595
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:23
GroupAnimation::m_group
QList< AbstractAnimation * > m_group
Definition: galleryslide.h:104
Slide::kLoading
@ kLoading
Definition: galleryslide.h:188
MythRect
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
Definition: mythrect.h:17
AbstractAnimation
Base animation class that is driven by a Myth pulse and implements variable speed.
Definition: galleryslide.h:26
MythDate::current
QDateTime current(bool stripped)
Returns current Date and Time in UTC.
Definition: mythdate.cpp:10
MAX_ZOOM
#define MAX_ZOOM
Definition: galleryslide.h:20
Orientation::GetCurrent
int GetCurrent(bool compensate)
Determines orientation required for an image.
Definition: imagemetadata.cpp:85
Animation::Angle
@ Angle
Definition: galleryslide.h:58
MythUIType::GetArea
virtual MythRect GetArea(void) const
If the object has a minimum area defined, return it, other wise return the default area.
Definition: mythuitype.cpp:870
MythUIType::AddChild
void AddChild(MythUIType *child)
Add a child UIType.
Definition: mythuitype.cpp:86
MythUIType::m_effects
UIEffects m_effects
Definition: mythuitype.h:278
SlideBuffer::ReleaseCurrent
void ReleaseCurrent()
Move head slide to back of queue and flush waiting slides.
Definition: galleryslide.cpp:697
Slide::m_data
ImagePtrK m_data
The image currently loading/loaded.
Definition: galleryslide.h:191
Animation::m_type
Type m_type
Definition: galleryslide.h:80
Animation::Pulse
void Pulse() override
Progress single animation.
Definition: galleryslide.cpp:76
MythUIImage::SetCropRect
void SetCropRect(int x, int y, int width, int height)
Crop the image using the given rectangle, useful for removing unsightly edges from imported images or...
Definition: mythuiimage.cpp:949
Animation::Set
void Set(const QVariant &from, const QVariant &to, std::chrono::milliseconds duration=500ms, const QEasingCurve &curve=QEasingCurve::InOutCubic, UIEffects::Centre centre=UIEffects::Middle)
Initialises an animation.
Definition: galleryslide.cpp:44
Slide::kEmpty
@ kEmpty
Definition: galleryslide.h:188
SlideBuffer::Load
bool Load(const ImagePtrK &im, int direction)
Assign an image to next available slide, start loading and signal when done.
Definition: galleryslide.cpp:650
SlideBuffer::m_nextLoad
int m_nextLoad
Index of first spare slide, (or last slide if none spare)
Definition: galleryslide.h:257
MythUIType::SetAlpha
void SetAlpha(int newalpha)
Definition: mythuitype.cpp:931
AbstractAnimation::Start
virtual void Start(bool forwards, float speed=1.0)
Initialise & start base animation.
Definition: galleryslide.cpp:28
AbstractAnimation::m_speed
float m_speed
Real-time = 1.0, Double-speed = 2.0.
Definition: galleryslide.h:48
mythlogging.h
SlideBuffer::Teardown
void Teardown()
Definition: galleryslide.cpp:575
PanAnimation::updateCurrentValue
void updateCurrentValue(const QVariant &value) override
Update pan value.
Definition: galleryslide.cpp:261
MythUIImage::LoadComplete
void LoadComplete()
MythUIImage::m_curPos
unsigned int m_curPos
Definition: mythuiimage.h:178
LOC
#define LOC
Definition: galleryslide.cpp:9
MythUIType::SetPosition
void SetPosition(int x, int y)
Convenience method, calls SetPosition(const MythPoint&) Override that instead to change functionality...
Definition: mythuitype.cpp:518
SlideBuffer::Flush
void Flush(Slide *slide, const QString &reason)
Signal if any slides are waiting to be displayed.
Definition: galleryslide.cpp:725
SBLOC
#define SBLOC
Definition: galleryslide.cpp:10
UIEffects::Middle
@ Middle
Definition: mythuianimation.h:16
Slide::Clear
void Clear()
Reset slide to unused state.
Definition: galleryslide.cpp:320
Slide::m_zoom
float m_zoom
Current zoom, 1.0 = fullsize.
Definition: galleryslide.h:194
GroupAnimation::Start
void Start(bool forwards, float speed=1.0) override
Initialise & start base animation.
Definition: galleryslide.h:96
Slide::Pan
void Pan(QPoint offset)
Initiate pan.
Definition: galleryslide.cpp:491
Slide::LoadSlide
bool LoadSlide(const ImagePtrK &im, int direction=0, bool notifyCompletion=false)
Load slide with an image.
Definition: galleryslide.cpp:359
Slide::SetPan
void SetPan(QPoint pos)
Sets slide pan.
Definition: galleryslide.cpp:521
MythUIType::m_parent
MythUIType * m_parent
Definition: mythuitype.h:291
Slide::ImageLoaded
void ImageLoaded(Slide *)
Generated when the last requested image has loaded.
Slide::GetImageData
ImagePtrK GetImageData() const
Definition: galleryslide.h:165
Animation::m_parent
Slide * m_parent
Image to be animated.
Definition: galleryslide.h:79
Slide::m_state
SlideState m_state
Slide validity.
Definition: galleryslide.h:190
MythUIImage::CopyFrom
void CopyFrom(MythUIType *base) override
Copy this widgets state from another.
Definition: mythuiimage.cpp:1429
UIEffects::m_centre
Centre m_centre
Definition: mythuianimation.h:42
AbstractAnimation::m_running
bool m_running
True whilst animation is active.
Definition: galleryslide.h:47
SlideBuffer::Preload
void Preload(const ImagePtrK &im)
Load an image in next available slide.
Definition: galleryslide.cpp:675
Slide::GetDebugState
QChar GetDebugState() const
Return debug status.
Definition: galleryslide.cpp:334
MythUIType
The base class on which all widgets and screens are based.
Definition: mythuitype.h:84
SlideBuffer::Initialise
void Initialise(MythUIImage &image)
Construct buffer.
Definition: galleryslide.cpp:589
Animation::Zoom
@ Zoom
Definition: galleryslide.h:58
Animation
A single animation controlling alpha, zoom, rotation and position.
Definition: galleryslide.h:54
Animation::Position
@ Position
Definition: galleryslide.h:58
MythDate::currentMSecsSinceEpochAsDuration
std::chrono::milliseconds currentMSecsSinceEpochAsDuration(void)
Definition: mythdate.cpp:194
galleryslide.h
Defines specialised images used by the Gallery slideshow and the animation framework used by transfor...
Slide::Zoom
void Zoom(int percentage)
Initiate slide zoom.
Definition: galleryslide.cpp:447
SlideBuffer::m_mutexQ
QRecursiveMutex m_mutexQ
Queue protection.
Definition: galleryslide.h:254
UIEffects::m_vzoom
float m_vzoom
Definition: mythuianimation.h:40
SequentialAnimation::Start
void Start(bool forwards, float speed=1.0) override
Start sequential animation.
Definition: galleryslide.cpp:156
Slide::kLoaded
@ kLoaded
Definition: galleryslide.h:188
Slide::m_zoomAnimation
Animation * m_zoomAnimation
Dedicated animation for zoom, if supported.
Definition: galleryslide.h:197
ParallelAnimation::Start
void Start(bool forwards, float speed=1.0) override
Start parallel group. All children play simultaneously.
Definition: galleryslide.cpp:219
GroupAnimation::SetSpeed
void SetSpeed(float speed) override
Definition: galleryslide.h:98
imagemetadata.h
Handles Exif/FFMpeg metadata tags for images.
SequentialAnimation::Pulse
void Pulse() override
Progress sequential animation.
Definition: galleryslide.cpp:141
SlideBuffer::BufferState
QString BufferState()
Determines buffer state for debug logging.
Definition: galleryslide.cpp:629
GroupAnimation::Add
virtual void Add(AbstractAnimation *child)
Add child animation to group.
Definition: galleryslide.cpp:121
MythUIType::SetVisible
virtual void SetVisible(bool visible)
Definition: mythuitype.cpp:1086
SequentialAnimation::SetSpeed
void SetSpeed(float speed) override
Change speed of current child animation and all subsequent ones.
Definition: galleryslide.cpp:173
UIEffects::Centre
Centre
Definition: mythuianimation.h:15
ParallelAnimation::m_finished
int m_finished
Count of child animations that have finished.
Definition: galleryslide.h:141
ParallelAnimation::Pulse
void Pulse() override
Progress parallel animations.
Definition: galleryslide.cpp:203
Slide::m_direction
int m_direction
Navigation that created this image, -1 = Prev, 0 = Update, 1 = Next.
Definition: galleryslide.h:196
MythUIType::SetHorizontalZoom
void SetHorizontalZoom(float zoom)
Definition: mythuitype.cpp:956
Animation::VerticalZoom
@ VerticalZoom
Definition: galleryslide.h:58
GroupAnimation::Clear
void Clear() override
Delete all child animations.
Definition: galleryslide.cpp:132
PanAnimation
Specialised animation for panning slideshow images (MythUI doesn't support panning)
Definition: galleryslide.h:147
SlideBuffer::m_queue
QQueue< Slide * > m_queue
Queue of slides.
Definition: galleryslide.h:256
MythUIType::SetCentre
void SetCentre(UIEffects::Centre centre)
Definition: mythuitype.cpp:945
MythUIType::SetAngle
void SetAngle(float angle)
Definition: mythuitype.cpp:968
UIEffects::m_hzoom
float m_hzoom
Definition: mythuianimation.h:39
MythUIType::SetVerticalZoom
void SetVerticalZoom(float zoom)
Definition: mythuitype.cpp:962
MythUIImage::SetFilename
void SetFilename(const QString &filename)
Must be followed by a call to Load() to load the image.
Definition: mythuiimage.cpp:676
Slide::m_waitingFor
ImagePtrK m_waitingFor
The most recently requested image. Null for preloads. Differs from m_data when skipping.
Definition: galleryslide.h:193
Animation::Start
void Start(bool forwards=true, float speed=1.0) override
Start a single animation.
Definition: galleryslide.cpp:61
mythmainwindow.h
SlideBuffer::~SlideBuffer
~SlideBuffer() override
Definition: galleryslide.cpp:569
MythUIType::SetRedraw
void SetRedraw(void)
Definition: mythuitype.cpp:294
Animation::None
@ None
Definition: galleryslide.h:58
Animation::Alpha
@ Alpha
Definition: galleryslide.h:58
AbstractAnimation::finished
void finished()
Signals animation has finished.
Orientation
Encapsulates Exif orientation processing.
Definition: imagemetadata.h:62
Animation::updateCurrentValue
void updateCurrentValue(const QVariant &value) override
Update animated value.
Definition: galleryslide.cpp:97