Go to the documentation of this file.
13 #define LOC QString("Slideview: ")
19 std::copy_if(comment.cbegin(), comment.cend(), std::back_inserter(result), [](QChar x) { return x.isPrint(); } );
35 m_transition(m_availableTransitions.Select(
39 m_slideShowTime(
gCoreContext->GetDurSetting<std::chrono::milliseconds>(
"GallerySlideShowTime", 3s)),
40 m_showCaptions(
gCoreContext->GetBoolSetting(
"GalleryShowSlideCaptions",
true)),
41 m_editsAllowed(editsAllowed)
62 LOG(VB_GUI, LOG_DEBUG,
"Created Slideview");
73 LOG(VB_GUI, LOG_DEBUG,
"Deleted Slideview");
96 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Cannot load screen 'Slideshow'");
103 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Cannot load 'Info buttonlist'");
149 for (
int i = 0; i < actions.size() && !handled; i++)
151 const QString&
action = actions[i];
156 else if (
action ==
"RIGHT")
160 else if (
action ==
"DOWN")
162 else if (
action ==
"INFO")
164 else if (
action ==
"MENU")
166 else if (
action ==
"PLAY")
173 else if (
action ==
"SELECT")
177 else if (
action ==
"STOP")
181 else if (
action ==
"ROTRIGHT")
185 else if (
action ==
"ROTLEFT")
189 else if (
action ==
"FLIPHORIZONTAL")
193 else if (
action ==
"FLIPVERTICAL")
197 else if (
action ==
"ZOOMIN")
201 else if (
action ==
"ZOOMOUT")
205 else if (
action ==
"FULLSIZE")
209 else if (
action ==
"SCROLLUP")
213 else if (
action ==
"SCROLLDOWN")
215 Pan(QPoint(0, -100));
217 else if (
action ==
"SCROLLLEFT")
219 Pan(QPoint(-120, 0));
221 else if (
action ==
"SCROLLRIGHT")
225 else if (
action ==
"RECENTER")
255 auto *me =
dynamic_cast<MythEvent *
>(event);
259 const QString& message = me->
Message();
261 QStringList extra = me->ExtraDataList();
263 if (message ==
"IMAGE_METADATA" && !extra.isEmpty())
265 int id = extra[0].toInt();
268 if (selected && selected->m_id ==
id)
271 else if (message ==
"THUMB_AVAILABLE")
273 if (!extra.isEmpty() &&
m_view->
Update(extra[0].toInt()))
281 QString resultid = dce->GetId();
282 int buttonnum = dce->GetResult();
284 if (resultid ==
"metadatamenu")
293 case 5:
Zoom(10);
break;
294 case 6:
Zoom(-10);
break;
307 auto *
menu =
new MythMenu(tr(
"Slideshow Options"),
this,
"mainmenu");
336 case kBasicInfo: details = tr(
"More Details");
break;
337 case kFullInfo: details = tr(
"Less Details");
break;
339 case kNoInfo: details = tr(
"Show Details");
break;
348 if (menuPopup->Create())
365 this,
"metadatamenu");
368 menu->AddItem(tr(
"Rotate CW"));
369 menu->AddItem(tr(
"Rotate CCW"));
370 menu->AddItem(tr(
"Flip Horizontal"));
371 menu->AddItem(tr(
"Flip Vertical"));
372 menu->AddItem(tr(
"Reset to Exif"));
376 menu->AddItem(tr(
"Zoom In"));
379 menu->AddItem(tr(
"Zoom Out"));
511 list.append(im->m_id);
590 LOG(VB_FILE, LOG_DEBUG,
LOC + QString(
"Selected %1").arg(im->m_filePath));
610 float speed = 0.5 + (count / 2.0);
616 LOG(VB_FILE, LOG_DEBUG,
LOC + QString(
"Changing speed to %1").arg(speed));
686 if (!comment.isEmpty())
814 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.
SlideOrderType
Order of images in slideshow.
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.
static QString clean_comment(const QString &comment)
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.
static void RestoreScreensaver()
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.
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.
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.
static void DisableScreensaver()
TransitionNone m_updateTransition
Instant transition that is always used for start-up & image updates.
void HideCaptions()
Hide text widgets.
@ kBasicInfo
Shows just the most useful exif tags.
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.
@ kFullInfo
Shows all exif tags.
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.
void ShowCaptions()
Show text widgets.
ImageSlideShowType
Type of slide show.
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.
void MenuTransforms(MythMenu &mainMenu)
Add Transforms submenu.
virtual void SetText(const QString &text)
static const Type kEventType
MythMainWindow * GetMythMainWindow(void)
virtual void SetSpeed(float)
void HideInfo()
Hide exif info list.
@ kSeasonal
Biased random selection so that images are more likely to appear on anniversaries.
MythScreenStack * GetStack(const QString &Stackname)
void Release()
Unpause transition timer.
void ShowInfo()
Show exif info list.
@ kOrdered
Ordered as per user setting GallerySortOrder.
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.
@ kNoInfo
Details not displayed.