diff options
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h | 250 |
1 files changed, 0 insertions, 250 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h deleted file mode 100644 index 5a49b70..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ExtendedProgress.h +++ /dev/null | |||
| @@ -1,250 +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_CExtendedProgress Dialog Extended Progress | ||
| 24 | /// \ingroup cpp_kodi_gui | ||
| 25 | /// @brief \cpp_class{ kodi::gui::dialogs::ExtendedProgress } | ||
| 26 | /// **Progress dialog shown for background work** | ||
| 27 | /// | ||
| 28 | /// The with \ref ExtendedProgress.h "#include <kodi/gui/dialogs/ExtendedProgress.h>" | ||
| 29 | /// given class are basically used to create Kodi's extended progress. | ||
| 30 | /// | ||
| 31 | /// | ||
| 32 | /// -------------------------------------------------------------------------- | ||
| 33 | /// | ||
| 34 | /// **Example:** | ||
| 35 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 36 | /// #include <kodi/gui/dialogs/ExtendedProgress.h> | ||
| 37 | /// | ||
| 38 | /// kodi::gui::dialogs::CExtendedProgress *ext_progress = new kodi::gui::dialogs::CExtendedProgress("Test Extended progress"); | ||
| 39 | /// ext_progress->SetText("Test progress"); | ||
| 40 | /// for (unsigned int i = 0; i < 50; i += 10) | ||
| 41 | /// { | ||
| 42 | /// ext_progress->SetProgress(i, 100); | ||
| 43 | /// sleep(1); | ||
| 44 | /// } | ||
| 45 | /// | ||
| 46 | /// ext_progress->SetTitle("Test Extended progress - Second round"); | ||
| 47 | /// ext_progress->SetText("Test progress - Step 2"); | ||
| 48 | /// | ||
| 49 | /// for (unsigned int i = 50; i < 100; i += 10) | ||
| 50 | /// { | ||
| 51 | /// ext_progress->SetProgress(i, 100); | ||
| 52 | /// sleep(1); | ||
| 53 | /// } | ||
| 54 | /// delete ext_progress; | ||
| 55 | /// ~~~~~~~~~~~~~ | ||
| 56 | /// | ||
| 57 | class ATTRIBUTE_HIDDEN CExtendedProgress | ||
| 58 | { | ||
| 59 | public: | ||
| 60 | //========================================================================== | ||
| 61 | /// | ||
| 62 | /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress | ||
| 63 | /// Construct a new dialog | ||
| 64 | /// | ||
| 65 | /// @param[in] title Title string | ||
| 66 | /// | ||
| 67 | explicit CExtendedProgress(const std::string& title = "") | ||
| 68 | { | ||
| 69 | using namespace ::kodi::addon; | ||
| 70 | m_DialogHandle = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->new_dialog( | ||
| 71 | CAddonBase::m_interface->toKodi->kodiBase, title.c_str()); | ||
| 72 | if (!m_DialogHandle) | ||
| 73 | kodi::Log(ADDON_LOG_FATAL, | ||
| 74 | "kodi::gui::CDialogExtendedProgress can't create window class from Kodi !!!"); | ||
| 75 | } | ||
| 76 | //-------------------------------------------------------------------------- | ||
| 77 | |||
| 78 | //========================================================================== | ||
| 79 | /// | ||
| 80 | /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress | ||
| 81 | /// Destructor | ||
| 82 | /// | ||
| 83 | ~CExtendedProgress() | ||
| 84 | { | ||
| 85 | using namespace ::kodi::addon; | ||
| 86 | if (m_DialogHandle) | ||
| 87 | CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->delete_dialog( | ||
| 88 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); | ||
| 89 | } | ||
| 90 | //-------------------------------------------------------------------------- | ||
| 91 | |||
| 92 | //========================================================================== | ||
| 93 | /// | ||
| 94 | /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress | ||
| 95 | /// @brief Get the used title | ||
| 96 | /// | ||
| 97 | /// @return Title string | ||
| 98 | /// | ||
| 99 | std::string Title() const | ||
| 100 | { | ||
| 101 | using namespace ::kodi::addon; | ||
| 102 | std::string text; | ||
| 103 | char* strMsg = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->get_title( | ||
| 104 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); | ||
| 105 | if (strMsg != nullptr) | ||
| 106 | { | ||
| 107 | if (std::strlen(strMsg)) | ||
| 108 | text = strMsg; | ||
| 109 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 110 | strMsg); | ||
| 111 | } | ||
| 112 | return text; | ||
| 113 | } | ||
| 114 | //-------------------------------------------------------------------------- | ||
| 115 | |||
| 116 | //========================================================================== | ||
| 117 | /// | ||
| 118 | /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress | ||
| 119 | /// @brief To set the title of dialog | ||
| 120 | /// | ||
| 121 | /// @param[in] title Title string | ||
| 122 | /// | ||
| 123 | void SetTitle(const std::string& title) | ||
| 124 | { | ||
| 125 | using namespace ::kodi::addon; | ||
| 126 | CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_title( | ||
| 127 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, title.c_str()); | ||
| 128 | } | ||
| 129 | //-------------------------------------------------------------------------- | ||
| 130 | |||
| 131 | //========================================================================== | ||
| 132 | /// | ||
| 133 | /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress | ||
| 134 | /// @brief Get the used text information string | ||
| 135 | /// | ||
| 136 | /// @return Text string | ||
| 137 | /// | ||
| 138 | std::string Text() const | ||
| 139 | { | ||
| 140 | using namespace ::kodi::addon; | ||
| 141 | std::string text; | ||
| 142 | char* strMsg = CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->get_text( | ||
| 143 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); | ||
| 144 | if (strMsg != nullptr) | ||
| 145 | { | ||
| 146 | if (std::strlen(strMsg)) | ||
| 147 | text = strMsg; | ||
| 148 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 149 | strMsg); | ||
| 150 | } | ||
| 151 | return text; | ||
| 152 | } | ||
| 153 | //-------------------------------------------------------------------------- | ||
| 154 | |||
| 155 | //========================================================================== | ||
| 156 | /// | ||
| 157 | /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress | ||
| 158 | /// @brief To set the used text information string | ||
| 159 | /// | ||
| 160 | /// @param[in] text information text to set | ||
| 161 | /// | ||
| 162 | void SetText(const std::string& text) | ||
| 163 | { | ||
| 164 | using namespace ::kodi::addon; | ||
| 165 | CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_text( | ||
| 166 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, text.c_str()); | ||
| 167 | } | ||
| 168 | //-------------------------------------------------------------------------- | ||
| 169 | |||
| 170 | //========================================================================== | ||
| 171 | /// | ||
| 172 | /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress | ||
| 173 | /// @brief To ask dialog is finished | ||
| 174 | /// | ||
| 175 | /// @return True if on end | ||
| 176 | /// | ||
| 177 | bool IsFinished() const | ||
| 178 | { | ||
| 179 | using namespace ::kodi::addon; | ||
| 180 | return CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->is_finished( | ||
| 181 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); | ||
| 182 | } | ||
| 183 | //-------------------------------------------------------------------------- | ||
| 184 | |||
| 185 | //========================================================================== | ||
| 186 | /// | ||
| 187 | /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress | ||
| 188 | /// @brief Mark progress finished | ||
| 189 | /// | ||
| 190 | void MarkFinished() | ||
| 191 | { | ||
| 192 | using namespace ::kodi::addon; | ||
| 193 | CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->mark_finished( | ||
| 194 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); | ||
| 195 | } | ||
| 196 | //-------------------------------------------------------------------------- | ||
| 197 | |||
| 198 | //========================================================================== | ||
| 199 | /// | ||
| 200 | /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress | ||
| 201 | /// @brief Get the current progress position as percent | ||
| 202 | /// | ||
| 203 | /// @return Position | ||
| 204 | /// | ||
| 205 | float Percentage() const | ||
| 206 | { | ||
| 207 | using namespace ::kodi::addon; | ||
| 208 | return CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->get_percentage( | ||
| 209 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle); | ||
| 210 | } | ||
| 211 | //-------------------------------------------------------------------------- | ||
| 212 | |||
| 213 | //========================================================================== | ||
| 214 | /// | ||
| 215 | /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress | ||
| 216 | /// @brief To set the current progress position as percent | ||
| 217 | /// | ||
| 218 | /// @param[in] percentage Position to use from 0.0 to 100.0 | ||
| 219 | /// | ||
| 220 | void SetPercentage(float percentage) | ||
| 221 | { | ||
| 222 | using namespace ::kodi::addon; | ||
| 223 | CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_percentage( | ||
| 224 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, percentage); | ||
| 225 | } | ||
| 226 | //-------------------------------------------------------------------------- | ||
| 227 | |||
| 228 | //========================================================================== | ||
| 229 | /// | ||
| 230 | /// \ingroup cpp_kodi_gui_dialogs_CExtendedProgress | ||
| 231 | /// @brief To set progress position with predefined places | ||
| 232 | /// | ||
| 233 | /// @param[in] currentItem Place position to use | ||
| 234 | /// @param[in] itemCount Amount of used places | ||
| 235 | /// | ||
| 236 | void SetProgress(int currentItem, int itemCount) | ||
| 237 | { | ||
| 238 | using namespace ::kodi::addon; | ||
| 239 | CAddonBase::m_interface->toKodi->kodi_gui->dialogExtendedProgress->set_progress( | ||
| 240 | CAddonBase::m_interface->toKodi->kodiBase, m_DialogHandle, currentItem, itemCount); | ||
| 241 | } | ||
| 242 | //-------------------------------------------------------------------------- | ||
| 243 | |||
| 244 | private: | ||
| 245 | void* m_DialogHandle; | ||
| 246 | }; | ||
| 247 | |||
| 248 | } /* namespace dialogs */ | ||
| 249 | } /* namespace gui */ | ||
| 250 | } /* namespace kodi */ | ||
