kodi
GUIDialogCache.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 "filesystem/IFileTypes.h"
12 #include "threads/SystemClock.h"
13 #include "threads/Thread.h"
14 
15 #include <string>
16 
17 class CGUIDialogProgress;
18 
20 {
21 public:
22  CGUIDialogCache(std::chrono::milliseconds delay = std::chrono::milliseconds(100),
23  const std::string& strHeader = "",
24  const std::string& strMsg = "");
25  ~CGUIDialogCache() override;
26  void SetHeader(const std::string& strHeader);
27  void SetHeader(int nHeader);
28  void SetMessage(const std::string& strMessage);
29  bool IsCanceled() const;
30  void ShowProgressBar(bool bOnOff);
31  void SetPercentage(int iPercentage);
32 
33  void Close(bool bForceClose = false);
34 
35  void Process() override;
36  bool OnFileCallback(void* pContext, int ipercent, float avgSpeed) override;
37 
38 protected:
39 
40  void OpenDialog();
41 
42  XbmcThreads::EndTime<> m_endtime;
43  CGUIDialogProgress* m_pDlg;
44  std::string m_strHeader;
45  std::string m_strLinePrev;
46  std::string m_strLinePrev2;
47  bool bSentCancel;
48 };
Definition: Thread.h:44
Definition: SystemClock.h:31
Definition: GUIDialogCache.h:19
Definition: GUIDialogProgress.h:16
Definition: IFileTypes.h:112