diff options
| author | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
| commit | be933ef2241d79558f91796cc5b3a161f72ebf9c (patch) | |
| tree | fe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h | |
| parent | 5f8335c1e49ce108ef3481863833c98efa00411b (diff) | |
| download | kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2 kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip | |
sync with upstream
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h | 255 |
1 files changed, 0 insertions, 255 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h deleted file mode 100644 index b1f8cc5..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Progress.h +++ /dev/null | |||
| @@ -1,255 +0,0 @@ | |||
| 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 "../definitions.h" | ||
| 12 | #include "../../AddonBase.h" | ||
| 13 | |||
| 14 | namespace kodi | ||
| 15 | { | ||
| 16 | namespace gui | ||
| 17 | { | ||
| 18 | namespace dialogs | ||
| 19 | { | ||
| 20 | |||
| 21 | //============================================================================ | ||
| 22 | /// | ||
| 23 | /// \defgroup cpp_kodi_gui_dialogs_CProgress Dialog Progress | ||
| 24 | /// \ingroup cpp_kodi_gui | ||
| 25 | /// @brief \cpp_class{ kodi::gui::dialogs::CProgress } | ||
| 26 | /// **Progress dialog shown in center** | ||
| 27 | /// | ||
| 28 | /// The with \ref DialogProgress.h "#include <kodi/gui/dialogs/Progress.h>" | ||
| 29 | /// given class are basically used to create Kodi's progress dialog with named | ||
| 30 | /// text fields. | ||
| 31 | /// | ||
| 32 | /// **Example:** | ||
| 33 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 34 | /// #include <kodi/gui/dialogs/Progress.h> | ||
| 35 | /// | ||
| 36 | /// kodi::gui::dialogs::CProgress *progress = new kodi::gui::dialogs::CProgress; | ||
| 37 | /// progress->SetHeading("Test progress"); | ||
| 38 | /// progress->SetLine(1, "line 1"); | ||
| 39 | /// progress->SetLine(2, "line 2"); | ||
| 40 | /// progress->SetLine(3, "line 3"); | ||
| 41 | /// progress->SetCanCancel(true); | ||
| 42 | /// progress->ShowProgressBar(true); | ||
| 43 | /// progress->Open(); | ||
| 44 | /// for (unsigned int i = 0; i < 100; i += 10) | ||
| 45 | /// { | ||
| 46 | /// progress->SetPercentage(i); | ||
| 47 | /// sleep(1); | ||
| 48 | /// } | ||
| 49 | /// delete progress; | ||
| 50 | /// ~~~~~~~~~~~~~ | ||
| 51 | /// | ||
| 52 | class ATTRIBUTE_HIDDEN CProgress | ||
| 53 | { | ||
| 54 | public: | ||
| 55 | //========================================================================== | ||
| 56 | /// | ||
| 57 | /// \ingroup cpp_kodi_gui_dialogs_CProgress | ||
| 58 | /// @brief Construct a new dialog | ||
| 59 | /// | ||
| 60 | CProgress() | ||
| 61 | { | ||
| 62 | using namespace ::kodi::addon; | ||
| 63 | m_DialogHandle = CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->new_dialog( | ||
| 64 | CAddonBase::m_interface->toKodi->kodiBase); | ||
| 65 | if (!m_DialogHandle) | ||
| 66 | kodi::Log(ADDON_LOG_FATAL, | ||
| 67 | "kodi::gui::dialogs::CProgress can't create window class from Kodi !!!"); | ||
| 68 | } | ||
| 69 | //-------------------------------------------------------------------------- | ||
| 70 | |||
| 71 | //========================================================================== | ||
| 72 | /// | ||
| 73 | /// \ingroup cpp_kodi_gui_dialogs_CProgress | ||
| 74 | /// @brief Destructor | ||
| 75 | /// | ||
| 76 | ~CProgress() | ||
| 77 | { | ||
| 78 | using namespace ::kodi::addon; | ||
| 79 | if (m_DialogHandle) | ||
| 80 | CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->delete_dialog( | ||
| 81 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); | ||
| 82 | } | ||
| 83 | //-------------------------------------------------------------------------- | ||
| 84 | |||
| 85 | //========================================================================== | ||
| 86 | /// | ||
| 87 | /// \ingroup cpp_kodi_gui_dialogs_CProgress | ||
| 88 | /// @brief To open the dialog | ||
| 89 | /// | ||
| 90 | void Open() | ||
| 91 | { | ||
| 92 | using namespace ::kodi::addon; | ||
| 93 | CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->open( | ||
| 94 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); | ||
| 95 | } | ||
| 96 | //-------------------------------------------------------------------------- | ||
| 97 | |||
| 98 | //========================================================================== | ||
| 99 | /// | ||
| 100 | /// \ingroup cpp_kodi_gui_dialogs_CProgress | ||
| 101 | /// @brief Set the heading title of dialog | ||
| 102 | /// | ||
| 103 | /// @param[in] heading Title string to use | ||
| 104 | /// | ||
| 105 | void SetHeading(const std::string& heading) | ||
| 106 | { | ||
| 107 | using namespace ::kodi::addon; | ||
| 108 | CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_heading( | ||
| 109 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, heading.c_str()); | ||
| 110 | } | ||
| 111 | //-------------------------------------------------------------------------- | ||
| 112 | |||
| 113 | //========================================================================== | ||
| 114 | /// | ||
| 115 | /// \ingroup cpp_kodi_gui_dialogs_CProgress | ||
| 116 | /// @brief To set the line text field on dialog from 0 - 2 | ||
| 117 | /// | ||
| 118 | /// @param[in] iLine Line number | ||
| 119 | /// @param[in] line Text string | ||
| 120 | /// | ||
| 121 | void SetLine(unsigned int iLine, const std::string& line) | ||
| 122 | { | ||
| 123 | using namespace ::kodi::addon; | ||
| 124 | CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_line( | ||
| 125 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, iLine, line.c_str()); | ||
| 126 | } | ||
| 127 | //-------------------------------------------------------------------------- | ||
| 128 | |||
| 129 | //========================================================================== | ||
| 130 | /// | ||
| 131 | /// \ingroup cpp_kodi_gui_dialogs_CProgress | ||
| 132 | /// @brief To enable and show cancel button on dialog | ||
| 133 | /// | ||
| 134 | /// @param[in] canCancel if true becomes it shown | ||
| 135 | /// | ||
| 136 | void SetCanCancel(bool canCancel) | ||
| 137 | { | ||
| 138 | using namespace ::kodi::addon; | ||
| 139 | CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_can_cancel( | ||
| 140 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, canCancel); | ||
| 141 | } | ||
| 142 | //-------------------------------------------------------------------------- | ||
| 143 | |||
| 144 | //========================================================================== | ||
| 145 | /// | ||
| 146 | /// \ingroup cpp_kodi_gui_dialogs_CProgress | ||
| 147 | /// @brief To check dialog for clicked cancel button | ||
| 148 | /// | ||
| 149 | /// @return True if canceled | ||
| 150 | /// | ||
| 151 | bool IsCanceled() const | ||
| 152 | { | ||
| 153 | using namespace ::kodi::addon; | ||
| 154 | return CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->is_canceled( | ||
| 155 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); | ||
| 156 | } | ||
| 157 | //-------------------------------------------------------------------------- | ||
| 158 | |||
| 159 | //========================================================================== | ||
| 160 | /// | ||
| 161 | /// \ingroup cpp_kodi_gui_dialogs_CProgress | ||
| 162 | /// @brief Get the current progress position as percent | ||
| 163 | /// | ||
| 164 | /// @param[in] percentage Position to use from 0 to 100 | ||
| 165 | /// | ||
| 166 | void SetPercentage(int percentage) | ||
| 167 | { | ||
| 168 | using namespace ::kodi::addon; | ||
| 169 | CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_percentage( | ||
| 170 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, percentage); | ||
| 171 | } | ||
| 172 | //-------------------------------------------------------------------------- | ||
| 173 | |||
| 174 | //========================================================================== | ||
| 175 | /// | ||
| 176 | /// \ingroup cpp_kodi_gui_dialogs_CProgress | ||
| 177 | /// @brief To set the current progress position as percent | ||
| 178 | /// | ||
| 179 | /// @return Current Position used from 0 to 100 | ||
| 180 | /// | ||
| 181 | int GetPercentage() const | ||
| 182 | { | ||
| 183 | using namespace ::kodi::addon; | ||
| 184 | return CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->get_percentage( | ||
| 185 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); | ||
| 186 | } | ||
| 187 | //-------------------------------------------------------------------------- | ||
| 188 | |||
| 189 | //========================================================================== | ||
| 190 | /// | ||
| 191 | /// \ingroup cpp_kodi_gui_dialogs_CProgress | ||
| 192 | /// @brief To show or hide progress bar dialog | ||
| 193 | /// | ||
| 194 | /// @param[in] onOff If true becomes it shown | ||
| 195 | /// | ||
| 196 | void ShowProgressBar(bool onOff) | ||
| 197 | { | ||
| 198 | using namespace ::kodi::addon; | ||
| 199 | CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->show_progress_bar( | ||
| 200 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, onOff); | ||
| 201 | } | ||
| 202 | //-------------------------------------------------------------------------- | ||
| 203 | |||
| 204 | //========================================================================== | ||
| 205 | /// | ||
| 206 | /// \ingroup cpp_kodi_gui_dialogs_CProgress | ||
| 207 | /// @brief Set the maximum position of progress, needed if `SetProgressAdvance(...)` is used | ||
| 208 | /// | ||
| 209 | /// @param[in] max Biggest usable position to use | ||
| 210 | /// | ||
| 211 | void SetProgressMax(int max) | ||
| 212 | { | ||
| 213 | using namespace ::kodi::addon; | ||
| 214 | CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_progress_max( | ||
| 215 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, max); | ||
| 216 | } | ||
| 217 | //-------------------------------------------------------------------------- | ||
| 218 | |||
| 219 | //========================================================================== | ||
| 220 | /// | ||
| 221 | /// \ingroup cpp_kodi_gui_dialogs_CProgress | ||
| 222 | /// @brief To increase progress bar by defined step size until reach of maximum position | ||
| 223 | /// | ||
| 224 | /// @param[in] steps Step size to increase, default is 1 | ||
| 225 | /// | ||
| 226 | void SetProgressAdvance(int steps = 1) | ||
| 227 | { | ||
| 228 | using namespace ::kodi::addon; | ||
| 229 | CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->set_progress_advance( | ||
| 230 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, steps); | ||
| 231 | } | ||
| 232 | //-------------------------------------------------------------------------- | ||
| 233 | |||
| 234 | //========================================================================== | ||
| 235 | /// | ||
| 236 | /// \ingroup cpp_kodi_gui_dialogs_CProgress | ||
| 237 | /// @brief To check progress was canceled on work | ||
| 238 | /// | ||
| 239 | /// @return True if aborted | ||
| 240 | /// | ||
| 241 | bool Abort() | ||
| 242 | { | ||
| 243 | using namespace ::kodi::addon; | ||
| 244 | return CAddonBase::m_interface->toKodi->kodi_gui->dialogProgress->abort( | ||
| 245 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); | ||
| 246 | } | ||
| 247 | //-------------------------------------------------------------------------- | ||
| 248 | |||
| 249 | private: | ||
| 250 | void* m_DialogHandle; | ||
| 251 | }; | ||
| 252 | |||
| 253 | } /* namespace dialogs */ | ||
| 254 | } /* namespace gui */ | ||
| 255 | } /* namespace kodi */ | ||
