[ExecString] combine SplitParameters with identical function of CUtil
[xbmc.git] / xbmc / dialogs / GUIDialogExtendedProgressBar.h
blob1be7c3d78cc48a793bed39a454bc2b9ecd3f784e
1 /*
2 * Copyright (C) 2012-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.
7 */
9 #pragma once
11 #include "guilib/GUIDialog.h"
13 #include <string>
14 #include <vector>
16 class CGUIDialogProgressBarHandle
18 public:
19 explicit CGUIDialogProgressBarHandle(const std::string& strTitle) : m_strTitle(strTitle) {}
20 virtual ~CGUIDialogProgressBarHandle(void) = default;
22 const std::string &Title(void) { return m_strTitle; }
23 void SetTitle(const std::string &strTitle);
25 std::string Text(void) const;
26 void SetText(const std::string &strText);
28 bool IsFinished(void) const { return m_bFinished; }
29 void MarkFinished(void) { m_bFinished = true; }
31 float Percentage(void) const { return m_fPercentage;}
32 void SetPercentage(float fPercentage) { m_fPercentage = fPercentage; }
33 void SetProgress(int currentItem, int itemCount);
35 private:
36 mutable CCriticalSection m_critSection;
37 float m_fPercentage = 0;
38 std::string m_strTitle;
39 std::string m_strText;
40 bool m_bFinished = false;
43 class CGUIDialogExtendedProgressBar : public CGUIDialog
45 public:
46 CGUIDialogExtendedProgressBar(void);
47 ~CGUIDialogExtendedProgressBar(void) override = default;
48 bool OnMessage(CGUIMessage& message) override;
49 void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) override;
51 CGUIDialogProgressBarHandle *GetHandle(const std::string &strTitle);
53 protected:
54 void UpdateState(unsigned int currentTime);
56 CCriticalSection m_critSection;
57 unsigned int m_iCurrentItem;
58 unsigned int m_iLastSwitchTime;
59 std::vector<CGUIDialogProgressBarHandle *> m_handles;