[videodb] remove unused seasons table from episode_view
[xbmc.git] / xbmc / dialogs / GUIDialogProgress.h
blobba8426901355bfc993624a5a8271d713bb1a526e
1 /*
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.
7 */
9 #pragma once
11 #include "GUIDialogBoxBase.h"
12 #include "IProgressCallback.h"
14 #include <array>
16 class CGUIDialogProgress :
17 public CGUIDialogBoxBase, public IProgressCallback
19 public:
20 CGUIDialogProgress(void);
21 ~CGUIDialogProgress(void) override;
23 void Reset();
24 void Open(const std::string &param = "");
25 bool OnMessage(CGUIMessage& message) override;
26 bool OnBack(int actionID) override;
27 void OnWindowLoaded() override;
28 void Progress();
29 bool IsCanceled() const { return m_iChoice == CHOICE_CANCELED; }
30 void SetPercentage(int iPercentage);
31 int GetPercentage() const { return m_percentage; }
32 void ShowProgressBar(bool bOnOff);
34 void ShowChoice(int iChoice, const CVariant& label);
36 static constexpr int CHOICE_NONE = -2;
37 static constexpr int CHOICE_CANCELED = -1;
38 int GetChoice() const;
40 /*! \brief Wait for the progress dialog to be closed or canceled, while regularly
41 rendering to allow for pointer movement or progress to be shown. Used when showing
42 the progress of a process that is taking place on a separate thread and may be
43 reporting progress infrequently.
44 \param progresstime the time in ms to wait between rendering the dialog (defaults to 10ms)
45 \return true if the dialog is closed, false if the user cancels early.
47 bool Wait(int progresstime = 10);
49 /*! \brief Wait on an event or for the progress dialog to be canceled, while
50 regularly rendering to allow for pointer movement or progress to be shown.
51 \param event the CEvent to wait on.
52 \return true if the event completed, false if cancelled.
54 bool WaitOnEvent(CEvent& event);
56 // Implements IProgressCallback
57 void SetProgressMax(int iMax) override;
58 void SetProgressAdvance(int nSteps=1) override;
59 bool Abort() override;
61 void SetCanCancel(bool bCanCancel);
63 protected:
64 void OnInitWindow() override;
65 int GetDefaultLabelID(int controlId) const override;
66 void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) override;
68 bool m_bCanCancel;
70 int m_iCurrent;
71 int m_iMax;
72 int m_percentage;
73 bool m_showProgress;
75 std::array<bool, DIALOG_MAX_CHOICES> m_supportedChoices = {};
76 int m_iChoice = CHOICE_NONE;
78 private:
79 void UpdateControls();