[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / video / windows / GUIWindowVideoBase.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2013 Team XBMC
5  *      http://www.xbmc.org
6  *
7  *  This Program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  This Program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with XBMC; see the file COPYING.  If not, see
19  *  <http://www.gnu.org/licenses/>.
20  *
21  */
22
23 #include "windows/GUIMediaWindow.h"
24 #include "video/VideoDatabase.h"
25 #include "PlayListPlayer.h"
26 #include "video/VideoThumbLoader.h"
27
28 class CGUIWindowVideoBase : public CGUIMediaWindow, public IBackgroundLoaderObserver, public IStreamDetailsObserver
29 {
30 public:
31   CGUIWindowVideoBase(int id, const CStdString &xmlFile);
32   virtual ~CGUIWindowVideoBase(void);
33   virtual bool OnMessage(CGUIMessage& message);
34   virtual bool OnAction(const CAction &action);
35
36   void PlayMovie(const CFileItem *item);
37   static void GetResumeItemOffset(const CFileItem *item, int& startoffset, int& partNumber);
38   static bool HasResumeItemOffset(const CFileItem *item);
39
40   void AddToDatabase(int iItem);
41   virtual void OnInfo(CFileItem* pItem, const ADDON::ScraperPtr& scraper);
42   virtual void OnStreamDetails(const CStreamDetails &details, const CStdString &strFileName, long lFileId);
43   static void MarkWatched(const CFileItemPtr &pItem, bool bMark);
44   static void UpdateVideoTitle(const CFileItem* pItem);
45
46   /*! \brief Show dialog allowing selection of wanted playback item */
47   static bool ShowPlaySelection(CFileItemPtr& item);
48   static bool ShowPlaySelection(CFileItemPtr& item, const CStdString& directory);
49
50
51   /*! \brief Show the resume menu for this item (if it has a resume bookmark)
52    If a resume bookmark is found, we set the item's m_lStartOffset to STARTOFFSET_RESUME.
53    Note that we do this in favour of setting the resume point, as we need additional
54    information from the database (in particular, the playerState) when resuming some items
55    (eg ISO/VIDEO_TS).
56    \param item item to check for a resume bookmark
57    \return true if an option was chosen, false if the resume menu was cancelled.
58    */
59   static bool ShowResumeMenu(CFileItem &item);
60
61   /*! \brief Append a set of search items to a results list using a specific prepend label
62    Sorts the search items first, then appends with the given prependLabel to the results list.
63    Then empty the search item list so it can be refilled.
64    \param searchItems The search items to append.
65    \param prependLabel the label that should be prepended to all search results.
66    \param results the fileitemlist to append the search results to.
67    \sa DoSearch
68    */
69   static void AppendAndClearSearchItems(CFileItemList &searchItems, const CStdString &prependLabel, CFileItemList &results);
70
71   /*! \brief Prompt the user for assigning content to a path.
72    Based on changes, we then call OnUnassignContent, update or refresh scraper information in the database
73    and optionally start a scan
74    \param path the path to assign content for
75    */
76   static void OnAssignContent(const CStdString &path);
77
78   /*! \brief checks the database for a resume position and puts together a string
79    \param item selected item
80    \return string containing the resume position or an empty string if there is no resume position
81    */
82   static CStdString GetResumeString(const CFileItem &item);
83
84 protected:
85   void OnScan(const CStdString& strPath, bool scanAll = false);
86   virtual void OnInitWindow();
87   virtual void UpdateButtons();
88   virtual bool Update(const CStdString &strDirectory, bool updateFilterPath = true);
89   virtual bool GetDirectory(const CStdString &strDirectory, CFileItemList &items);
90   virtual void OnItemLoaded(CFileItem* pItem) {};
91   virtual void GetGroupedItems(CFileItemList &items);
92
93   virtual bool CheckFilterAdvanced(CFileItemList &items) const;
94   virtual bool CanContainFilter(const CStdString &strDirectory) const;
95
96   virtual void GetContextButtons(int itemNumber, CContextButtons &buttons);
97   void GetNonContextButtons(int itemNumber, CContextButtons &buttons);
98   virtual bool OnContextButton(int itemNumber, CONTEXT_BUTTON button);
99   virtual void OnQueueItem(int iItem);
100   virtual void OnDeleteItem(CFileItemPtr pItem);
101   virtual void OnDeleteItem(int iItem);
102   virtual void DoSearch(const CStdString& strSearch, CFileItemList& items) {};
103   virtual CStdString GetStartFolder(const CStdString &dir);
104
105   bool OnClick(int iItem);
106   bool OnSelect(int iItem);
107   /*! \brief react to an Info action on a view item
108    \param item the selected item
109    \return true if the action is performed, false otherwise
110    */
111   bool OnInfo(int item);
112   /*! \brief perform a given action on a file
113    \param item the selected item
114    \param action the action to perform
115    \return true if the action is performed, false otherwise
116    */
117   bool OnFileAction(int item, int action);
118
119   void OnRestartItem(int iItem);
120   bool OnResumeItem(int iItem);
121   void PlayItem(int iItem);
122   virtual bool OnPlayMedia(int iItem);
123   virtual bool OnPlayAndQueueMedia(const CFileItemPtr &item);
124   void LoadPlayList(const CStdString& strPlayList, int iPlayList = PLAYLIST_VIDEO);
125
126   bool ShowIMDB(CFileItem *item, const ADDON::ScraperPtr& content);
127
128   void AddItemToPlayList(const CFileItemPtr &pItem, CFileItemList &queuedItems);
129
130   void OnSearch();
131   void OnSearchItemFound(const CFileItem* pSelItem);
132   int GetScraperForItem(CFileItem *item, ADDON::ScraperPtr &info, VIDEO::SScanSettings& settings);
133
134   static bool OnUnAssignContent(const CStdString &path, int label1, int label2, int label3);
135
136   static bool StackingAvailable(const CFileItemList &items);
137
138   bool OnPlayStackPart(int item);
139
140   CGUIDialogProgress* m_dlgProgress;
141   CVideoDatabase m_database;
142
143   CVideoThumbLoader m_thumbLoader;
144   bool m_stackingAvailable;
145 };