forked from xbmc/xbmc
-
Notifications
You must be signed in to change notification settings - Fork 6
/
GUIWindowSlideShow.h
156 lines (139 loc) · 5.08 KB
/
GUIWindowSlideShow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#pragma once
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include <set>
#include "guilib/GUIWindow.h"
#include "threads/Thread.h"
#include "threads/CriticalSection.h"
#include "threads/Event.h"
#include "SlideShowPicture.h"
#include "DllImageLib.h"
#include "utils/SortUtils.h"
class CFileItemList;
class CVariant;
class CGUIWindowSlideShow;
class CBackgroundPicLoader : public CThread
{
public:
CBackgroundPicLoader();
~CBackgroundPicLoader();
void Create(CGUIWindowSlideShow *pCallback);
void LoadPic(int iPic, int iSlideNumber, const CStdString &strFileName, const int maxWidth, const int maxHeight);
bool IsLoading() { return m_isLoading;};
int SlideNumber() const { return m_iSlideNumber; }
int Pic() const { return m_iPic; }
private:
void Process();
int m_iPic;
int m_iSlideNumber;
CStdString m_strFileName;
int m_maxWidth;
int m_maxHeight;
CEvent m_loadPic;
bool m_isLoading;
CGUIWindowSlideShow *m_pCallback;
};
class CGUIWindowSlideShow : public CGUIWindow
{
public:
CGUIWindowSlideShow(void);
virtual ~CGUIWindowSlideShow(void);
void Reset();
void Add(const CFileItem *picture);
bool IsPlaying() const;
void ShowNext();
void ShowPrevious();
void Select(const CStdString& strPicture);
const CFileItemList &GetSlideShowContents();
void GetSlideShowContents(CFileItemList &list);
const CFileItemPtr GetCurrentSlide();
void RunSlideShow(const CStdString &strPath, bool bRecursive = false,
bool bRandom = false, bool bNotRandom = false,
const CStdString &beginSlidePath="", bool startSlideShow = true,
SORT_METHOD method = SORT_METHOD_LABEL,
SortOrder order = SortOrderAscending, const CStdString &strExtensions="");
void AddFromPath(const CStdString &strPath, bool bRecursive,
SORT_METHOD method=SORT_METHOD_LABEL,
SortOrder order = SortOrderAscending, const CStdString &strExtensions="");
void StartSlideShow();
bool InSlideShow() const;
virtual bool OnMessage(CGUIMessage& message);
virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event);
virtual bool OnAction(const CAction &action);
virtual void Render();
virtual void Process(unsigned int currentTime, CDirtyRegionList ®ions);
virtual void OnDeinitWindow(int nextWindowID);
void OnLoadPic(int iPic, int iSlideNumber, const CStdString &strFileName, CBaseTexture* pTexture, bool bFullSize);
int NumSlides() const;
int CurrentSlide() const;
void Shuffle();
bool IsPaused() const { return m_bPause; }
bool IsShuffled() const { return m_bShuffled; }
int GetDirection() const { return m_iDirection; }
void SetDirection(int direction); // -1: rewind, 1: forward
private:
typedef std::set<CStdString> path_set; // set to track which paths we're adding
void AddItems(const CStdString &strPath, path_set *recursivePaths,
SORT_METHOD method = SORT_METHOD_LABEL,
SortOrder order = SortOrderAscending);
bool PlayVideo();
CSlideShowPic::DISPLAY_EFFECT GetDisplayEffect(int iSlideNumber) const;
void RenderPause();
void RenderErrorMessage();
void Rotate(float fAngle, bool immediate = false);
void Zoom(int iZoom);
void ZoomRelative(float fZoom, bool immediate = false);
void Move(float fX, float fY);
void GetCheckedSize(float width, float height, int &maxWidth, int &maxHeight);
CStdString GetPicturePath(CFileItem *item);
int GetNextSlide();
void AnnouncePlayerPlay(const CFileItemPtr& item);
void AnnouncePlayerPause(const CFileItemPtr& item);
void AnnouncePlayerStop(const CFileItemPtr& item);
void AnnouncePlaylistRemove(int pos);
void AnnouncePlaylistClear();
void AnnouncePlaylistAdd(const CFileItemPtr& item, int pos);
void AnnouncePropertyChanged(const std::string &strProperty, const CVariant &value);
int m_iCurrentSlide;
int m_iNextSlide;
int m_iDirection;
float m_fRotate;
float m_fInitialRotate;
int m_iZoomFactor;
float m_fZoom;
float m_fInitialZoom;
bool m_bShuffled;
bool m_bSlideShow;
bool m_bPause;
bool m_bPlayingVideo;
bool m_bErrorMessage;
CFileItemList* m_slides;
CSlideShowPic m_Image[2];
int m_iCurrentPic;
// background loader
CBackgroundPicLoader* m_pBackgroundLoader;
int m_iLastFailedNextSlide;
bool m_bLoadNextPic;
DllImageLib m_ImageLib;
RESOLUTION m_Resolution;
CCriticalSection m_slideSection;
CStdString m_strExtensions;
CPoint m_firstGesturePoint;
};