Go to the documentation of this file.
13 #define LOC QString("Slideview: ")
28 m_transition(m_availableTransitions.Select(
32 m_slideShowTime(
gCoreContext->GetDurSetting<
std::chrono::milliseconds>(
"GallerySlideShowTime", 3s)),
33 m_showCaptions(
gCoreContext->GetBoolSetting(
"GalleryShowSlideCaptions",
true)),
34 m_editsAllowed(editsAllowed)
62 LOG(VB_GUI, LOG_DEBUG,
"Deleted Slideview");
85 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Cannot load screen 'Slideshow'");
92 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Cannot load 'Info buttonlist'");
138 for (
int i = 0; i < actions.size() && !handled; i++)
140 QString
action = actions[i];
145 else if (
action ==
"RIGHT")
149 else if (
action ==
"DOWN")
151 else if (
action ==
"INFO")
153 else if (
action ==
"MENU")
155 else if (
action ==
"PLAY")
162 else if (
action ==
"SELECT")
164 else if (
action ==
"STOP")
166 else if (
action ==
"ROTRIGHT")
168 else if (
action ==
"ROTLEFT")
170 else if (
action ==
"FLIPHORIZONTAL")
172 else if (
action ==
"FLIPVERTICAL")
174 else if (
action ==
"ZOOMIN")
176 else if (
action ==
"ZOOMOUT")
178 else if (
action ==
"FULLSIZE")
180 else if (
action ==
"SCROLLUP")
182 else if (
action ==
"SCROLLDOWN")
183 Pan(QPoint(0, -100));
184 else if (
action ==
"SCROLLLEFT")
185 Pan(QPoint(-120, 0));
186 else if (
action ==
"SCROLLRIGHT")
188 else if (
action ==
"RECENTER")
216 auto *me =
dynamic_cast<MythEvent *
>(event);
220 const QString& message = me->
Message();
222 QStringList extra = me->ExtraDataList();
224 if (message ==
"IMAGE_METADATA" && !extra.isEmpty())
226 int id = extra[0].toInt();
229 if (selected && selected->m_id ==
id)
232 else if (message ==
"THUMB_AVAILABLE")
234 if (!extra.isEmpty() &&
m_view->
Update(extra[0].toInt()))
242 QString resultid = dce->GetId();
243 int buttonnum = dce->GetResult();
245 if (resultid ==
"metadatamenu")
254 case 5:
Zoom(10);
break;
255 case 6:
Zoom(-10);
break;
268 auto *
menu =
new MythMenu(tr(
"Slideshow Options"),
this,
"mainmenu");
297 case kBasicInfo: details = tr(
"More Details");
break;
298 case kFullInfo: details = tr(
"Less Details");
break;
300 case kNoInfo: details = tr(
"Show Details");
break;
309 if (menuPopup->Create())
326 this,
"metadatamenu");
329 menu->AddItem(tr(
"Rotate CW"));
330 menu->AddItem(tr(
"Rotate CCW"));
331 menu->AddItem(tr(
"Flip Horizontal"));
332 menu->AddItem(tr(
"Flip Vertical"));
333 menu->AddItem(tr(
"Reset to Exif"));
337 menu->AddItem(tr(
"Zoom In"));
340 menu->AddItem(tr(
"Zoom Out"));
472 list.append(im->m_id);
551 LOG(VB_FILE, LOG_DEBUG,
LOC + QString(
"Selected %1").arg(im->m_filePath));
571 float speed = 0.5 + count / 2.0;
577 LOG(VB_FILE, LOG_DEBUG,
LOC + QString(
"Changing speed to %1").arg(speed));
646 if (!im->m_comment.isEmpty())
647 text << im->m_comment;
772 SetStatus(tr(
"Failed to load %1").arg(im ? im->m_filePath :
"?"));
A datastore of images for display by a screen. Provides an ordered list of images (no dirs) from a di...
QSharedPointer< ImageItemK > ImagePtrK
A specialised image for slideshows.
void Display(ImageItemK &im, const QStringList &tagStrings)
Build list of metadata tags.
ImagePtrK HasNext(int inc) const
Peeks at next image in view but does not advance iterator.
static const Type kMythEventMessage
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
ImageSlideShowType
Type of slide show.
bool m_showCaptions
If true, captions are shown.
void Transform(ImageFileTransform state)
Action transform request.
MythUIText * m_uiSlideCount
void SlideReady(int count)
Signals that buffer has (count) loaded slides awaiting display.
bool m_editsAllowed
True when edits are enabled.
ImageManagerFe & m_mgr
Manages the images.
void Rotate(int id)
Rotate view so that starting image is at front.
virtual bool LoadFromDb(int parentId)
Populate view with database images from a directory.
This class is used as a container for messages.
InfoList m_infoList
Image details overlay.
void customEvent(QEvent *event) override
Handle custom events.
void Start(ImageSlideShowType type, int parentId, int selectedId=0)
Start slideshow.
@ kNoInfo
Details not displayed.
void Update(const ImagePtrK &im)
Populates available exif details for the current image/dir.
bool m_transitioning
True when a transition is in progress.
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythUIText * m_uiHideCaptions
A datastore of images for display by a screen.
Screen in which all other widgets are contained and rendered.
@ kSeasonal
Biased random selection so that images are more likely to appear on anniversaries.
void TransitionComplete()
Transition to new slide has finished.
void Suspend()
Pause transition timer temporarily.
Base class of an animated transition that can be accelerated & reversed.
QString GetPosition() const
Get positional status.
virtual void Pulse(void)
Pulse is called 70 times a second to trigger a single frame of an animation.
SlideBuffer m_slides
A queue of slides used to display images.
void Stop()
Stop a playing slideshow.
bool Select(int id, int fallback=0)
Selects first occurrence of an image.
const QString & Message() const
bool HandleMedia(const QString &Handler, const QString &Mrl, const QString &Plot="", const QString &Title="", const QString &Subtitle="", const QString &Director="", int Season=0, int Episode=0, const QString &Inetref="", std::chrono::minutes LenMins=2h, const QString &Year="1895", const QString &Id="", bool UseBookmarks=false)
VERBOSE_PREAMBLE Most true
void SlideAvailable(int count)
Start transition.
ImagePtrK Prev(int inc)
Decrements iterator and returns previous image. Wraps at start.
GallerySlideView(MythScreenStack *parent, const char *name, bool editsAllowed)
Constructor.
QString ChangeOrientation(ImageFileTransform transform, const ImageIdList &ids)
Apply an orientation transform to images.
void PlayVideo()
Starts internal player for video.
MythUIType * GetFocusWidget(void) const
bool Update(int id)
Updates view with images that have been updated.
void addListener(QObject *listener)
Add a listener to the observable.
void ReleaseCurrent()
Move head slide to back of queue and flush waiting slides.
TransitionNone m_updateTransition
Instant transition that is always used for start-up & image updates.
void HideCaptions()
Hide text widgets.
bool Load(const ImagePtrK &im, int direction)
Assign an image to next available slide, start loading and signal when done.
void ShowPrevSlide(int inc=1)
Display the previous slide in the sequence.
FlatView * m_view
List of images comprising the slideshow.
void Toggle(const ImagePtrK &im)
Toggle infolist state for an image. Focusable widgets toggle between Basic & Full info....
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
void ClearStatus(const Slide &slide)
virtual void Start(Slide &from, Slide &to, bool forwards, float speed=1.0)
Start base transition.
QTimer m_delay
Status delay timer.
bool SetFocusWidget(MythUIType *widget=nullptr)
Basic menu dialog, message and a list of options.
void Clear()
Reset slide to unused state.
static MythThemedMenu * menu
ImagePtrK HasPrev(int inc) const
Peeks at previous image in view but does not decrement iterator.
std::enable_if_t< std::chrono::__is_duration< T >::value, T > GetDurSetting(const QString &key, T defaultval=T::zero())
void Pan(QPoint offset)
Initiate pan.
void BuildFocusList(void)
std::chrono::milliseconds m_slideShowTime
Time to display a slide in a slideshow.
Transition & m_transition
Selected transition.
void Zoom(int increment=0)
Zoom current slide.
static QString LongDateOf(const ImagePtrK &im)
Return a timestamp/datestamp for an image or dir.
ImagePtrK GetImageData() const
ImagePtrK GetSelected() const
Get current selection.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
InfoVisibleState GetState() const
bool m_playing
True when slideshow is running.
bool Create() override
Initialises the graphical elements.
int GetNumSetting(const QString &key, int defaultval=0)
void Preload(const ImagePtrK &im)
Load an image in next available slide.
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
void ShowSlide(int direction=0)
Display slide.
ImagePtrK Next(int inc)
Advance iterator and return next image, wrapping if necessary. Regenerates unordered views on wrap.
QString m_statusText
Text to display as status.
void Initialise(MythUIImage &image)
Construct buffer.
bool GetBoolSetting(const QString &key, bool defaultval=false)
bool Hide()
Remove infolist from display.
@ kFullInfo
Shows all exif tags.
void ShowCaptions()
Show text widgets.
MythUIText * m_uiCaptionText
void Zoom(int percentage)
Initiate slide zoom.
Provides view datastores for Gallery screens.
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
void SetStatus(QString msg, bool delay=false)
Displays status text (Loading, Paused etc.)
The image manager for use by Frontends.
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
bool m_suspended
True when transition is running or video playing.
~GallerySlideView() override
Destructor.
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
@ kBasicInfo
Shows just the most useful exif tags.
void MenuTransforms(MythMenu &mainMenu)
Add Transforms submenu.
virtual void SetText(const QString &text)
static const Type kEventType
MythMainWindow * GetMythMainWindow(void)
SlideOrderType
Order of images in slideshow.
virtual void SetSpeed(float)
void HideInfo()
Hide exif info list.
MythScreenStack * GetStack(const QString &Stackname)
void Release()
Unpause transition timer.
@ kOrdered
Ordered as per user setting GallerySortOrder.
void ShowInfo()
Show exif info list.
bool Create(bool focusable)
Initialise buttonlist from XML.
void Pan(QPoint offset=QPoint(0, 0))
Pan current slide.
MythPainter * GetMythPainter(void)
QTimer m_timer
Slide duration timer.
void Pulse() override
Update transition.
bool keyPressEvent(QKeyEvent *event) override
Handle keypresses.
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
void removeListener(QObject *listener)
Remove a listener to the observable.
void MenuMain()
Shows the popup menu.