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.
11 #include "guilib/GUIDialog.h"
12 #include "threads/CriticalSection.h"
13 #include "utils/JobManager.h"
17 enum SUBTITLE_STORAGEMODE
19 SUBTITLE_STORAGEMODE_MOVIEPATH
= 0,
20 SUBTITLE_STORAGEMODE_CUSTOMPATH
26 class CGUIDialogSubtitles
: public CGUIDialog
, CJobQueue
29 CGUIDialogSubtitles(void);
30 ~CGUIDialogSubtitles(void) override
;
31 bool OnMessage(CGUIMessage
& message
) override
;
32 void OnInitWindow() override
;
35 void Process(unsigned int currentTime
, CDirtyRegionList
&dirtyregions
) override
;
36 void OnJobComplete(unsigned int jobID
, bool success
, CJob
*job
) override
;
38 bool SetService(const std::string
&service
);
39 const CFileItemPtr
GetService() const;
42 void ClearSubtitles();
44 enum STATUS
{ NO_SERVICES
= 0, SEARCHING
, SEARCH_COMPLETE
, DOWNLOADING
};
45 void UpdateStatus(STATUS status
);
47 void Search(const std::string
&search
="");
48 void OnSearchComplete(const CFileItemList
*items
);
50 void Download(const CFileItem
&subtitle
);
51 void OnDownloadComplete(const CFileItemList
*items
, const std::string
&language
);
55 \brief Called when the context menu is requested on a subtitle service
56 present on the list of installed subtitle addons
57 \param itemIdx the index of the selected subtitle service on the list
59 void OnSubtitleServiceContextMenu(int itemIdx
);
61 void SetSubtitles(const std::string
&subtitle
);
63 CCriticalSection m_critsection
;
64 CFileItemList
* m_subtitles
;
65 CFileItemList
* m_serviceItems
;
66 std::string m_currentService
;
68 std::string m_strManualSearch
;
69 bool m_pausedOnRun
= false;
70 bool m_updateSubsList
= false; ///< true if we need to update our subs list
71 std::string m_LastAutoDownloaded
; ///< Last video file path which automatically downloaded subtitle