15#define LOC QString("Slideview: ")
21 std::copy_if(comment.cbegin(), comment.cend(), std::back_inserter(result), [](QChar x) { return x.isPrint(); } );
37 m_transition(m_availableTransitions.Select(
41 m_slideShowTime(
gCoreContext->GetDurSetting<
std::chrono::milliseconds>(
"GallerySlideShowTime", 3s)),
42 m_showCaptions(
gCoreContext->GetBoolSetting(
"GalleryShowSlideCaptions",
true)),
43 m_editsAllowed(editsAllowed)
64 LOG(VB_GUI, LOG_DEBUG,
"Created Slideview");
75 LOG(VB_GUI, LOG_DEBUG,
"Deleted Slideview");
98 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Cannot load screen 'Slideshow'");
105 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Cannot load 'Info buttonlist'");
151 for (
int i = 0; i < actions.size() && !handled; i++)
153 const QString&
action = actions[i];
158 else if (
action ==
"RIGHT")
162 else if (
action ==
"DOWN")
164 else if (
action ==
"INFO")
166 else if (
action ==
"MENU")
168 else if (
action ==
"PLAY")
175 else if (
action ==
"SELECT")
179 else if (
action ==
"STOP")
183 else if (
action ==
"ROTRIGHT")
187 else if (
action ==
"ROTLEFT")
191 else if (
action ==
"FLIPHORIZONTAL")
195 else if (
action ==
"FLIPVERTICAL")
199 else if (
action ==
"ZOOMIN")
203 else if (
action ==
"ZOOMOUT")
207 else if (
action ==
"FULLSIZE")
211 else if (
action ==
"SCROLLUP")
215 else if (
action ==
"SCROLLDOWN")
217 Pan(QPoint(0, -100));
219 else if (
action ==
"SCROLLLEFT")
221 Pan(QPoint(-120, 0));
223 else if (
action ==
"SCROLLRIGHT")
227 else if (
action ==
"RECENTER")
257 auto *me =
dynamic_cast<MythEvent *
>(event);
261 const QString& message = me->
Message();
263 QStringList extra = me->ExtraDataList();
265 if (message ==
"IMAGE_METADATA" && !extra.isEmpty())
267 int id = extra[0].toInt();
270 if (selected && selected->m_id ==
id)
273 else if (message ==
"THUMB_AVAILABLE")
275 if (!extra.isEmpty() &&
m_view->
Update(extra[0].toInt()))
283 QString resultid = dce->GetId();
284 int buttonnum = dce->GetResult();
286 if (resultid ==
"metadatamenu")
295 case 5:
Zoom(10);
break;
296 case 6:
Zoom(-10);
break;
309 auto *
menu =
new MythMenu(tr(
"Slideshow Options"),
this,
"mainmenu");
338 case kBasicInfo: details = tr(
"More Details");
break;
339 case kFullInfo: details = tr(
"Less Details");
break;
341 case kNoInfo: details = tr(
"Show Details");
break;
350 if (menuPopup->Create())
367 this,
"metadatamenu");
370 menu->AddItem(tr(
"Rotate CW"));
371 menu->AddItem(tr(
"Rotate CCW"));
372 menu->AddItem(tr(
"Flip Horizontal"));
373 menu->AddItem(tr(
"Flip Vertical"));
374 menu->AddItem(tr(
"Reset to Exif"));
378 menu->AddItem(tr(
"Zoom In"));
381 menu->AddItem(tr(
"Zoom Out"));
513 list.append(im->m_id);
592 LOG(VB_FILE, LOG_DEBUG,
LOC + QString(
"Selected %1").arg(im->m_filePath));
612 float speed = 0.5F + (count / 2.0F);
618 LOG(VB_FILE, LOG_DEBUG,
LOC + QString(
"Changing speed to %1").arg(speed));
688 if (!comment.isEmpty())
816 SetStatus(tr(
"Failed to load %1").arg(im ? im->m_filePath :
"?"));
Event dispatched from MythUI modal dialogs to a listening class containing a result of some form.
static const Type kEventType
A datastore of images for display by a screen.
bool Update(int id)
Updates view with images that have been updated.
ImagePtrK Prev(int inc)
Decrements iterator and returns previous image. Wraps at start.
bool Select(int id, int fallback=0)
Selects first occurrence of an image.
ImagePtrK HasNext(int inc) const
Peeks at next image in view but does not advance iterator.
ImagePtrK Next(int inc)
Advance iterator and return next image, wrapping if necessary. Regenerates unordered views on wrap.
QString GetPosition() const
Get positional status.
ImagePtrK GetSelected() const
Get current selection.
virtual bool LoadFromDb(int parentId)
Populate view with database images from a directory.
ImagePtrK HasPrev(int inc) const
Peeks at previous image in view but does not decrement iterator.
void Rotate(int id)
Rotate view so that starting image is at front.
void ClearStatus(const Slide &slide)
QString m_statusText
Text to display as status.
MythUIText * m_uiSlideCount
QTimer m_timer
Slide duration timer.
MythUIText * m_uiHideCaptions
ImageManagerFe & m_mgr
Manages the images.
bool m_showCaptions
If true, captions are shown.
void ShowInfo()
Show exif info list.
void HideCaptions()
Hide text widgets.
~GallerySlideView() override
Destructor.
void PlayVideo()
Starts internal player for video.
void Release()
Unpause transition timer.
FlatView * m_view
List of images comprising the slideshow.
void customEvent(QEvent *event) override
Handle custom events.
void HideInfo()
Hide exif info list.
SlideBuffer m_slides
A queue of slides used to display images.
bool Create() override
Initialises the graphical elements.
bool m_editsAllowed
True when edits are enabled.
bool m_transitioning
True when a transition is in progress.
void ShowCaptions()
Show text widgets.
TransitionNone m_updateTransition
Instant transition that is always used for start-up & image updates.
void Start(ImageSlideShowType type, int parentId, int selectedId=0)
Start slideshow.
void TransitionComplete()
Transition to new slide has finished.
QTimer m_delay
Status delay timer.
void SetStatus(QString msg, bool delay=false)
Displays status text (Loading, Paused etc.)
void Pan(QPoint offset=QPoint(0, 0))
Pan current slide.
MythUIText * m_uiCaptionText
void MenuTransforms(MythMenu &mainMenu)
Add Transforms submenu.
InfoList m_infoList
Image details overlay.
void MenuMain()
Shows the popup menu.
GallerySlideView(MythScreenStack *parent, const char *name, bool editsAllowed)
Constructor.
void Stop()
Stop a playing slideshow.
void Zoom(int increment=0)
Zoom current slide.
bool m_playing
True when slideshow is running.
void Pulse() override
Update transition.
void Suspend()
Pause transition timer temporarily.
bool m_suspended
True when transition is running or video playing.
void SlideAvailable(int count)
Start transition.
Transition & m_transition
Selected transition.
bool keyPressEvent(QKeyEvent *event) override
Handle keypresses.
void ShowPrevSlide(int inc=1)
Display the previous slide in the sequence.
std::chrono::milliseconds m_slideShowTime
Time to display a slide in a slideshow.
void Transform(ImageFileTransform state)
Action transform request.
void ShowSlide(int direction=0)
Display slide.
The image manager for use by Frontends.
QString ChangeOrientation(ImageFileTransform transform, const ImageIdList &ids)
Apply an orientation transform to images.
static QString LongDateOf(const ImagePtrK &im)
Return a timestamp/datestamp for an image or dir.
void Display(ImageItemK &im, const QStringList &tagStrings)
Build list of metadata tags.
void Update(const ImagePtrK &im)
Populates available exif details for the current image/dir.
InfoVisibleState GetState() const
bool Hide()
Remove infolist from display.
void Toggle(const ImagePtrK &im)
Toggle infolist state for an image. Focusable widgets toggle between Basic & Full info....
bool Create(bool focusable)
Initialise buttonlist from XML.
void SaveSetting(const QString &key, int newValue)
int GetNumSetting(const QString &key, int defaultval=0)
std::enable_if_t< std::chrono::__is_duration< T >::value, T > GetDurSetting(const QString &key, T defaultval=T::zero())
bool GetBoolSetting(const QString &key, bool defaultval=false)
Basic menu dialog, message and a list of options.
This class is used as a container for messages.
const QString & Message() const
static const Type kMythEventMessage
static void DisableScreensaver()
bool TranslateKeyPress(const QString &Context, QKeyEvent *Event, QStringList &Actions, bool AllowJumps=true)
Get a list of actions for a keypress in the given context.
MythScreenStack * GetStack(const QString &Stackname)
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)
static void RestoreScreensaver()
void addListener(QObject *listener)
Add a listener to the observable.
void removeListener(QObject *listener)
Remove a listener to the observable.
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
Screen in which all other widgets are contained and rendered.
void BuildFocusList(void)
MythUIType * GetFocusWidget(void) const
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
bool SetFocusWidget(MythUIType *widget=nullptr)
void Reset(void) override
Reset the widget to it's original state, should not reset changes made by the theme.
virtual void SetText(const QString &text)
virtual void Pulse(void)
Pulse is called 70 times a second to trigger a single frame of an animation.
void ReleaseCurrent()
Move head slide to back of queue and flush waiting slides.
void Initialise(MythUIImage &image)
Construct buffer.
bool Load(const ImagePtrK &im, int direction)
Assign an image to next available slide, start loading and signal when done.
void Preload(const ImagePtrK &im)
Load an image in next available slide.
void SlideReady(int count)
Signals that buffer has (count) loaded slides awaiting display.
A specialised image for slideshows.
void Pan(QPoint offset)
Initiate pan.
void Zoom(int percentage)
Initiate slide zoom.
ImagePtrK GetImageData() const
void Clear()
Reset slide to unused state.
Base class of an animated transition that can be accelerated & reversed.
virtual void Start(Slide &from, Slide &to, bool forwards, float speed=1.0)
Start base transition.
virtual void SetSpeed(float)
A datastore of images for display by a screen. Provides an ordered list of images (no dirs) from a di...
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
@ kNoInfo
Details not displayed.
@ kBasicInfo
Shows just the most useful exif tags.
@ kFullInfo
Shows all exif tags.
static QString clean_comment(const QString &comment)
ImageSlideShowType
Type of slide show.
Provides view datastores for Gallery screens.
SlideOrderType
Order of images in slideshow.
@ kSeasonal
Biased random selection so that images are more likely to appear on anniversaries.
@ kOrdered
Ordered as per user setting GallerySortOrder.
QSharedPointer< ImageItemK > ImagePtrK
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
MythConfirmationDialog * ShowOkPopup(const QString &message, bool showCancel)
Non-blocking version of MythPopupBox::showOkPopup()
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
MythPainter * GetMythPainter(void)
MythMainWindow * GetMythMainWindow(void)
static MythThemedMenu * menu
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
VERBOSE_PREAMBLE Most true