This repository has been archived by the owner on Sep 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 75
/
GUIViewState.h
123 lines (102 loc) · 3.78 KB
/
GUIViewState.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
#pragma once
/*
* Copyright (C) 2005-2008 Team XBMC
* http://www.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, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#include "utils/LabelFormatter.h"
#include "SortFileItem.h"
#include "MediaSource.h"
class CViewState; // forward
class CFileItemList;
class CGUIViewState
{
public:
virtual ~CGUIViewState();
static CGUIViewState* GetViewState(int windowId, const CFileItemList& items);
void SetViewAsControl(int viewAsControl);
void SaveViewAsControl(int viewAsControl);
int GetViewAsControl() const;
SORT_METHOD SetNextSortMethod(int direction = 1);
void SetCurrentSortMethod(int method);
SORT_METHOD GetSortMethod() const;
int GetSortMethodLabel() const;
void GetSortMethodLabelMasks(LABEL_MASKS& masks) const;
void GetSortMethods(std::vector< std::pair<int,int> > &sortMethods) const;
SortOrder SetNextSortOrder();
SortOrder GetSortOrder() const { return m_sortOrder; };
SortOrder GetDisplaySortOrder() const;
virtual bool HideExtensions();
virtual bool HideParentDirItems();
virtual bool DisableAddSourceButtons();
virtual int GetPlaylist();
const CStdString& GetPlaylistDirectory();
void SetPlaylistDirectory(const CStdString& strDirectory);
bool IsCurrentPlaylistDirectory(const CStdString& strDirectory);
virtual bool AutoPlayNextItem();
virtual CStdString GetLockType();
virtual CStdString GetExtensions();
virtual VECSOURCES& GetSources();
protected:
CGUIViewState(const CFileItemList& items); // no direct object creation, use GetViewState()
virtual void SaveViewState()=0;
virtual void SaveViewToDb(const CStdString &path, int windowID, CViewState *viewState = NULL);
void LoadViewState(const CStdString &path, int windowID);
/*! \brief Add the addons source for the given content type, if the user has suitable addons
\param content the type of addon content desired
\param label the name of the addons source
\param thumb the skin image to use as the icon
*/
void AddAddonsSource(const CStdString &content, const CStdString &label, const CStdString& thumb);
#if defined(TARGET_ANDROID)
void AddAndroidSource(const CStdString &content, const CStdString &label, const CStdString& thumb);
#endif
void AddLiveTVSources();
void AddSortMethod(SORT_METHOD sortMethod, int buttonLabel, LABEL_MASKS labelmasks);
void SetSortMethod(SORT_METHOD sortMethod);
void SetSortOrder(SortOrder sortOrder);
const CFileItemList& m_items;
static VECSOURCES m_sources;
int m_currentViewAsControl;
int m_playlist;
std::vector<SORT_METHOD_DETAILS> m_sortMethods;
int m_currentSortMethod;
SortOrder m_sortOrder;
static CStdString m_strPlaylistDirectory;
};
class CGUIViewStateGeneral : public CGUIViewState
{
public:
CGUIViewStateGeneral(const CFileItemList& items);
protected:
virtual void SaveViewState() {};
};
class CGUIViewStateFromItems : public CGUIViewState
{
public:
CGUIViewStateFromItems(const CFileItemList& items);
protected:
virtual void SaveViewState();
};
class CGUIViewStateLibrary : public CGUIViewState
{
public:
CGUIViewStateLibrary(const CFileItemList& items);
protected:
virtual void SaveViewState();
};