xbmc
GUIDialogSubtitles.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "guilib/GUIDialog.h"
12 #include "threads/CriticalSection.h"
13 #include "utils/JobManager.h"
14 
15 #include <string>
16 
17 enum SUBTITLE_STORAGEMODE
18 {
19  SUBTITLE_STORAGEMODE_MOVIEPATH = 0,
20  SUBTITLE_STORAGEMODE_CUSTOMPATH
21 };
22 
23 class CFileItem;
24 class CFileItemList;
25 
27 {
28 public:
29  CGUIDialogSubtitles(void);
30  ~CGUIDialogSubtitles(void) override;
31  bool OnMessage(CGUIMessage& message) override;
32  void OnInitWindow() override;
33 
34 protected:
35  void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) override;
36  void OnJobComplete(unsigned int jobID, bool success, CJob *job) override;
37 
38  bool SetService(const std::string &service);
39  const CFileItemPtr GetService() const;
40  void FillServices();
41  void ClearServices();
42  void ClearSubtitles();
43 
44  enum STATUS { NO_SERVICES = 0, SEARCHING, SEARCH_COMPLETE, DOWNLOADING };
45  void UpdateStatus(STATUS status);
46 
47  void Search(const std::string &search="");
48  void OnSearchComplete(const CFileItemList *items);
49 
50  void Download(const CFileItem &subtitle);
51  void OnDownloadComplete(const CFileItemList *items, const std::string &language);
52 
53 
59  void OnSubtitleServiceContextMenu(int itemIdx);
60 
61  void SetSubtitles(const std::string &subtitle);
62 
63  CCriticalSection m_critsection;
64  CFileItemList* m_subtitles;
65  CFileItemList* m_serviceItems;
66  std::string m_currentService;
67  std::string m_status;
68  std::string m_strManualSearch;
69  bool m_pausedOnRun = false;
70  bool m_updateSubsList = false;
71  std::string m_LastAutoDownloaded;
72 };
Definition: GUIDialogSubtitles.h:26
void OnJobComplete(unsigned int jobID, bool success, CJob *job) override
The callback used when a job completes.
Definition: GUIDialogSubtitles.cpp:394
Base class for jobs that are executed asynchronously.
Definition: Job.h:109
Represents a list of files.
Definition: FileItem.h:713
std::string m_LastAutoDownloaded
Last video file path which automatically downloaded subtitle.
Definition: GUIDialogSubtitles.h:71
void OnInitWindow() override
Called on window open.
Definition: GUIDialogSubtitles.cpp:196
Definition: GUIDialog.h:35
Definition: GUIMessage.h:365
bool m_updateSubsList
true if we need to update our subs list
Definition: GUIDialogSubtitles.h:70
void OnDownloadComplete(const CFileItemList *items, const std::string &language)
Definition: GUIDialogSubtitles.cpp:530
void OnSubtitleServiceContextMenu(int itemIdx)
Called when the context menu is requested on a subtitle service present on the list of installed subt...
Definition: GUIDialogSubtitles.cpp:431
Represents a file on a share.
Definition: FileItem.h:102
Job Queue class to handle a queue of unique jobs to be processed sequentially.
Definition: JobManager.h:63