[PVR][Estuary] Timer settings dialog: Show client name in timer type selection dialog...
[xbmc.git] / xbmc / pictures / GUIWindowSlideShow.h
blob6955fb4748bf5747564bb63b4e9a901f466002f8
1 /*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #pragma once
11 #include "SlideShowPicture.h"
12 #include "guilib/GUIDialog.h"
13 #include "threads/Event.h"
14 #include "threads/Thread.h"
15 #include "utils/SortUtils.h"
17 #include <memory>
18 #include <set>
20 class CFileItemList;
21 class CVariant;
23 class CGUIWindowSlideShow;
25 class CBackgroundPicLoader : public CThread
27 public:
28 CBackgroundPicLoader();
29 ~CBackgroundPicLoader() override;
31 void Create(CGUIWindowSlideShow *pCallback);
32 void LoadPic(int iPic, int iSlideNumber, const std::string &strFileName, const int maxWidth, const int maxHeight);
33 bool IsLoading() { return m_isLoading; }
34 int SlideNumber() const { return m_iSlideNumber; }
35 int Pic() const { return m_iPic; }
37 private:
38 void Process() override;
39 int m_iPic;
40 int m_iSlideNumber;
41 std::string m_strFileName;
42 int m_maxWidth;
43 int m_maxHeight;
45 CEvent m_loadPic;
46 bool m_isLoading;
48 CGUIWindowSlideShow *m_pCallback;
51 class CGUIWindowSlideShow : public CGUIDialog
53 public:
54 CGUIWindowSlideShow(void);
55 ~CGUIWindowSlideShow() override = default;
57 bool OnMessage(CGUIMessage& message) override;
58 EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event) override;
59 bool OnAction(const CAction &action) override;
60 void Render() override;
61 void RenderEx() override;
62 void Process(unsigned int currentTime, CDirtyRegionList &regions) override;
63 void OnDeinitWindow(int nextWindowID) override;
65 void Reset();
66 void Add(const CFileItem *picture);
67 bool IsPlaying() const;
68 void Select(const std::string& strPicture);
69 void GetSlideShowContents(CFileItemList &list);
70 std::shared_ptr<const CFileItem> GetCurrentSlide();
71 void RunSlideShow(const std::string &strPath, bool bRecursive = false,
72 bool bRandom = false, bool bNotRandom = false,
73 const std::string &beginSlidePath="", bool startSlideShow = true,
74 SortBy method = SortByLabel,
75 SortOrder order = SortOrderAscending,
76 SortAttribute sortAttributes = SortAttributeNone,
77 const std::string &strExtensions="");
78 void AddFromPath(const std::string &strPath, bool bRecursive,
79 SortBy method = SortByLabel,
80 SortOrder order = SortOrderAscending,
81 SortAttribute sortAttributes = SortAttributeNone,
82 const std::string &strExtensions="");
83 void StartSlideShow();
84 bool InSlideShow() const;
85 void OnLoadPic(int iPic,
86 int iSlideNumber,
87 const std::string& strFileName,
88 std::unique_ptr<CTexture> pTexture,
89 bool bFullSize);
90 int NumSlides() const;
91 int CurrentSlide() const;
92 void Shuffle();
93 bool IsPaused() const { return m_bPause; }
94 bool IsShuffled() const { return m_bShuffled; }
95 int GetDirection() const { return m_iDirection; }
97 static void RunSlideShow(const std::vector<std::string>& paths, int start = 0);
99 private:
100 void ShowNext();
101 void ShowPrevious();
102 void SetDirection(int direction); // -1: rewind, 1: forward
104 typedef std::set<std::string> path_set; // set to track which paths we're adding
105 void AddItems(const std::string &strPath, path_set *recursivePaths,
106 SortBy method = SortByLabel,
107 SortOrder order = SortOrderAscending,
108 SortAttribute sortAttributes = SortAttributeNone);
109 bool PlayVideo();
110 CSlideShowPic::DISPLAY_EFFECT GetDisplayEffect(int iSlideNumber) const;
111 void RenderPause();
112 void RenderErrorMessage();
113 void Rotate(float fAngle, bool immediate = false);
114 void Zoom(int iZoom);
115 void ZoomRelative(float fZoom, bool immediate = false);
116 void Move(float fX, float fY);
117 void GetCheckedSize(float width, float height, int &maxWidth, int &maxHeight);
118 std::string GetPicturePath(CFileItem *item);
119 int GetNextSlide();
121 void AnnouncePlayerPlay(const CFileItemPtr& item);
122 void AnnouncePlayerPause(const CFileItemPtr& item);
123 void AnnouncePlayerStop(const CFileItemPtr& item);
124 void AnnouncePlaylistClear();
125 void AnnouncePlaylistAdd(const CFileItemPtr& item, int pos);
126 void AnnouncePropertyChanged(const std::string &strProperty, const CVariant &value);
128 int m_iCurrentSlide;
129 int m_iNextSlide;
130 int m_iDirection;
131 float m_fRotate;
132 float m_fInitialRotate;
133 int m_iZoomFactor;
134 float m_fZoom;
135 float m_fInitialZoom;
137 bool m_bShuffled;
138 bool m_bSlideShow;
139 bool m_bPause;
140 bool m_bPlayingVideo;
141 int m_iVideoSlide = -1;
142 bool m_bErrorMessage;
144 std::vector<CFileItemPtr> m_slides;
146 CSlideShowPic m_Image[2];
148 int m_iCurrentPic;
149 // background loader
150 std::unique_ptr<CBackgroundPicLoader> m_pBackgroundLoader;
151 int m_iLastFailedNextSlide;
152 bool m_bLoadNextPic;
153 RESOLUTION m_Resolution;
154 CPoint m_firstGesturePoint;