diff options
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs')
11 files changed, 0 insertions, 2462 deletions
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/CMakeLists.txt b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/CMakeLists.txt deleted file mode 100644 index 7227343..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/CMakeLists.txt +++ /dev/null | |||
| @@ -1,14 +0,0 @@ | |||
| 1 | set(HEADERS ContextMenu.h | ||
| 2 | ExtendedProgress.h | ||
| 3 | FileBrowser.h | ||
| 4 | Keyboard.h | ||
| 5 | Numeric.h | ||
| 6 | OK.h | ||
| 7 | Progress.h | ||
| 8 | Select.h | ||
| 9 | TextViewer.h | ||
| 10 | YesNo.h) | ||
| 11 | |||
| 12 | if(NOT ENABLE_STATIC_LIBS) | ||
| 13 | core_add_library(addons_kodi-addon-dev-kit_include_kodi_gui_dialogs) | ||
| 14 | endif() | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ContextMenu.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ContextMenu.h deleted file mode 100644 index d545030..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/ContextMenu.h +++ /dev/null | |||
| @@ -1,185 +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_ContextMenu Dialog Context Menu | ||
| 24 | /// \ingroup cpp_kodi_gui | ||
| 25 | /// @brief \cpp_namespace{ kodi::gui::dialogs::ContextMenu } | ||
| 26 | /// **Context menu dialog** | ||
| 27 | /// | ||
| 28 | /// The function listed below permits the call of a dialogue as context menu to | ||
| 29 | /// select of an entry as a key | ||
| 30 | /// | ||
| 31 | /// It has the header \ref ContextMenu.h "#include <kodi/gui/dialogs/ContextMenu.h>" | ||
| 32 | /// be included to enjoy it. | ||
| 33 | /// | ||
| 34 | /// | ||
| 35 | namespace ContextMenu | ||
| 36 | { | ||
| 37 | //========================================================================== | ||
| 38 | /// | ||
| 39 | /// \ingroup cpp_kodi_gui_dialogs_ContextMenu | ||
| 40 | /// @brief Show a context menu dialog about given parts. | ||
| 41 | /// | ||
| 42 | /// @param[in] heading Dialog heading name | ||
| 43 | /// @param[in] entries String list about entries | ||
| 44 | /// @return The selected entry, if return <tt>-1</tt> was nothing selected or canceled | ||
| 45 | /// | ||
| 46 | /// | ||
| 47 | ///------------------------------------------------------------------------- | ||
| 48 | /// | ||
| 49 | /// **Example:** | ||
| 50 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 51 | /// #include <kodi/gui/dialogs/ContextMenu.h> | ||
| 52 | /// | ||
| 53 | /// const std::vector<std::string> entries | ||
| 54 | /// { | ||
| 55 | /// "Test 1", | ||
| 56 | /// "Test 2", | ||
| 57 | /// "Test 3", | ||
| 58 | /// "Test 4", | ||
| 59 | /// "Test 5" | ||
| 60 | /// }; | ||
| 61 | /// | ||
| 62 | /// int selected = kodi::gui::dialogs::ContextMenu::Show("Test selection", entries); | ||
| 63 | /// if (selected < 0) | ||
| 64 | /// fprintf(stderr, "Item selection canceled\n"); | ||
| 65 | /// else | ||
| 66 | /// fprintf(stderr, "Selected item is: %i\n", selected); | ||
| 67 | /// ~~~~~~~~~~~~~ | ||
| 68 | /// | ||
| 69 | inline int ATTRIBUTE_HIDDEN Show(const std::string& heading, | ||
| 70 | const std::vector<std::string>& entries) | ||
| 71 | { | ||
| 72 | using namespace ::kodi::addon; | ||
| 73 | unsigned int size = static_cast<unsigned int>(entries.size()); | ||
| 74 | const char** cEntries = static_cast<const char**>(malloc(size * sizeof(const char**))); | ||
| 75 | for (unsigned int i = 0; i < size; ++i) | ||
| 76 | { | ||
| 77 | cEntries[i] = entries[i].c_str(); | ||
| 78 | } | ||
| 79 | int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogContextMenu->open( | ||
| 80 | CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size); | ||
| 81 | free(cEntries); | ||
| 82 | return ret; | ||
| 83 | } | ||
| 84 | //-------------------------------------------------------------------------- | ||
| 85 | |||
| 86 | //========================================================================== | ||
| 87 | /// | ||
| 88 | /// \ingroup cpp_kodi_gui_dialogs_ContextMenu | ||
| 89 | /// @brief Show a context menu dialog about given parts. | ||
| 90 | /// | ||
| 91 | /// @param[in] heading Dialog heading name | ||
| 92 | /// @param[in] entries String list about entries | ||
| 93 | /// @return The selected entry, if return <tt>-1</tt> was nothing selected or canceled | ||
| 94 | /// | ||
| 95 | /// | ||
| 96 | ///------------------------------------------------------------------------- | ||
| 97 | /// | ||
| 98 | /// **Example:** | ||
| 99 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 100 | /// #include <kodi/gui/dialogs/ContextMenu.h> | ||
| 101 | /// | ||
| 102 | /// const std::vector<std::pair<std::string, std::string>> entries | ||
| 103 | /// { | ||
| 104 | /// { "ID 1", "Test 1" }, | ||
| 105 | /// { "ID 2", "Test 2" }, | ||
| 106 | /// { "ID 3", "Test 3" }, | ||
| 107 | /// { "ID 4", "Test 4" }, | ||
| 108 | /// { "ID 5", "Test 5" } | ||
| 109 | /// }; | ||
| 110 | /// | ||
| 111 | /// int selected = kodi::gui::dialogs::ContextMenu::Show("Test selection", entries); | ||
| 112 | /// if (selected < 0) | ||
| 113 | /// fprintf(stderr, "Item selection canceled\n"); | ||
| 114 | /// else | ||
| 115 | /// fprintf(stderr, "Selected item is: %i\n", selected); | ||
| 116 | /// ~~~~~~~~~~~~~ | ||
| 117 | /// | ||
| 118 | inline int ATTRIBUTE_HIDDEN Show( | ||
| 119 | const std::string& heading, const std::vector<std::pair<std::string, std::string>>& entries) | ||
| 120 | { | ||
| 121 | using namespace ::kodi::addon; | ||
| 122 | unsigned int size = static_cast<unsigned int>(entries.size()); | ||
| 123 | const char** cEntries = static_cast<const char**>(malloc(size*sizeof(const char**))); | ||
| 124 | for (unsigned int i = 0; i < size; ++i) | ||
| 125 | { | ||
| 126 | cEntries[i] = entries[i].second.c_str(); | ||
| 127 | } | ||
| 128 | int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogContextMenu->open(CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size); | ||
| 129 | free(cEntries); | ||
| 130 | return ret; | ||
| 131 | } | ||
| 132 | //-------------------------------------------------------------------------- | ||
| 133 | |||
| 134 | //========================================================================== | ||
| 135 | /// | ||
| 136 | /// \ingroup cpp_kodi_gui_dialogs_ContextMenu | ||
| 137 | /// @brief Show a context menu dialog about given parts. | ||
| 138 | /// | ||
| 139 | /// @param[in] heading Dialog heading name | ||
| 140 | /// @param[in] entries String list about entries | ||
| 141 | /// @return The selected entry, if return <tt>-1</tt> was nothing selected or canceled | ||
| 142 | /// | ||
| 143 | /// | ||
| 144 | ///------------------------------------------------------------------------- | ||
| 145 | /// | ||
| 146 | /// **Example:** | ||
| 147 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 148 | /// #include <kodi/gui/dialogs/ContextMenu.h> | ||
| 149 | /// | ||
| 150 | /// const std::vector<std::pair<int, std::string>> entries | ||
| 151 | /// { | ||
| 152 | /// { 1, "Test 1" }, | ||
| 153 | /// { 2, "Test 2" }, | ||
| 154 | /// { 3, "Test 3" }, | ||
| 155 | /// { 4, "Test 4" }, | ||
| 156 | /// { 5, "Test 5" } | ||
| 157 | /// }; | ||
| 158 | /// | ||
| 159 | /// int selected = kodi::gui::dialogs::ContextMenu::Show("Test selection", entries); | ||
| 160 | /// if (selected < 0) | ||
| 161 | /// fprintf(stderr, "Item selection canceled\n"); | ||
| 162 | /// else | ||
| 163 | /// fprintf(stderr, "Selected item is: %i\n", selected); | ||
| 164 | /// ~~~~~~~~~~~~~ | ||
| 165 | /// | ||
| 166 | inline int ATTRIBUTE_HIDDEN Show(const std::string& heading, | ||
| 167 | const std::vector<std::pair<int, std::string>>& entries) | ||
| 168 | { | ||
| 169 | using namespace ::kodi::addon; | ||
| 170 | unsigned int size = static_cast<unsigned int>(entries.size()); | ||
| 171 | const char** cEntries = static_cast<const char**>(malloc(size*sizeof(const char**))); | ||
| 172 | for (unsigned int i = 0; i < size; ++i) | ||
| 173 | { | ||
| 174 | cEntries[i] = entries[i].second.c_str(); | ||
| 175 | } | ||
| 176 | int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogContextMenu->open(CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size); | ||
| 177 | free(cEntries); | ||
| 178 | return ret; | ||
| 179 | } | ||
| 180 | //-------------------------------------------------------------------------- | ||
| 181 | }; | ||
| 182 | |||
| 183 | } /* namespace dialogs */ | ||
| 184 | } /* namespace gui */ | ||
| 185 | } /* namespace kodi */ | ||
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 */ | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h deleted file mode 100644 index 90da063..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h +++ /dev/null | |||
| @@ -1,310 +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_FileBrowser Dialog File Browser | ||
| 24 | /// \ingroup cpp_kodi_gui | ||
| 25 | /// @brief \cpp_namespace{ kodi::gui::dialogs::FileBrowser } | ||
| 26 | /// **File browser dialog** | ||
| 27 | /// | ||
| 28 | /// The functions listed below of the class "FileBrowser" offer | ||
| 29 | /// the possibility to select to a file by the user of the add-on. | ||
| 30 | /// | ||
| 31 | /// It allows all the options that are possible in Kodi itself and offers all | ||
| 32 | /// support file types. | ||
| 33 | /// | ||
| 34 | /// It has the header \ref FileBrowser.h "#include <kodi/gui/dialogs/FileBrowser.h>" | ||
| 35 | /// be included to enjoy it. | ||
| 36 | /// | ||
| 37 | namespace FileBrowser | ||
| 38 | { | ||
| 39 | //========================================================================== | ||
| 40 | /// | ||
| 41 | /// \ingroup cpp_kodi_gui_dialogs_FileBrowser | ||
| 42 | /// @brief Directory selection dialog | ||
| 43 | /// | ||
| 44 | /// @param[in] shares With Shares becomes the available start folders | ||
| 45 | /// be set. | ||
| 46 | /// @param[in] heading Dialog header name | ||
| 47 | /// @param[in,out] path As in the path to start and return value about | ||
| 48 | /// selected directory | ||
| 49 | /// @param[in] writeOnly If set only writeable folders are shown. | ||
| 50 | /// @return False if selection becomes canceled. | ||
| 51 | /// | ||
| 52 | /// **Example:** | ||
| 53 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 54 | /// #include <kodi/gui/dialogs/FileBrowser.h> | ||
| 55 | /// | ||
| 56 | /// /* | ||
| 57 | /// * Example show directory selection dialog with on 'share' (first value) | ||
| 58 | /// * defined directory types. | ||
| 59 | /// * | ||
| 60 | /// * If this becomes leaved empty and 'directory' is empty goes it to the | ||
| 61 | /// * base path of the hard disk. | ||
| 62 | /// * | ||
| 63 | /// * Also can be with path written to 'directory' before the dialog forced | ||
| 64 | /// * to a start place. | ||
| 65 | /// */ | ||
| 66 | /// std::string directory; | ||
| 67 | /// bool ret = kodi::gui::dialogs::FileBrowser::ShowAndGetDirectory("local|network|removable", | ||
| 68 | /// "Test directory selection", | ||
| 69 | /// directory, | ||
| 70 | /// false); | ||
| 71 | /// fprintf(stderr, "Selected directory is : %s and was %s\n", directory.c_str(), ret ? "OK" : "Canceled"); | ||
| 72 | /// ~~~~~~~~~~~~~ | ||
| 73 | /// | ||
| 74 | inline bool ATTRIBUTE_HIDDEN ShowAndGetDirectory(const std::string& shares, | ||
| 75 | const std::string& heading, | ||
| 76 | std::string& path, | ||
| 77 | bool writeOnly = false) | ||
| 78 | { | ||
| 79 | using namespace ::kodi::addon; | ||
| 80 | char* retString = nullptr; | ||
| 81 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_directory( | ||
| 82 | CAddonBase::m_interface->toKodi->kodiBase, shares.c_str(), heading.c_str(), path.c_str(), | ||
| 83 | &retString, writeOnly); | ||
| 84 | if (retString != nullptr) | ||
| 85 | { | ||
| 86 | if (std::strlen(retString)) | ||
| 87 | path = retString; | ||
| 88 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 89 | retString); | ||
| 90 | } | ||
| 91 | return ret; | ||
| 92 | } | ||
| 93 | //-------------------------------------------------------------------------- | ||
| 94 | |||
| 95 | //========================================================================== | ||
| 96 | /// | ||
| 97 | /// \ingroup cpp_kodi_gui_dialogs_FileBrowser | ||
| 98 | /// @brief File selection dialog | ||
| 99 | /// | ||
| 100 | /// @param[in] shares With Shares becomes the available start | ||
| 101 | /// folders be set. | ||
| 102 | /// @param[in] mask The mask to filter visible files, e.g. | ||
| 103 | /// ".m3u|.pls|.b4s|.wpl". | ||
| 104 | /// @param[in] heading Dialog header name | ||
| 105 | /// @param[in,out] path As in the path to start and Return value | ||
| 106 | /// about selected file | ||
| 107 | /// @param[in] useThumbs If set show thumbs if possible on dialog. | ||
| 108 | /// @param[in] useFileDirectories If set also packages (e.g. *.zip) are | ||
| 109 | /// handled as directories. | ||
| 110 | /// @return False if selection becomes canceled. | ||
| 111 | /// | ||
| 112 | inline bool ATTRIBUTE_HIDDEN ShowAndGetFile(const std::string& shares, | ||
| 113 | const std::string& mask, | ||
| 114 | const std::string& heading, | ||
| 115 | std::string& path, | ||
| 116 | bool useThumbs = false, | ||
| 117 | bool useFileDirectories = false) | ||
| 118 | { | ||
| 119 | using namespace ::kodi::addon; | ||
| 120 | char* retString = nullptr; | ||
| 121 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_file(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 122 | shares.c_str(), mask.c_str(), heading.c_str(), path.c_str(), &retString, | ||
| 123 | useThumbs, useFileDirectories); | ||
| 124 | if (retString != nullptr) | ||
| 125 | { | ||
| 126 | if (std::strlen(retString)) | ||
| 127 | path = retString; | ||
| 128 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); | ||
| 129 | } | ||
| 130 | return ret; | ||
| 131 | } | ||
| 132 | //-------------------------------------------------------------------------- | ||
| 133 | |||
| 134 | //========================================================================== | ||
| 135 | /// | ||
| 136 | /// \ingroup cpp_kodi_gui_dialogs_FileBrowser | ||
| 137 | /// @brief File selection from a directory | ||
| 138 | /// | ||
| 139 | /// @param[in] directory The directory name where the dialog | ||
| 140 | /// start, possible are normal names and | ||
| 141 | /// kodi's special names. | ||
| 142 | /// @param[in] mask The mask to filter visible files, e.g. | ||
| 143 | /// ".m3u|.pls|.b4s|.wpl". | ||
| 144 | /// @param[in] heading Dialog header name | ||
| 145 | /// @param[in,out] path As in the path to start and Return value | ||
| 146 | /// about selected file | ||
| 147 | /// @param[in] useThumbs If set show thumbs if possible on dialog. | ||
| 148 | /// @param[in] useFileDirectories If set also packages (e.g. *.zip) are | ||
| 149 | /// handled as directories. | ||
| 150 | /// @param[in] singleList | ||
| 151 | /// @return False if selection becomes canceled. | ||
| 152 | /// | ||
| 153 | inline bool ATTRIBUTE_HIDDEN ShowAndGetFileFromDir(const std::string& directory, | ||
| 154 | const std::string& mask, | ||
| 155 | const std::string& heading, | ||
| 156 | std::string& path, | ||
| 157 | bool useThumbs = false, | ||
| 158 | bool useFileDirectories = false, | ||
| 159 | bool singleList = false) | ||
| 160 | { | ||
| 161 | using namespace ::kodi::addon; | ||
| 162 | char* retString = nullptr; | ||
| 163 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_file_from_dir(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 164 | directory.c_str(), mask.c_str(), heading.c_str(), | ||
| 165 | path.c_str(), &retString, useThumbs, | ||
| 166 | useFileDirectories, singleList); | ||
| 167 | if (retString != nullptr) | ||
| 168 | { | ||
| 169 | if (std::strlen(retString)) | ||
| 170 | path = retString; | ||
| 171 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); | ||
| 172 | } | ||
| 173 | return ret; | ||
| 174 | } | ||
| 175 | //-------------------------------------------------------------------------- | ||
| 176 | |||
| 177 | //========================================================================== | ||
| 178 | /// | ||
| 179 | /// \ingroup cpp_kodi_gui_dialogs_FileBrowser | ||
| 180 | /// @brief File selection dialog to get several in to a list | ||
| 181 | /// | ||
| 182 | /// @param[in] shares With Shares becomes the available start | ||
| 183 | /// folders be set. | ||
| 184 | /// @param[in] mask The mask to filter visible files, e.g. | ||
| 185 | /// ".m3u|.pls|.b4s|.wpl". | ||
| 186 | /// @param[in] heading Dialog header name | ||
| 187 | /// @param[out] fileList Return value about selected files | ||
| 188 | /// @param[in] useThumbs If set show thumbs if possible on dialog. | ||
| 189 | /// @param[in] useFileDirectories If set also packages (e.g. *.zip) are | ||
| 190 | /// handled as directories. | ||
| 191 | /// @return False if selection becomes canceled. | ||
| 192 | /// | ||
| 193 | inline bool ATTRIBUTE_HIDDEN ShowAndGetFileList(const std::string& shares, | ||
| 194 | const std::string& mask, | ||
| 195 | const std::string& heading, | ||
| 196 | std::vector<std::string>& fileList, | ||
| 197 | bool useThumbs = false, | ||
| 198 | bool useFileDirectories = false) | ||
| 199 | { | ||
| 200 | using namespace ::kodi::addon; | ||
| 201 | char** list = nullptr; | ||
| 202 | unsigned int listSize = 0; | ||
| 203 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_file_list(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 204 | shares.c_str(), mask.c_str(), heading.c_str(), &list, &listSize, | ||
| 205 | useThumbs, useFileDirectories); | ||
| 206 | if (ret) | ||
| 207 | { | ||
| 208 | for (unsigned int i = 0; i < listSize; ++i) | ||
| 209 | fileList.emplace_back(list[i]); | ||
| 210 | CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->clear_file_list(CAddonBase::m_interface->toKodi->kodiBase, &list, listSize); | ||
| 211 | } | ||
| 212 | return ret; | ||
| 213 | } | ||
| 214 | //-------------------------------------------------------------------------- | ||
| 215 | |||
| 216 | //========================================================================== | ||
| 217 | /// | ||
| 218 | /// \ingroup cpp_kodi_gui_dialogs_FileBrowser | ||
| 219 | /// @brief Source selection dialog | ||
| 220 | /// | ||
| 221 | /// @param[in,out] path As in the path to start and Return value | ||
| 222 | /// about selected source | ||
| 223 | /// @param[in] allowNetworkShares Allow also access to network | ||
| 224 | /// @param[in] additionalShare With additionalShare becomes the available | ||
| 225 | /// start folders be set (optional). | ||
| 226 | /// @param[in] type | ||
| 227 | /// @return False if selection becomes canceled. | ||
| 228 | /// | ||
| 229 | inline bool ATTRIBUTE_HIDDEN ShowAndGetSource(std::string& path, | ||
| 230 | bool allowNetworkShares, | ||
| 231 | const std::string& additionalShare = "", | ||
| 232 | const std::string& type = "") | ||
| 233 | { | ||
| 234 | using namespace ::kodi::addon; | ||
| 235 | char* retString = nullptr; | ||
| 236 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_source(CAddonBase::m_interface->toKodi->kodiBase, path.c_str(), &retString, | ||
| 237 | allowNetworkShares, additionalShare.c_str(), type.c_str()); | ||
| 238 | if (retString != nullptr) | ||
| 239 | { | ||
| 240 | if (std::strlen(retString)) | ||
| 241 | path = retString; | ||
| 242 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); | ||
| 243 | } | ||
| 244 | return ret; | ||
| 245 | } | ||
| 246 | //-------------------------------------------------------------------------- | ||
| 247 | |||
| 248 | //========================================================================== | ||
| 249 | /// | ||
| 250 | /// \ingroup cpp_kodi_gui_dialogs_FileBrowser | ||
| 251 | /// @brief Image selection dialog | ||
| 252 | /// | ||
| 253 | /// @param[in] shares With Shares becomes the available start folders be | ||
| 254 | /// set. | ||
| 255 | /// @param[in] heading Dialog header name | ||
| 256 | /// @param[out] path Return value about selected image | ||
| 257 | /// @return False if selection becomes canceled. | ||
| 258 | /// | ||
| 259 | inline bool ATTRIBUTE_HIDDEN ShowAndGetImage(const std::string& shares, | ||
| 260 | const std::string& heading, | ||
| 261 | std::string& path) | ||
| 262 | { | ||
| 263 | using namespace ::kodi::addon; | ||
| 264 | char* retString = nullptr; | ||
| 265 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_image(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 266 | shares.c_str(), heading.c_str(), path.c_str(), &retString); | ||
| 267 | if (retString != nullptr) | ||
| 268 | { | ||
| 269 | if (std::strlen(retString)) | ||
| 270 | path = retString; | ||
| 271 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); | ||
| 272 | } | ||
| 273 | return ret; | ||
| 274 | } | ||
| 275 | //-------------------------------------------------------------------------- | ||
| 276 | |||
| 277 | //========================================================================== | ||
| 278 | /// | ||
| 279 | /// \ingroup cpp_kodi_gui_dialogs_FileBrowser | ||
| 280 | /// @brief Image selection dialog to get several in to a list | ||
| 281 | /// | ||
| 282 | /// @param[in] shares With Shares becomes the available start folders | ||
| 283 | /// be set. | ||
| 284 | /// @param[in] heading Dialog header name | ||
| 285 | /// @param[out] file_list Return value about selected images | ||
| 286 | /// @return False if selection becomes canceled. | ||
| 287 | /// | ||
| 288 | inline bool ATTRIBUTE_HIDDEN ShowAndGetImageList(const std::string& shares, | ||
| 289 | const std::string& heading, | ||
| 290 | std::vector<std::string>& file_list) | ||
| 291 | { | ||
| 292 | using namespace ::kodi::addon; | ||
| 293 | char** list = nullptr; | ||
| 294 | unsigned int listSize = 0; | ||
| 295 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->show_and_get_image_list(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 296 | shares.c_str(), heading.c_str(), &list, &listSize); | ||
| 297 | if (ret) | ||
| 298 | { | ||
| 299 | for (unsigned int i = 0; i < listSize; ++i) | ||
| 300 | file_list.emplace_back(list[i]); | ||
| 301 | CAddonBase::m_interface->toKodi->kodi_gui->dialogFileBrowser->clear_file_list(CAddonBase::m_interface->toKodi->kodiBase, &list, listSize); | ||
| 302 | } | ||
| 303 | return ret; | ||
| 304 | } | ||
| 305 | //-------------------------------------------------------------------------- | ||
| 306 | }; | ||
| 307 | |||
| 308 | } /* namespace dialogs */ | ||
| 309 | } /* namespace gui */ | ||
| 310 | } /* namespace kodi */ | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Keyboard.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Keyboard.h deleted file mode 100644 index 843bdfa..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Keyboard.h +++ /dev/null | |||
| @@ -1,422 +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_Keyboard Dialog Keyboard | ||
| 24 | /// \ingroup cpp_kodi_gui | ||
| 25 | /// @brief \cpp_namespace{ kodi::gui::dialogs::Keyboard } | ||
| 26 | /// **Keyboard dialogs** | ||
| 27 | /// | ||
| 28 | /// The functions listed below have to be permitted by the user for the | ||
| 29 | /// representation of a keyboard around an input. | ||
| 30 | /// | ||
| 31 | /// The class supports several kinds, from an easy text choice up to the | ||
| 32 | /// passport Word production and their confirmation for add-on. | ||
| 33 | /// | ||
| 34 | /// It has the header \ref Keyboard.h "#include <kodi/gui/dialogs/Keyboard.h>" | ||
| 35 | /// be included to enjoy it. | ||
| 36 | /// | ||
| 37 | namespace Keyboard | ||
| 38 | { | ||
| 39 | //========================================================================== | ||
| 40 | /// | ||
| 41 | /// \ingroup cpp_kodi_gui_dialogs_Keyboard | ||
| 42 | /// @brief Show keyboard with initial value `text` and replace with result | ||
| 43 | /// string. | ||
| 44 | /// | ||
| 45 | /// @param[in,out] text Overwritten with user input if return=true. | ||
| 46 | /// @param[in] heading String shown on dialog title. | ||
| 47 | /// @param[in] allowEmptyResult Whether a blank password is valid or not. | ||
| 48 | /// @param[in] hiddenInput The inserted input is not shown as text. | ||
| 49 | /// @param[in] autoCloseMs To close the dialog after a specified | ||
| 50 | /// time, in milliseconds, default is 0 which | ||
| 51 | /// keeps the dialog open indefinitely. | ||
| 52 | /// @return true if successful display and user input. | ||
| 53 | /// false if unsuccessful display, no user | ||
| 54 | /// input, or canceled editing. | ||
| 55 | /// | ||
| 56 | /// | ||
| 57 | ///------------------------------------------------------------------------- | ||
| 58 | /// | ||
| 59 | /// **Example:** | ||
| 60 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 61 | /// #include <kodi/gui/dialogs/Keyboard.h> | ||
| 62 | /// | ||
| 63 | /// /* | ||
| 64 | /// * The example shows the display of keyboard call dialog at Kodi from the add-on. | ||
| 65 | /// * Below all values are set, however, can last two (hidden input = false and autoCloseMs = 0) | ||
| 66 | /// * to be released if not needed. | ||
| 67 | /// */ | ||
| 68 | /// std::string text = "Please change me to them want you want"; /*< It can be leaved empty or a | ||
| 69 | /// entry text added */ | ||
| 70 | /// bool bRet = ::kodi::gui::dialogs::Keyboard::ShowAndGetInput(text, | ||
| 71 | /// "Demonstration text entry", | ||
| 72 | /// true, | ||
| 73 | /// false, | ||
| 74 | /// 0); | ||
| 75 | /// fprintf(stderr, "Written keyboard input is : '%s' and was %s\n", | ||
| 76 | /// text.c_str(), bRet ? "OK" : "Canceled"); | ||
| 77 | /// ~~~~~~~~~~~~~ | ||
| 78 | /// | ||
| 79 | inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(std::string& text, | ||
| 80 | const std::string& heading, | ||
| 81 | bool allowEmptyResult, | ||
| 82 | bool hiddenInput = false, | ||
| 83 | unsigned int autoCloseMs = 0) | ||
| 84 | { | ||
| 85 | using namespace ::kodi::addon; | ||
| 86 | char* retString = nullptr; | ||
| 87 | bool ret = | ||
| 88 | CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_input_with_head( | ||
| 89 | CAddonBase::m_interface->toKodi->kodiBase, text.c_str(), &retString, heading.c_str(), | ||
| 90 | allowEmptyResult, hiddenInput, autoCloseMs); | ||
| 91 | if (retString != nullptr) | ||
| 92 | { | ||
| 93 | text = retString; | ||
| 94 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 95 | retString); | ||
| 96 | } | ||
| 97 | return ret; | ||
| 98 | } | ||
| 99 | //-------------------------------------------------------------------------- | ||
| 100 | |||
| 101 | //========================================================================== | ||
| 102 | /// | ||
| 103 | /// \ingroup cpp_kodi_gui_dialogs_Keyboard | ||
| 104 | /// @brief The example shows the display of keyboard call dialog at Kodi | ||
| 105 | /// from the add-on. | ||
| 106 | /// | ||
| 107 | /// @param[out] text Overwritten with user input if return=true. | ||
| 108 | /// @param[in] allowEmptyResult If set to true keyboard can also exited | ||
| 109 | /// without entered text. | ||
| 110 | /// @param[in] autoCloseMs To close the dialog after a specified time, | ||
| 111 | /// in milliseconds, default is 0 which keeps | ||
| 112 | /// the dialog open indefinitely. | ||
| 113 | /// @return true if successful display and user input. | ||
| 114 | /// false if unsuccessful display, no user | ||
| 115 | /// input, or canceled editing. | ||
| 116 | /// | ||
| 117 | inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(std::string& text, | ||
| 118 | bool allowEmptyResult, | ||
| 119 | unsigned int autoCloseMs = 0) | ||
| 120 | { | ||
| 121 | using namespace ::kodi::addon; | ||
| 122 | char* retString = nullptr; | ||
| 123 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_input(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 124 | text.c_str(), &retString, | ||
| 125 | allowEmptyResult, autoCloseMs); | ||
| 126 | if (retString != nullptr) | ||
| 127 | { | ||
| 128 | text = retString; | ||
| 129 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); | ||
| 130 | } | ||
| 131 | return ret; | ||
| 132 | } | ||
| 133 | //-------------------------------------------------------------------------- | ||
| 134 | |||
| 135 | //========================================================================== | ||
| 136 | /// | ||
| 137 | /// \ingroup cpp_kodi_gui_dialogs_Keyboard | ||
| 138 | /// @brief Shows keyboard and prompts for a password. Differs from | ||
| 139 | /// `ShowAndVerifyNewPassword()` in that no second verification | ||
| 140 | /// | ||
| 141 | /// @param[in,out] newPassword Overwritten with user input if return=true. | ||
| 142 | /// @param[in] heading String shown on dialog title. | ||
| 143 | /// @param[in] allowEmptyResult Whether a blank password is valid or not. | ||
| 144 | /// @param[in] autoCloseMs To close the dialog after a specified time, | ||
| 145 | /// in milliseconds, default is 0 which keeps | ||
| 146 | /// the dialog open indefinitely. | ||
| 147 | /// @return true if successful display and user input. | ||
| 148 | /// false if unsuccessful display, no user | ||
| 149 | /// input, or canceled editing. | ||
| 150 | /// | ||
| 151 | inline bool ATTRIBUTE_HIDDEN ShowAndGetNewPassword(std::string& newPassword, | ||
| 152 | const std::string& heading, | ||
| 153 | bool allowEmptyResult, | ||
| 154 | unsigned int autoCloseMs = 0) | ||
| 155 | { | ||
| 156 | using namespace ::kodi::addon; | ||
| 157 | char* retString = nullptr; | ||
| 158 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_new_password_with_head(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 159 | newPassword.c_str(), &retString, heading.c_str(), | ||
| 160 | allowEmptyResult, autoCloseMs); | ||
| 161 | if (retString != nullptr) | ||
| 162 | { | ||
| 163 | newPassword = retString; | ||
| 164 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); | ||
| 165 | } | ||
| 166 | return ret; | ||
| 167 | } | ||
| 168 | //-------------------------------------------------------------------------- | ||
| 169 | |||
| 170 | //========================================================================== | ||
| 171 | /// | ||
| 172 | /// \ingroup cpp_kodi_gui_dialogs_Keyboard | ||
| 173 | /// @brief Shows keyboard and prompts for a password. Differs from | ||
| 174 | /// `ShowAndVerifyNewPassword()` in that no second verification | ||
| 175 | /// | ||
| 176 | /// @param[in,out] newPassword Overwritten with user input if return=true. | ||
| 177 | /// @param[in] autoCloseMs To close the dialog after a specified time, | ||
| 178 | /// in milliseconds, default is 0 which keeps | ||
| 179 | /// the dialog open indefinitely. | ||
| 180 | /// @return true if successful display and user input. | ||
| 181 | /// false if unsuccessful display, no user | ||
| 182 | /// input, or canceled editing. | ||
| 183 | /// | ||
| 184 | inline bool ATTRIBUTE_HIDDEN ShowAndGetNewPassword(std::string& newPassword, | ||
| 185 | unsigned int autoCloseMs = 0) | ||
| 186 | { | ||
| 187 | using namespace ::kodi::addon; | ||
| 188 | char* retString = nullptr; | ||
| 189 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_new_password(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 190 | newPassword.c_str(), &retString, autoCloseMs); | ||
| 191 | if (retString != nullptr) | ||
| 192 | { | ||
| 193 | newPassword = retString; | ||
| 194 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); | ||
| 195 | } | ||
| 196 | return ret; | ||
| 197 | } | ||
| 198 | //-------------------------------------------------------------------------- | ||
| 199 | |||
| 200 | //========================================================================== | ||
| 201 | /// | ||
| 202 | /// \ingroup cpp_kodi_gui_dialogs_Keyboard | ||
| 203 | /// @brief Show keyboard twice to get and confirm a user-entered password | ||
| 204 | /// string. | ||
| 205 | /// | ||
| 206 | /// @param[out] newPassword Overwritten with user input if return=true. | ||
| 207 | /// @param[in] heading String shown on dialog title. | ||
| 208 | /// @param[in] allowEmptyResult | ||
| 209 | /// @param[in] autoCloseMs To close the dialog after a specified time, | ||
| 210 | /// in milliseconds, default is 0 which keeps | ||
| 211 | /// the dialog open indefinitely. | ||
| 212 | /// @return true if successful display and user input. | ||
| 213 | /// false if unsuccessful display, no user | ||
| 214 | /// input, or canceled editing. | ||
| 215 | /// | ||
| 216 | /// | ||
| 217 | ///------------------------------------------------------------------------- | ||
| 218 | /// | ||
| 219 | /// **Example:** | ||
| 220 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 221 | /// #include <kodi/General.h> | ||
| 222 | /// #include <kodi/gui/dialogs/Keyboard.h> | ||
| 223 | /// | ||
| 224 | /// /* | ||
| 225 | /// * The example below shows the complete use of keyboard dialog for password | ||
| 226 | /// * check. If only one check from add-on needed can be function with retries | ||
| 227 | /// * set to '0' called alone. | ||
| 228 | /// * | ||
| 229 | /// * The use of MD5 translated password is always required for the check on Kodi! | ||
| 230 | /// */ | ||
| 231 | /// | ||
| 232 | /// int maxretries = 3; | ||
| 233 | /// /* | ||
| 234 | /// * Password names need to be send as md5 sum to kodi. | ||
| 235 | /// */ | ||
| 236 | /// std::string password; | ||
| 237 | /// kodi::GetMD5("kodi", password); | ||
| 238 | /// | ||
| 239 | /// /* | ||
| 240 | /// * To the loop about password checks. | ||
| 241 | /// */ | ||
| 242 | /// int ret; | ||
| 243 | /// for (unsigned int i = 0; i < maxretries; i++) | ||
| 244 | /// { | ||
| 245 | /// /* | ||
| 246 | /// * Ask the user about the password. | ||
| 247 | /// */ | ||
| 248 | /// ret = ::kodi::gui::dialogs::Keyboard::ShowAndVerifyPassword(password, "Demo password call for PW 'kodi'", i, 0); | ||
| 249 | /// if (ret == 0) | ||
| 250 | /// { | ||
| 251 | /// fprintf(stderr, "Password successfull confirmed after '%i' tries\n", i+1); | ||
| 252 | /// break; | ||
| 253 | /// } | ||
| 254 | /// else if (ret < 0) | ||
| 255 | /// { | ||
| 256 | /// fprintf(stderr, "Canceled editing on try '%i'\n", i+1); | ||
| 257 | /// break; | ||
| 258 | /// } | ||
| 259 | /// else /* if (ret > 0) */ | ||
| 260 | /// { | ||
| 261 | /// fprintf(stderr, "Wrong password entered on try '%i'\n", i+1); | ||
| 262 | /// } | ||
| 263 | /// } | ||
| 264 | /// ~~~~~~~~~~~~~ | ||
| 265 | /// | ||
| 266 | inline bool ATTRIBUTE_HIDDEN ShowAndVerifyNewPassword(std::string& newPassword, | ||
| 267 | const std::string& heading, | ||
| 268 | bool allowEmptyResult, | ||
| 269 | unsigned int autoCloseMs = 0) | ||
| 270 | { | ||
| 271 | using namespace ::kodi::addon; | ||
| 272 | char* retString = nullptr; | ||
| 273 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_verify_new_password_with_head(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 274 | &retString, heading.c_str(), allowEmptyResult, | ||
| 275 | autoCloseMs); | ||
| 276 | if (retString != nullptr) | ||
| 277 | { | ||
| 278 | newPassword = retString; | ||
| 279 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); | ||
| 280 | } | ||
| 281 | return ret; | ||
| 282 | } | ||
| 283 | //-------------------------------------------------------------------------- | ||
| 284 | |||
| 285 | //========================================================================== | ||
| 286 | /// | ||
| 287 | /// \ingroup cpp_kodi_gui_dialogs_Keyboard | ||
| 288 | /// @brief Show keyboard twice to get and confirm a user-entered password | ||
| 289 | /// string. | ||
| 290 | /// | ||
| 291 | /// @param[out] newPassword Overwritten with user input if return=true. | ||
| 292 | /// @param[in] autoCloseMs To close the dialog after a specified time, | ||
| 293 | /// in milliseconds, default is 0 which keeps | ||
| 294 | /// the dialog open indefinitely. | ||
| 295 | /// @return true if successful display and user input. | ||
| 296 | /// false if unsuccessful display, no user | ||
| 297 | /// input, or canceled editing. | ||
| 298 | /// | ||
| 299 | inline bool ATTRIBUTE_HIDDEN ShowAndVerifyNewPassword(std::string& newPassword, | ||
| 300 | unsigned int autoCloseMs = 0) | ||
| 301 | { | ||
| 302 | using namespace ::kodi::addon; | ||
| 303 | char* retString = nullptr; | ||
| 304 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_verify_new_password(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 305 | &retString, autoCloseMs); | ||
| 306 | if (retString != nullptr) | ||
| 307 | { | ||
| 308 | newPassword = retString; | ||
| 309 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); | ||
| 310 | } | ||
| 311 | return ret; | ||
| 312 | } | ||
| 313 | //-------------------------------------------------------------------------- | ||
| 314 | |||
| 315 | //========================================================================== | ||
| 316 | /// | ||
| 317 | /// \ingroup cpp_kodi_gui_dialogs_Keyboard | ||
| 318 | /// @brief Show keyboard and verify user input against `password`. | ||
| 319 | /// | ||
| 320 | /// @param[in,out] password Value to compare against user input. | ||
| 321 | /// @param[in] heading String shown on dialog title. | ||
| 322 | /// @param[in] retries If greater than 0, shows "Incorrect | ||
| 323 | /// password, %d retries left" on dialog line 2, | ||
| 324 | /// else line 2 is blank. | ||
| 325 | /// @param[in] autoCloseMs To close the dialog after a specified time, | ||
| 326 | /// in milliseconds, default is 0 which keeps | ||
| 327 | /// the dialog open indefinitely. | ||
| 328 | /// @return 0 if successful display and user input. 1 if | ||
| 329 | /// unsuccessful input. -1 if no user input or | ||
| 330 | /// canceled editing. | ||
| 331 | /// | ||
| 332 | inline int ATTRIBUTE_HIDDEN ShowAndVerifyPassword(std::string& password, | ||
| 333 | const std::string& heading, | ||
| 334 | int retries, | ||
| 335 | unsigned int autoCloseMs = 0) | ||
| 336 | { | ||
| 337 | using namespace ::kodi::addon; | ||
| 338 | char* retString = nullptr; | ||
| 339 | int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_verify_password(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 340 | password.c_str(), &retString, heading.c_str(), | ||
| 341 | retries, autoCloseMs); | ||
| 342 | if (retString != nullptr) | ||
| 343 | { | ||
| 344 | password = retString; | ||
| 345 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); | ||
| 346 | } | ||
| 347 | return ret; | ||
| 348 | } | ||
| 349 | //-------------------------------------------------------------------------- | ||
| 350 | |||
| 351 | //========================================================================== | ||
| 352 | /// | ||
| 353 | /// \ingroup cpp_kodi_gui_dialogs_Keyboard | ||
| 354 | /// @brief Shows a filter related keyboard | ||
| 355 | /// | ||
| 356 | /// @param[in,out] text Overwritten with user input if return=true. | ||
| 357 | /// @param[in] searching Use dialog for search and send our search | ||
| 358 | /// message in safe way (only the active window | ||
| 359 | /// needs it) | ||
| 360 | /// - header name if true is "Enter search string" | ||
| 361 | /// - header name if false is "Enter value" | ||
| 362 | /// @param autoCloseMs To close the dialog after a specified time, | ||
| 363 | /// in milliseconds, default is 0 which keeps | ||
| 364 | /// the dialog open indefinitely. | ||
| 365 | /// @return true if successful display and user input. | ||
| 366 | /// false if unsuccessful display, no user | ||
| 367 | /// input, or canceled editing. | ||
| 368 | /// | ||
| 369 | inline bool ATTRIBUTE_HIDDEN ShowAndGetFilter(std::string& text, | ||
| 370 | bool searching, | ||
| 371 | unsigned int autoCloseMs = 0) | ||
| 372 | { | ||
| 373 | using namespace ::kodi::addon; | ||
| 374 | char* retString = nullptr; | ||
| 375 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->show_and_get_filter(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 376 | text.c_str(), &retString, searching, autoCloseMs); | ||
| 377 | if (retString != nullptr) | ||
| 378 | { | ||
| 379 | text = retString; | ||
| 380 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); | ||
| 381 | } | ||
| 382 | return ret; | ||
| 383 | } | ||
| 384 | //-------------------------------------------------------------------------- | ||
| 385 | |||
| 386 | //========================================================================== | ||
| 387 | /// | ||
| 388 | /// \ingroup cpp_kodi_gui_dialogs_Keyboard | ||
| 389 | /// @brief Send a text to a visible keyboard | ||
| 390 | /// | ||
| 391 | /// @param[in] text Overwritten with user input if return=true. | ||
| 392 | /// @param[in] closeKeyboard The open dialog is if also closed on 'true'. | ||
| 393 | /// @return true if successful done, false if | ||
| 394 | /// unsuccessful or keyboard not present. | ||
| 395 | /// | ||
| 396 | inline bool ATTRIBUTE_HIDDEN SendTextToActiveKeyboard(const std::string& text, | ||
| 397 | bool closeKeyboard = false) | ||
| 398 | { | ||
| 399 | using namespace ::kodi::addon; | ||
| 400 | return CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->send_text_to_active_keyboard(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 401 | text.c_str(), closeKeyboard); | ||
| 402 | } | ||
| 403 | //-------------------------------------------------------------------------- | ||
| 404 | |||
| 405 | //========================================================================== | ||
| 406 | /// | ||
| 407 | /// \ingroup cpp_kodi_gui_dialogs_Keyboard | ||
| 408 | /// @brief Check for visible keyboard on GUI | ||
| 409 | /// | ||
| 410 | /// @return true if keyboard present, false if not present | ||
| 411 | /// | ||
| 412 | inline bool ATTRIBUTE_HIDDEN IsKeyboardActivated() | ||
| 413 | { | ||
| 414 | using namespace ::kodi::addon; | ||
| 415 | return CAddonBase::m_interface->toKodi->kodi_gui->dialogKeyboard->is_keyboard_activated(CAddonBase::m_interface->toKodi->kodiBase); | ||
| 416 | } | ||
| 417 | //-------------------------------------------------------------------------- | ||
| 418 | }; | ||
| 419 | |||
| 420 | } /* namespace dialogs */ | ||
| 421 | } /* namespace gui */ | ||
| 422 | } /* namespace kodi */ | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Numeric.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Numeric.h deleted file mode 100644 index bff7683..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Numeric.h +++ /dev/null | |||
| @@ -1,362 +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_Numeric Dialog Numeric | ||
| 24 | /// \ingroup cpp_kodi_gui | ||
| 25 | /// @{ | ||
| 26 | /// @brief \cpp_namespace{ kodi::gui::dialogs::Numeric } | ||
| 27 | /// **Numeric dialogs** | ||
| 28 | /// | ||
| 29 | /// The functions listed below have to be permitted by the user for the | ||
| 30 | /// representation of a numeric keyboard around an input. | ||
| 31 | /// | ||
| 32 | /// The class supports several kinds, from an easy number choice up to the | ||
| 33 | /// passport Word production and their confirmation for add-on. | ||
| 34 | /// | ||
| 35 | /// It has the header \ref Numeric.h "#include <kodi/gui/dialogs/Numeric.h>" | ||
| 36 | /// be included to enjoy it. | ||
| 37 | /// | ||
| 38 | namespace Numeric | ||
| 39 | { | ||
| 40 | //========================================================================== | ||
| 41 | /// | ||
| 42 | /// \ingroup cpp_kodi_gui_dialogs_Numeric | ||
| 43 | /// @brief Use dialog to get numeric new password | ||
| 44 | /// | ||
| 45 | /// @param[out] newPassword String to preload into the keyboard | ||
| 46 | /// accumulator. Overwritten with user input | ||
| 47 | /// if return=true. Returned in MD5 format. | ||
| 48 | /// @return true if successful display and user | ||
| 49 | /// input entry/re-entry. | ||
| 50 | /// false if unsuccessful display, no user | ||
| 51 | /// input, or canceled editing. | ||
| 52 | /// | ||
| 53 | inline bool ATTRIBUTE_HIDDEN ShowAndVerifyNewPassword(std::string& newPassword) | ||
| 54 | { | ||
| 55 | using namespace ::kodi::addon; | ||
| 56 | char* pw = nullptr; | ||
| 57 | bool ret = | ||
| 58 | CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_verify_new_password( | ||
| 59 | CAddonBase::m_interface->toKodi->kodiBase, &pw); | ||
| 60 | if (pw != nullptr) | ||
| 61 | { | ||
| 62 | newPassword = pw; | ||
| 63 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, pw); | ||
| 64 | } | ||
| 65 | return ret; | ||
| 66 | } | ||
| 67 | //-------------------------------------------------------------------------- | ||
| 68 | |||
| 69 | //========================================================================== | ||
| 70 | /// | ||
| 71 | /// \ingroup cpp_kodi_gui_dialogs_Numeric | ||
| 72 | /// @brief Use dialog to verify numeric password. | ||
| 73 | /// | ||
| 74 | /// @param[in] password Password to compare with user input, need | ||
| 75 | /// in MD5 format. | ||
| 76 | /// @param[in] heading Heading to display | ||
| 77 | /// @param[in] retries If greater than 0, shows "Incorrect | ||
| 78 | /// password, %d retries left" on dialog | ||
| 79 | /// line 2, else line 2 is blank. | ||
| 80 | /// @return Possible values: | ||
| 81 | /// - 0 if successful display and user input. | ||
| 82 | /// - 1 if unsuccessful input. | ||
| 83 | /// - -1 if no user input or canceled editing. | ||
| 84 | /// | ||
| 85 | /// | ||
| 86 | ///------------------------------------------------------------------------- | ||
| 87 | /// | ||
| 88 | /// **Example:** | ||
| 89 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 90 | /// #include <stdio.h> /* fprintf */ | ||
| 91 | /// #include <kodi/General.h> | ||
| 92 | /// #include <kodi/gui/dialogs/Numeric.h> | ||
| 93 | /// | ||
| 94 | /// /* | ||
| 95 | /// * The example below shows the complete use of keyboard dialog for password | ||
| 96 | /// * check. If only one check from add-on needed can be function with retries | ||
| 97 | /// * set to '0' called alone. | ||
| 98 | /// * | ||
| 99 | /// * The use of MD5 translated password is always required for the check on Kodi! | ||
| 100 | /// */ | ||
| 101 | /// | ||
| 102 | /// int maxretries = 3; | ||
| 103 | /// | ||
| 104 | /// /* | ||
| 105 | /// * Password names need to be send as md5 sum to kodi. | ||
| 106 | /// */ | ||
| 107 | /// std::string password = kodi::GetMD5("1234"); | ||
| 108 | /// | ||
| 109 | /// /* | ||
| 110 | /// * To the loop about password checks. | ||
| 111 | /// */ | ||
| 112 | /// int ret; | ||
| 113 | /// for (unsigned int i = 0; i < maxretries; i++) | ||
| 114 | /// { | ||
| 115 | /// /* | ||
| 116 | /// * Ask the user about the password. | ||
| 117 | /// */ | ||
| 118 | /// ret = kodi::gui::dialogs::Numeric::ShowAndVerifyPassword(password, "Demo numeric password call for PW '1234'", i); | ||
| 119 | /// if (ret == 0) | ||
| 120 | /// { | ||
| 121 | /// fprintf(stderr, "Numeric password successfull confirmed after '%i' tries\n", i+1); | ||
| 122 | /// break; | ||
| 123 | /// } | ||
| 124 | /// else if (ret < 0) | ||
| 125 | /// { | ||
| 126 | /// fprintf(stderr, "Canceled editing on try '%i'\n", i+1); | ||
| 127 | /// break; | ||
| 128 | /// } | ||
| 129 | /// else /* if (ret > 0) */ | ||
| 130 | /// { | ||
| 131 | /// fprintf(stderr, "Wrong numeric password entered on try '%i'\n", i+1); | ||
| 132 | /// } | ||
| 133 | /// } | ||
| 134 | /// ~~~~~~~~~~~~~ | ||
| 135 | /// | ||
| 136 | inline int ATTRIBUTE_HIDDEN ShowAndVerifyPassword(const std::string& password, | ||
| 137 | const std::string& heading, | ||
| 138 | int retries) | ||
| 139 | { | ||
| 140 | using namespace ::kodi::addon; | ||
| 141 | return CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_verify_password(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 142 | password.c_str(), heading.c_str(), retries); | ||
| 143 | } | ||
| 144 | //-------------------------------------------------------------------------- | ||
| 145 | |||
| 146 | //========================================================================== | ||
| 147 | /// | ||
| 148 | /// \ingroup cpp_kodi_gui_dialogs_Numeric | ||
| 149 | /// @brief Use dialog to verify numeric password | ||
| 150 | /// | ||
| 151 | /// @param[in,out] toVerify Value to compare against user input. | ||
| 152 | /// @param[in] heading Heading to display | ||
| 153 | /// @param[in] verifyInput If set as true we verify the users input | ||
| 154 | /// versus toVerify. | ||
| 155 | /// @return true if successful display and user | ||
| 156 | /// input. false if unsuccessful display, no | ||
| 157 | /// user input, or canceled editing. | ||
| 158 | /// | ||
| 159 | inline bool ATTRIBUTE_HIDDEN ShowAndVerifyInput(std::string& toVerify, | ||
| 160 | const std::string& heading, | ||
| 161 | bool verifyInput) | ||
| 162 | { | ||
| 163 | using namespace ::kodi::addon; | ||
| 164 | char* retString = nullptr; | ||
| 165 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_verify_input(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 166 | toVerify.c_str(), &retString, heading.c_str(), verifyInput); | ||
| 167 | if (retString != nullptr) | ||
| 168 | { | ||
| 169 | toVerify = retString; | ||
| 170 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); | ||
| 171 | } | ||
| 172 | return ret; | ||
| 173 | } | ||
| 174 | //-------------------------------------------------------------------------- | ||
| 175 | |||
| 176 | //========================================================================== | ||
| 177 | /// | ||
| 178 | /// \ingroup cpp_kodi_gui_dialogs_Numeric | ||
| 179 | /// @brief Use dialog to get time value. | ||
| 180 | /// | ||
| 181 | /// @param[out] time Overwritten with user input if | ||
| 182 | /// return=true and time inserted. | ||
| 183 | /// @param[in] heading Heading to display. | ||
| 184 | /// @return true if successful display and user | ||
| 185 | /// input. false if unsuccessful display, no | ||
| 186 | /// user input, or canceled editing. | ||
| 187 | /// | ||
| 188 | /// | ||
| 189 | ///------------------------------------------------------------------------- | ||
| 190 | /// | ||
| 191 | /// **Example:** | ||
| 192 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 193 | /// #include <stdio.h> /* printf */ | ||
| 194 | /// #include <time.h> /* time_t, struct tm, time, localtime, strftime */ | ||
| 195 | /// #include <kodi/gui/dialogs/Numeric.h> | ||
| 196 | /// | ||
| 197 | /// time_t rawtime; | ||
| 198 | /// struct tm * timeinfo; | ||
| 199 | /// char buffer [10]; | ||
| 200 | /// | ||
| 201 | /// time (&rawtime); | ||
| 202 | /// timeinfo = localtime(&rawtime); | ||
| 203 | /// bool bRet = kodi::gui::dialogs::Numeric::ShowAndGetTime(*timeinfo, "Selected time test call"); | ||
| 204 | /// strftime(buffer, sizeof(buffer), "%H:%M.", timeinfo); | ||
| 205 | /// printf("Selected time it's %s and was on Dialog %s\n", buffer, bRet ? "OK" : "Canceled"); | ||
| 206 | /// ~~~~~~~~~~~~~ | ||
| 207 | /// | ||
| 208 | inline bool ATTRIBUTE_HIDDEN ShowAndGetTime(tm& time, const std::string& heading) | ||
| 209 | { | ||
| 210 | using namespace ::kodi::addon; | ||
| 211 | return CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_time(CAddonBase::m_interface->toKodi->kodiBase, &time, heading.c_str()); | ||
| 212 | } | ||
| 213 | //-------------------------------------------------------------------------- | ||
| 214 | |||
| 215 | //========================================================================== | ||
| 216 | /// | ||
| 217 | /// \ingroup cpp_kodi_gui_dialogs_Numeric | ||
| 218 | /// @brief Use dialog to get date value. | ||
| 219 | /// | ||
| 220 | /// @param[in,out] date Overwritten with user input if | ||
| 221 | /// return=true and date inserted. | ||
| 222 | /// @param[in] heading Heading to display | ||
| 223 | /// @return true if successful display and user | ||
| 224 | /// input. false if unsuccessful display, no | ||
| 225 | /// user input, or canceled editing. | ||
| 226 | /// | ||
| 227 | /// | ||
| 228 | ///------------------------------------------------------------------------- | ||
| 229 | /// | ||
| 230 | /// **Example:** | ||
| 231 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 232 | /// #include <stdio.h> /* printf */ | ||
| 233 | /// #include <time.h> /* time_t, struct tm, time, localtime, strftime */ | ||
| 234 | /// #include <kodi/gui/dialogs/Numeric.h> | ||
| 235 | /// | ||
| 236 | /// time_t rawtime; | ||
| 237 | /// struct tm * timeinfo; | ||
| 238 | /// char buffer [20]; | ||
| 239 | /// | ||
| 240 | /// time (&rawtime); | ||
| 241 | /// timeinfo = localtime(&rawtime); | ||
| 242 | /// bool bRet = kodi::gui::dialogs::Numeric::ShowAndGetDate(*timeinfo, "Selected date test call"); | ||
| 243 | /// strftime(buffer, sizeof(buffer), "%Y-%m-%d", timeinfo); | ||
| 244 | /// printf("Selected date it's %s and was on Dialog %s\n", buffer, bRet ? "OK" : "Canceled"); | ||
| 245 | /// ~~~~~~~~~~~~~ | ||
| 246 | /// | ||
| 247 | inline bool ATTRIBUTE_HIDDEN ShowAndGetDate(tm& date, const std::string& heading) | ||
| 248 | { | ||
| 249 | using namespace ::kodi::addon; | ||
| 250 | return CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_date(CAddonBase::m_interface->toKodi->kodiBase, &date, heading.c_str()); | ||
| 251 | } | ||
| 252 | //-------------------------------------------------------------------------- | ||
| 253 | |||
| 254 | //========================================================================== | ||
| 255 | /// | ||
| 256 | /// \ingroup cpp_kodi_gui_dialogs_Numeric | ||
| 257 | /// @brief Use dialog to get a IP | ||
| 258 | /// | ||
| 259 | /// @param[in,out] ipAddress Overwritten with user input if | ||
| 260 | /// return=true and IP address inserted. | ||
| 261 | /// @param[in] heading Heading to display. | ||
| 262 | /// @return true if successful display and | ||
| 263 | /// user input. false if unsuccessful | ||
| 264 | /// display, no user input, or canceled | ||
| 265 | /// editing. | ||
| 266 | /// | ||
| 267 | inline bool ATTRIBUTE_HIDDEN ShowAndGetIPAddress(std::string& ipAddress, | ||
| 268 | const std::string& heading) | ||
| 269 | { | ||
| 270 | using namespace ::kodi::addon; | ||
| 271 | char* retString = nullptr; | ||
| 272 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_ip_address(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 273 | ipAddress.c_str(), &retString, heading.c_str()); | ||
| 274 | if (retString != nullptr) | ||
| 275 | { | ||
| 276 | ipAddress = retString; | ||
| 277 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); | ||
| 278 | } | ||
| 279 | return ret; | ||
| 280 | } | ||
| 281 | //-------------------------------------------------------------------------- | ||
| 282 | |||
| 283 | //========================================================================== | ||
| 284 | /// | ||
| 285 | /// \ingroup cpp_kodi_gui_dialogs_Numeric | ||
| 286 | /// @brief Use dialog to get normal number. | ||
| 287 | /// | ||
| 288 | /// @param[in,out] input Overwritten with user input if | ||
| 289 | /// return=true and time in seconds inserted | ||
| 290 | /// @param[in] heading Heading to display | ||
| 291 | /// @param[in] autoCloseTimeoutMs To close the dialog after a specified | ||
| 292 | /// time, in milliseconds, default is 0 | ||
| 293 | /// which keeps the dialog open | ||
| 294 | /// indefinitely. | ||
| 295 | /// @return true if successful display and user | ||
| 296 | /// input. false if unsuccessful display, no | ||
| 297 | /// user input, or canceled editing. | ||
| 298 | /// | ||
| 299 | /// | ||
| 300 | ///------------------------------------------------------------------------- | ||
| 301 | /// | ||
| 302 | /// **Example:** | ||
| 303 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 304 | /// #include <stdio.h> /* printf */ | ||
| 305 | /// #include <stdlib.h> /* strtoull (C++11) */ | ||
| 306 | /// #include <kodi/gui/dialogs/Numeric.h> | ||
| 307 | /// | ||
| 308 | /// std::string number; | ||
| 309 | /// bool bRet = kodi::gui::dialogs::Numeric::ShowAndGetNumber(number, "Number test call"); | ||
| 310 | /// printf("Written number input is : %llu and was %s\n", | ||
| 311 | /// strtoull(number.c_str(), nullptr, 0), bRet ? "OK" : "Canceled"); | ||
| 312 | /// ~~~~~~~~~~~~~ | ||
| 313 | /// | ||
| 314 | inline bool ATTRIBUTE_HIDDEN ShowAndGetNumber(std::string& input, | ||
| 315 | const std::string& heading, | ||
| 316 | unsigned int autoCloseTimeoutMs = 0) | ||
| 317 | { | ||
| 318 | using namespace ::kodi::addon; | ||
| 319 | char* retString = nullptr; | ||
| 320 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_number(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 321 | input.c_str(), &retString, heading.c_str(), autoCloseTimeoutMs); | ||
| 322 | if (retString != nullptr) | ||
| 323 | { | ||
| 324 | input = retString; | ||
| 325 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); | ||
| 326 | } | ||
| 327 | return ret; | ||
| 328 | } | ||
| 329 | //-------------------------------------------------------------------------- | ||
| 330 | |||
| 331 | //========================================================================== | ||
| 332 | /// | ||
| 333 | /// \ingroup cpp_kodi_gui_dialogs_Numeric | ||
| 334 | /// @brief Show numeric keypad to get seconds. | ||
| 335 | /// | ||
| 336 | /// @param[in,out] time Overwritten with user input if return=true and | ||
| 337 | /// time in seconds inserted. | ||
| 338 | /// @param[in] heading Heading to display | ||
| 339 | /// @return true if successful display and user input. false | ||
| 340 | /// if unsuccessful display, no user input, or | ||
| 341 | /// canceled editing. | ||
| 342 | /// | ||
| 343 | inline bool ATTRIBUTE_HIDDEN ShowAndGetSeconds(std::string& time, const std::string& heading) | ||
| 344 | { | ||
| 345 | using namespace ::kodi::addon; | ||
| 346 | char* retString = nullptr; | ||
| 347 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogNumeric->show_and_get_seconds(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 348 | time.c_str(), &retString, heading.c_str()); | ||
| 349 | if (retString != nullptr) | ||
| 350 | { | ||
| 351 | time = retString; | ||
| 352 | CAddonBase::m_interface->toKodi->free_string(CAddonBase::m_interface->toKodi->kodiBase, retString); | ||
| 353 | } | ||
| 354 | return ret; | ||
| 355 | } | ||
| 356 | //-------------------------------------------------------------------------- | ||
| 357 | }; | ||
| 358 | /// @} | ||
| 359 | |||
| 360 | } /* namespace dialogs */ | ||
| 361 | } /* namespace gui */ | ||
| 362 | } /* namespace kodi */ | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/OK.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/OK.h deleted file mode 100644 index b9a3a0d..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/OK.h +++ /dev/null | |||
| @@ -1,99 +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 "../../AddonBase.h" | ||
| 12 | #include "../definitions.h" | ||
| 13 | |||
| 14 | namespace kodi | ||
| 15 | { | ||
| 16 | namespace gui | ||
| 17 | { | ||
| 18 | namespace dialogs | ||
| 19 | { | ||
| 20 | |||
| 21 | //============================================================================ | ||
| 22 | /// | ||
| 23 | /// \defgroup cpp_kodi_gui_dialogs_OK Dialog OK | ||
| 24 | /// \ingroup cpp_kodi_gui | ||
| 25 | /// @{ | ||
| 26 | /// @brief \cpp_namespace{ kodi::gui::dialogs::OK } | ||
| 27 | /// **OK dialog** | ||
| 28 | /// | ||
| 29 | /// The functions listed below permit the call of a dialogue of information, a | ||
| 30 | /// confirmation of the user by press from OK required. | ||
| 31 | /// | ||
| 32 | /// It has the header \ref OK.h "#include <kodi/gui/dialogs/OK.h>" | ||
| 33 | /// be included to enjoy it. | ||
| 34 | /// | ||
| 35 | namespace OK | ||
| 36 | { | ||
| 37 | //========================================================================== | ||
| 38 | /// | ||
| 39 | /// \ingroup cpp_kodi_gui_dialogs_OK | ||
| 40 | /// @brief Use dialog to inform user with text and confirmation with OK with continued string. | ||
| 41 | /// | ||
| 42 | /// @param[in] heading Dialog heading. | ||
| 43 | /// @param[in] text Multi-line text. | ||
| 44 | /// | ||
| 45 | /// | ||
| 46 | ///------------------------------------------------------------------------- | ||
| 47 | /// | ||
| 48 | /// **Example:** | ||
| 49 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 50 | /// #include <kodi/gui/dialogs/OK.h> | ||
| 51 | /// ... | ||
| 52 | /// kodi::gui::dialogs::OK::ShowAndGetInput("Test dialog", "Hello World!\nI'm a call from add-on\n :) :D"); | ||
| 53 | /// ~~~~~~~~~~~~~ | ||
| 54 | /// | ||
| 55 | inline void ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading, const std::string& text) | ||
| 56 | { | ||
| 57 | using namespace ::kodi::addon; | ||
| 58 | CAddonBase::m_interface->toKodi->kodi_gui->dialogOK->show_and_get_input_single_text( | ||
| 59 | CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), text.c_str()); | ||
| 60 | } | ||
| 61 | //-------------------------------------------------------------------------- | ||
| 62 | |||
| 63 | //========================================================================== | ||
| 64 | /// | ||
| 65 | /// \ingroup cpp_kodi_gui_dialogs_OK | ||
| 66 | /// @brief Use dialog to inform user with text and confirmation with OK with strings separated to the lines. | ||
| 67 | /// | ||
| 68 | /// @param[in] heading Dialog heading. | ||
| 69 | /// @param[in] line0 Line #1 text. | ||
| 70 | /// @param[in] line1 Line #2 text. | ||
| 71 | /// @param[in] line2 Line #3 text. | ||
| 72 | /// | ||
| 73 | /// | ||
| 74 | ///------------------------------------------------------------------------- | ||
| 75 | /// | ||
| 76 | /// **Example:** | ||
| 77 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 78 | /// #include <kodi/gui/dialogs/OK.h> | ||
| 79 | /// ... | ||
| 80 | /// kodi::gui::dialogs::OK::ShowAndGetInput("Test dialog", "Hello World!", "I'm a call from add-on", " :) :D"); | ||
| 81 | /// ~~~~~~~~~~~~~ | ||
| 82 | /// | ||
| 83 | inline void ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading, | ||
| 84 | const std::string& line0, | ||
| 85 | const std::string& line1, | ||
| 86 | const std::string& line2) | ||
| 87 | { | ||
| 88 | using namespace ::kodi::addon; | ||
| 89 | CAddonBase::m_interface->toKodi->kodi_gui->dialogOK->show_and_get_input_line_text(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 90 | heading.c_str(), line0.c_str(), line1.c_str(), | ||
| 91 | line2.c_str()); | ||
| 92 | } | ||
| 93 | //-------------------------------------------------------------------------- | ||
| 94 | } | ||
| 95 | /// @} | ||
| 96 | |||
| 97 | } /* namespace dialogs */ | ||
| 98 | } /* namespace gui */ | ||
| 99 | } /* namespace kodi */ | ||
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 */ | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Select.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Select.h deleted file mode 100644 index 39a98fe..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/Select.h +++ /dev/null | |||
| @@ -1,269 +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 | //============================================================================== | ||
| 15 | /// \defgroup cpp_kodi_vfs_Defs Definitions, structures and enumerators | ||
| 16 | /// \ingroup cpp_kodi_gui_dialogs_Select | ||
| 17 | /// @brief **Dialog Select definition values** | ||
| 18 | //------------------------------------------------------------------------------ | ||
| 19 | |||
| 20 | //============================================================================== | ||
| 21 | /// \ingroup cpp_kodi_vfs_Defs | ||
| 22 | /// @brief **Selection entry structure** | ||
| 23 | /// | ||
| 24 | typedef struct SSelectionEntry | ||
| 25 | { | ||
| 26 | //============================================================================ | ||
| 27 | /// Structure constructor | ||
| 28 | /// | ||
| 29 | /// There becomes selected always set to false. | ||
| 30 | /// | ||
| 31 | SSelectionEntry() = default; | ||
| 32 | //---------------------------------------------------------------------------- | ||
| 33 | |||
| 34 | /// Entry identfication string | ||
| 35 | std::string id; | ||
| 36 | |||
| 37 | /// Entry name to show on GUI dialog | ||
| 38 | std::string name; | ||
| 39 | |||
| 40 | /// Place where entry can be preselected and after return the from user | ||
| 41 | /// selected is set. | ||
| 42 | bool selected = false; | ||
| 43 | } SSelectionEntry; | ||
| 44 | //------------------------------------------------------------------------------ | ||
| 45 | |||
| 46 | namespace kodi | ||
| 47 | { | ||
| 48 | namespace gui | ||
| 49 | { | ||
| 50 | namespace dialogs | ||
| 51 | { | ||
| 52 | |||
| 53 | //============================================================================ | ||
| 54 | /// | ||
| 55 | /// \defgroup cpp_kodi_gui_dialogs_Select Dialog Select | ||
| 56 | /// \ingroup cpp_kodi_gui | ||
| 57 | /// @{ | ||
| 58 | /// @brief \cpp_namespace{ kodi::gui::dialogs::Select } | ||
| 59 | /// **Selection dialog** | ||
| 60 | /// | ||
| 61 | /// The function listed below permits the call of a dialogue to select of an | ||
| 62 | /// entry as a key | ||
| 63 | /// | ||
| 64 | /// It has the header \ref Select.h "#include <kodi/gui/dialogs/Select.h>" | ||
| 65 | /// be included to enjoy it. | ||
| 66 | /// | ||
| 67 | /// | ||
| 68 | namespace Select | ||
| 69 | { | ||
| 70 | //========================================================================== | ||
| 71 | /// | ||
| 72 | /// \ingroup cpp_kodi_gui_dialogs_Select | ||
| 73 | /// @brief Show a selection dialog about given parts. | ||
| 74 | /// | ||
| 75 | /// @param[in] heading Dialog heading name | ||
| 76 | /// @param[in] entries String list about entries | ||
| 77 | /// @param[in] selected [opt] Predefined selection (default is | ||
| 78 | /// <tt>-1</tt> for the first) | ||
| 79 | /// @param[in] autoclose [opt] To close dialog automatic after the given | ||
| 80 | /// time in ms. As '0' it stays open. | ||
| 81 | /// @return The selected entry, if return <tt>-1</tt> was | ||
| 82 | /// nothing selected or canceled | ||
| 83 | /// | ||
| 84 | /// | ||
| 85 | ///------------------------------------------------------------------------- | ||
| 86 | /// | ||
| 87 | /// **Example:** | ||
| 88 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 89 | /// #include <kodi/gui/dialogs/Select.h> | ||
| 90 | /// | ||
| 91 | /// const std::vector<std::string> entries | ||
| 92 | /// { | ||
| 93 | /// "Test 1", | ||
| 94 | /// "Test 2", | ||
| 95 | /// "Test 3", | ||
| 96 | /// "Test 4", | ||
| 97 | /// "Test 5" | ||
| 98 | /// }; | ||
| 99 | /// | ||
| 100 | /// int selected = kodi::gui::dialogs::Select::Show("Test selection", entries, -1); | ||
| 101 | /// if (selected < 0) | ||
| 102 | /// fprintf(stderr, "Item selection canceled\n"); | ||
| 103 | /// else | ||
| 104 | /// fprintf(stderr, "Selected item is: %i\n", selected); | ||
| 105 | /// ~~~~~~~~~~~~~ | ||
| 106 | /// | ||
| 107 | inline int ATTRIBUTE_HIDDEN Show(const std::string& heading, | ||
| 108 | const std::vector<std::string>& entries, | ||
| 109 | int selected = -1, | ||
| 110 | unsigned int autoclose = 0) | ||
| 111 | { | ||
| 112 | using namespace ::kodi::addon; | ||
| 113 | unsigned int size = static_cast<unsigned int>(entries.size()); | ||
| 114 | const char** cEntries = (const char**)malloc(size * sizeof(const char**)); | ||
| 115 | for (unsigned int i = 0; i < size; ++i) | ||
| 116 | { | ||
| 117 | cEntries[i] = entries[i].c_str(); | ||
| 118 | } | ||
| 119 | int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogSelect->open( | ||
| 120 | CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), cEntries, size, selected, | ||
| 121 | autoclose); | ||
| 122 | free(cEntries); | ||
| 123 | return ret; | ||
| 124 | } | ||
| 125 | //-------------------------------------------------------------------------- | ||
| 126 | |||
| 127 | //========================================================================== | ||
| 128 | /// | ||
| 129 | /// \ingroup cpp_kodi_gui_dialogs_Select | ||
| 130 | /// @brief Show a selection dialog about given parts. | ||
| 131 | /// | ||
| 132 | /// This function is mostly equal to the other, only becomes the string list | ||
| 133 | /// here done by a SSelectionEntry, where a ID string can be defined. | ||
| 134 | /// | ||
| 135 | /// @param[in] heading Dialog heading name | ||
| 136 | /// @param[in] entries SSelectionEntry list about entries | ||
| 137 | /// @param[in] selected [opt] Predefined selection (default is | ||
| 138 | /// <tt>-1</tt> for the first) | ||
| 139 | /// @param[in] autoclose [opt] To close dialog automatic after the given | ||
| 140 | /// time in ms. As '0' it stays open. | ||
| 141 | /// @return The selected entry, if return <tt>-1</tt> was | ||
| 142 | /// nothing selected or canceled | ||
| 143 | /// | ||
| 144 | /// | ||
| 145 | ///------------------------------------------------------------------------- | ||
| 146 | /// | ||
| 147 | /// **Example:** | ||
| 148 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 149 | /// #include <kodi/gui/dialogs/Select.h> | ||
| 150 | /// | ||
| 151 | /// std::vector<SSelectionEntry> entries | ||
| 152 | /// { | ||
| 153 | /// { "ID 1", "Test 1", false }, | ||
| 154 | /// { "ID 2", "Test 2", false }, | ||
| 155 | /// { "ID 3", "Test 3", false }, | ||
| 156 | /// { "ID 4", "Test 4", false }, | ||
| 157 | /// { "ID 5", "Test 5", false } | ||
| 158 | /// }; | ||
| 159 | /// | ||
| 160 | /// int selected = kodi::gui::dialogs::Select::Show("Test selection", entries, -1); | ||
| 161 | /// if (selected < 0) | ||
| 162 | /// fprintf(stderr, "Item selection canceled\n"); | ||
| 163 | /// else | ||
| 164 | /// fprintf(stderr, "Selected item is: %i\n", selected); | ||
| 165 | /// ~~~~~~~~~~~~~ | ||
| 166 | /// | ||
| 167 | inline int ATTRIBUTE_HIDDEN Show(const std::string& heading, | ||
| 168 | std::vector<SSelectionEntry>& entries, | ||
| 169 | int selected = -1, | ||
| 170 | unsigned int autoclose = 0) | ||
| 171 | { | ||
| 172 | using namespace ::kodi::addon; | ||
| 173 | unsigned int size = static_cast<unsigned int>(entries.size()); | ||
| 174 | const char** cEntries = static_cast<const char**>(malloc(size*sizeof(const char*))); | ||
| 175 | for (unsigned int i = 0; i < size; ++i) | ||
| 176 | { | ||
| 177 | cEntries[i] = entries[i].name.c_str(); | ||
| 178 | if (selected == -1 && entries[i].selected) | ||
| 179 | selected = i; | ||
| 180 | } | ||
| 181 | int ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogSelect->open(CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), | ||
| 182 | cEntries, size, selected, autoclose); | ||
| 183 | if (ret >= 0) | ||
| 184 | { | ||
| 185 | entries[ret].selected = true; | ||
| 186 | } | ||
| 187 | free(cEntries); | ||
| 188 | return ret; | ||
| 189 | } | ||
| 190 | //-------------------------------------------------------------------------- | ||
| 191 | |||
| 192 | //========================================================================== | ||
| 193 | /// | ||
| 194 | /// \ingroup cpp_kodi_gui_dialogs_Select | ||
| 195 | /// @brief Show a multiple selection dialog about given parts. | ||
| 196 | /// | ||
| 197 | /// @param[in] heading Dialog heading name | ||
| 198 | /// @param[in] entries SSelectionEntry list about entries | ||
| 199 | /// @param[in] autoclose [opt] To close dialog automatic after the given | ||
| 200 | /// time in ms. As '0' it stays open. | ||
| 201 | /// @return The selected entries, if return <tt>empty</tt> was | ||
| 202 | /// nothing selected or canceled | ||
| 203 | /// | ||
| 204 | /// With selected on SSelectionEntry can be a pre selection defined. | ||
| 205 | /// | ||
| 206 | ///------------------------------------------------------------------------- | ||
| 207 | /// | ||
| 208 | /// **Example:** | ||
| 209 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 210 | /// #include <kodi/gui/dialogs/Select.h> | ||
| 211 | /// | ||
| 212 | /// std::vector<SSelectionEntry> entries | ||
| 213 | /// { | ||
| 214 | /// { "ID 1", "Test 1", false }, | ||
| 215 | /// { "ID 2", "Test 2", false }, | ||
| 216 | /// { "ID 3", "Test 3", false }, | ||
| 217 | /// { "ID 4", "Test 4", false }, | ||
| 218 | /// { "ID 5", "Test 5", false } | ||
| 219 | /// }; | ||
| 220 | /// | ||
| 221 | /// bool ret = kodi::gui::dialogs::Select::ShowMultiSelect("Test selection", entries); | ||
| 222 | /// if (!ret) | ||
| 223 | /// fprintf(stderr, "Selection canceled\n"); | ||
| 224 | /// else | ||
| 225 | /// { | ||
| 226 | /// fprintf(stderr, "Selected items:\n"); | ||
| 227 | /// for (const auto& entry : entries) | ||
| 228 | /// { | ||
| 229 | /// if (entry.selected) | ||
| 230 | /// fprintf(stderr, " - %s\n", entry.selected.id.c_str()); | ||
| 231 | /// } | ||
| 232 | /// } | ||
| 233 | /// ~~~~~~~~~~~~~ | ||
| 234 | /// | ||
| 235 | inline bool ATTRIBUTE_HIDDEN ShowMultiSelect(const std::string& heading, | ||
| 236 | std::vector<SSelectionEntry>& entries, | ||
| 237 | int autoclose = 0) | ||
| 238 | { | ||
| 239 | using namespace ::kodi::addon; | ||
| 240 | unsigned int size = static_cast<unsigned int>(entries.size()); | ||
| 241 | const char** cEntryIDs = static_cast<const char**>(malloc(size*sizeof(const char*))); | ||
| 242 | const char** cEntryNames = static_cast<const char**>(malloc(size*sizeof(const char*))); | ||
| 243 | bool* cEntriesSelected = static_cast<bool*>(malloc(size*sizeof(bool))); | ||
| 244 | for (unsigned int i = 0; i < size; ++i) | ||
| 245 | { | ||
| 246 | cEntryIDs[i] = entries[i].id.c_str(); | ||
| 247 | cEntryNames[i] = entries[i].name.c_str(); | ||
| 248 | cEntriesSelected[i] = entries[i].selected; | ||
| 249 | } | ||
| 250 | bool ret = CAddonBase::m_interface->toKodi->kodi_gui->dialogSelect->open_multi_select(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 251 | heading.c_str(), cEntryIDs, cEntryNames, | ||
| 252 | cEntriesSelected, size, autoclose); | ||
| 253 | if (ret) | ||
| 254 | { | ||
| 255 | for (unsigned int i = 0; i < size; ++i) | ||
| 256 | entries[i].selected = cEntriesSelected[i]; | ||
| 257 | } | ||
| 258 | free(cEntryNames); | ||
| 259 | free(cEntryIDs); | ||
| 260 | free(cEntriesSelected); | ||
| 261 | return ret; | ||
| 262 | } | ||
| 263 | //-------------------------------------------------------------------------- | ||
| 264 | }; | ||
| 265 | /// @} | ||
| 266 | |||
| 267 | } /* namespace dialogs */ | ||
| 268 | } /* namespace gui */ | ||
| 269 | } /* namespace kodi */ | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/TextViewer.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/TextViewer.h deleted file mode 100644 index 5c81837..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/TextViewer.h +++ /dev/null | |||
| @@ -1,108 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2015-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_TextViewer Dialog Text Viewer | ||
| 24 | /// \ingroup cpp_kodi_gui | ||
| 25 | /// @{ | ||
| 26 | /// @brief \cpp_namespace{ kodi::gui::dialogs::TextViewer } | ||
| 27 | /// **Text viewer dialog** | ||
| 28 | /// | ||
| 29 | /// The text viewer dialog can be used to display descriptions, help texts or | ||
| 30 | /// other larger texts. | ||
| 31 | /// | ||
| 32 | /// In order to achieve a line break is a <b>\\n</b> directly in the text or | ||
| 33 | /// in the <em>"./resources/language/resource.language.??_??/strings.po"</em> | ||
| 34 | /// to call with <b>std::string kodi::general::GetLocalizedString(...);</b>. | ||
| 35 | /// | ||
| 36 | /// It has the header \ref TextViewer.h "#include <kodi/gui/dialogs/TextViewer.h>" | ||
| 37 | /// be included to enjoy it. | ||
| 38 | /// | ||
| 39 | namespace TextViewer | ||
| 40 | { | ||
| 41 | //========================================================================== | ||
| 42 | /// | ||
| 43 | /// \ingroup cpp_kodi_gui_dialogs_TextViewer | ||
| 44 | /// @brief Show info text dialog | ||
| 45 | /// | ||
| 46 | /// @param[in] heading Small heading text | ||
| 47 | /// @param[in] text Showed text on dialog | ||
| 48 | /// | ||
| 49 | /// | ||
| 50 | ///------------------------------------------------------------------------- | ||
| 51 | /// | ||
| 52 | /// **Example:** | ||
| 53 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 54 | /// #include <kodi/gui/dialogs/TextViewer.h> | ||
| 55 | /// | ||
| 56 | /// kodi::gui::dialogs::TextViewer::Show("The Wizard of Oz (1939 film)", | ||
| 57 | /// "The Wizard of Oz is a 1939 American musical comedy-drama fantasy film " | ||
| 58 | /// "produced by Metro-Goldwyn-Mayer, and the most well-known and commercially " | ||
| 59 | /// "successful adaptation based on the 1900 novel The Wonderful Wizard of Oz " | ||
| 60 | /// "by L. Frank Baum. The film stars Judy Garland as Dorothy Gale. The film" | ||
| 61 | /// "co-stars Terry the dog, billed as Toto; Ray Bolger, Jack Haley, Bert Lahr, " | ||
| 62 | /// "Frank Morgan, Billie Burke, Margaret Hamilton, with Charley Grapewin and " | ||
| 63 | /// "Clara Blandick, and the Singer Midgets as the Munchkins.\n" | ||
| 64 | /// "\n" | ||
| 65 | /// "Notable for its use of Technicolor, fantasy storytelling, musical score and " | ||
| 66 | /// "unusual characters, over the years it has become an icon of American popular " | ||
| 67 | /// "culture. It was nominated for six Academy Awards, including Best Picture but " | ||
| 68 | /// "lost to Gone with the Wind. It did win in two other categories including Best " | ||
| 69 | /// "Original Song for \"Over the Rainbow\". However, the film was a box office " | ||
| 70 | /// "disappointment on its initial release, earning only $3,017,000 on a $2,777,000 " | ||
| 71 | /// "budget, despite receiving largely positive reviews. It was MGM's most " | ||
| 72 | /// "expensive production at that time, and did not completely recoup the studio's " | ||
| 73 | /// "investment and turn a profit until theatrical re-releases starting in 1949.\n" | ||
| 74 | /// "\n" | ||
| 75 | /// "The 1956 broadcast television premiere of the film on CBS re-introduced the " | ||
| 76 | /// "film to the wider public and eventually made the presentation an annual " | ||
| 77 | /// "tradition, making it one of the most known films in cinema history. The " | ||
| 78 | /// "film was named the most-viewed motion picture on television syndication by " | ||
| 79 | /// "the Library of Congress who also included the film in its National Film " | ||
| 80 | /// "Registry in its inaugural year in 1989. Designation on the registry calls " | ||
| 81 | /// "for efforts to preserve it for being \"culturally, historically, and " | ||
| 82 | /// "aesthetically significant\". It is also one of the few films on UNESCO's " | ||
| 83 | /// "Memory of the World Register.\n" | ||
| 84 | /// "\n" | ||
| 85 | /// "The Wizard of Oz is often ranked on best-movie lists in critics' and public " | ||
| 86 | /// "polls. It is the source of many quotes referenced in modern popular culture. " | ||
| 87 | /// "It was directed primarily by Victor Fleming (who left production to take " | ||
| 88 | /// "over direction on the troubled Gone with the Wind production). Noel Langley, " | ||
| 89 | /// "Florence Ryerson and Edgar Allan Woolf received credit for the screenplay, " | ||
| 90 | /// "but there were uncredited contributions by others. The songs were written " | ||
| 91 | /// "by Edgar \"Yip\" Harburg (lyrics) and Harold Arlen (music). The incidental " | ||
| 92 | /// "music, based largely on the songs, was composed by Herbert Stothart, with " | ||
| 93 | /// "interspersed renderings from classical composers.\n"); | ||
| 94 | /// ~~~~~~~~~~~~~ | ||
| 95 | /// | ||
| 96 | inline void ATTRIBUTE_HIDDEN Show(const std::string& heading, const std::string& text) | ||
| 97 | { | ||
| 98 | using namespace ::kodi::addon; | ||
| 99 | CAddonBase::m_interface->toKodi->kodi_gui->dialogTextViewer->open( | ||
| 100 | CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), text.c_str()); | ||
| 101 | } | ||
| 102 | //-------------------------------------------------------------------------- | ||
| 103 | }; | ||
| 104 | /// @} | ||
| 105 | |||
| 106 | } /* namespace dialogs */ | ||
| 107 | } /* namespace gui */ | ||
| 108 | } /* namespace kodi */ | ||
diff --git a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/YesNo.h b/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/YesNo.h deleted file mode 100644 index 67c2fc4..0000000 --- a/xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/YesNo.h +++ /dev/null | |||
| @@ -1,188 +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_YesNo Dialog Yes/No | ||
| 24 | /// \ingroup cpp_kodi_gui | ||
| 25 | /// @{ | ||
| 26 | /// @brief \cpp_namespace{ kodi::gui::dialogs::YesNo } | ||
| 27 | /// **Yes / No dialog** | ||
| 28 | /// | ||
| 29 | /// The Yes / No dialog can be used to inform the user about questions and get | ||
| 30 | /// the answer. | ||
| 31 | /// | ||
| 32 | /// In order to achieve a line break is a <b>\\n</b> directly in the text or | ||
| 33 | /// in the <em>"./resources/language/resource.language.??_??/strings.po"</em> | ||
| 34 | /// to call with <b>std::string kodi::general::GetLocalizedString(...);</b>. | ||
| 35 | /// | ||
| 36 | /// It has the header \ref YesNo.h "#include <kodi/gui/dialogs/YesNo.h>" | ||
| 37 | /// be included to enjoy it. | ||
| 38 | /// | ||
| 39 | /// | ||
| 40 | namespace YesNo | ||
| 41 | { | ||
| 42 | //========================================================================== | ||
| 43 | /// | ||
| 44 | /// \ingroup cpp_kodi_gui_dialogs_YesNo | ||
| 45 | /// @brief Use dialog to get numeric new password with one text string shown | ||
| 46 | /// everywhere and cancel return field | ||
| 47 | /// | ||
| 48 | /// @param[in] heading Dialog heading | ||
| 49 | /// @param[in] text Multi-line text | ||
| 50 | /// @param[out] canceled Return value about cancel button | ||
| 51 | /// @param[in] noLabel [opt] label to put on the no button | ||
| 52 | /// @param[in] yesLabel [opt] label to put on the yes button | ||
| 53 | /// @return Returns True if 'Yes' was pressed, else False | ||
| 54 | /// | ||
| 55 | /// @note It is preferred to only use this as it is actually a multi-line text. | ||
| 56 | /// | ||
| 57 | /// | ||
| 58 | ///------------------------------------------------------------------------- | ||
| 59 | /// | ||
| 60 | /// **Example:** | ||
| 61 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 62 | /// #include <kodi/gui/dialogs/YesNo.h> | ||
| 63 | /// | ||
| 64 | /// bool canceled; | ||
| 65 | /// bool ret = kodi::gui::dialogs::YesNo::ShowAndGetInput( | ||
| 66 | /// "Yes / No test call", /* The Header */ | ||
| 67 | /// "You has opened Yes / No dialog for test\n\nIs this OK for you?", | ||
| 68 | /// canceled, /* return value about cancel button */ | ||
| 69 | /// "Not really", /* No label, is optional and if empty "No" */ | ||
| 70 | /// "Ohhh yes"); /* Yes label, also optional and if empty "Yes" */ | ||
| 71 | /// fprintf(stderr, "You has called Yes/No, returned '%s' and was %s\n", | ||
| 72 | /// ret ? "yes" : "no", | ||
| 73 | /// canceled ? "canceled" : "not canceled"); | ||
| 74 | /// ~~~~~~~~~~~~~ | ||
| 75 | /// | ||
| 76 | inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading, | ||
| 77 | const std::string& text, | ||
| 78 | bool& canceled, | ||
| 79 | const std::string& noLabel = "", | ||
| 80 | const std::string& yesLabel = "") | ||
| 81 | { | ||
| 82 | using namespace ::kodi::addon; | ||
| 83 | return CAddonBase::m_interface->toKodi->kodi_gui->dialogYesNo->show_and_get_input_single_text( | ||
| 84 | CAddonBase::m_interface->toKodi->kodiBase, heading.c_str(), text.c_str(), &canceled, | ||
| 85 | noLabel.c_str(), yesLabel.c_str()); | ||
| 86 | } | ||
| 87 | //-------------------------------------------------------------------------- | ||
| 88 | |||
| 89 | //========================================================================== | ||
| 90 | /// | ||
| 91 | /// \ingroup cpp_kodi_gui_dialogs_YesNo | ||
| 92 | /// @brief Use dialog to get numeric new password with separated line strings | ||
| 93 | /// | ||
| 94 | /// @param[in] heading Dialog heading | ||
| 95 | /// @param[in] line0 Line #0 text | ||
| 96 | /// @param[in] line1 Line #1 text | ||
| 97 | /// @param[in] line2 Line #2 text | ||
| 98 | /// @param[in] noLabel [opt] label to put on the no button. | ||
| 99 | /// @param[in] yesLabel [opt] label to put on the yes button. | ||
| 100 | /// @return Returns True if 'Yes' was pressed, else False. | ||
| 101 | /// | ||
| 102 | /// | ||
| 103 | ///------------------------------------------------------------------------- | ||
| 104 | /// | ||
| 105 | /// **Example:** | ||
| 106 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 107 | /// #include <kodi/gui/dialogs/YesNo.h> | ||
| 108 | /// | ||
| 109 | /// bool ret = kodi::gui::dialogs::YesNo::ShowAndGetInput( | ||
| 110 | /// "Yes / No test call", // The Header | ||
| 111 | /// "You has opened Yes / No dialog for test", | ||
| 112 | /// "", | ||
| 113 | /// "Is this OK for you?", | ||
| 114 | /// "Not really", // No label, is optional and if empty "No" | ||
| 115 | /// "Ohhh yes"); // Yes label, also optional and if empty "Yes" | ||
| 116 | /// fprintf(stderr, "You has called Yes/No, returned '%s'\n", | ||
| 117 | /// ret ? "yes" : "no"); | ||
| 118 | /// ~~~~~~~~~~~~~ | ||
| 119 | /// | ||
| 120 | inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading, | ||
| 121 | const std::string& line0, | ||
| 122 | const std::string& line1, | ||
| 123 | const std::string& line2, | ||
| 124 | const std::string& noLabel = "", | ||
| 125 | const std::string& yesLabel = "") | ||
| 126 | { | ||
| 127 | using namespace ::kodi::addon; | ||
| 128 | return CAddonBase::m_interface->toKodi->kodi_gui->dialogYesNo->show_and_get_input_line_text(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 129 | heading.c_str(), line0.c_str(), line1.c_str(), line2.c_str(), | ||
| 130 | noLabel.c_str(), yesLabel.c_str()); | ||
| 131 | } | ||
| 132 | //-------------------------------------------------------------------------- | ||
| 133 | |||
| 134 | //========================================================================== | ||
| 135 | /// | ||
| 136 | /// \ingroup cpp_kodi_gui_dialogs_YesNo | ||
| 137 | /// @brief Use dialog to get numeric new password with separated line strings and cancel return field | ||
| 138 | /// | ||
| 139 | /// @param[in] heading Dialog heading | ||
| 140 | /// @param[in] line0 Line #0 text | ||
| 141 | /// @param[in] line1 Line #1 text | ||
| 142 | /// @param[in] line2 Line #2 text | ||
| 143 | /// @param[out] canceled Return value about cancel button | ||
| 144 | /// @param[in] noLabel [opt] label to put on the no button | ||
| 145 | /// @param[in] yesLabel [opt] label to put on the yes button | ||
| 146 | /// @return Returns True if 'Yes' was pressed, else False | ||
| 147 | /// | ||
| 148 | /// | ||
| 149 | ///------------------------------------------------------------------------- | ||
| 150 | /// | ||
| 151 | /// **Example:** | ||
| 152 | /// ~~~~~~~~~~~~~{.cpp} | ||
| 153 | /// #include <kodi/gui/dialogs/YesNo.h> | ||
| 154 | /// | ||
| 155 | /// bool canceled; | ||
| 156 | /// bool ret = kodi::gui::dialogs::YesNo::ShowAndGetInput( | ||
| 157 | /// "Yes / No test call", // The Header | ||
| 158 | /// "You has opened Yes / No dialog for test", | ||
| 159 | /// "", | ||
| 160 | /// "Is this OK for you?", | ||
| 161 | /// canceled, // return value about cancel button | ||
| 162 | /// "Not really", // No label, is optional and if empty "No" | ||
| 163 | /// "Ohhh yes"); // Yes label, also optional and if empty "Yes" | ||
| 164 | /// fprintf(stderr, "You has called Yes/No, returned '%s' and was %s\n", | ||
| 165 | /// ret ? "yes" : "no", | ||
| 166 | /// canceled ? "canceled" : "not canceled"); | ||
| 167 | /// ~~~~~~~~~~~~~ | ||
| 168 | /// | ||
| 169 | inline bool ATTRIBUTE_HIDDEN ShowAndGetInput(const std::string& heading, | ||
| 170 | const std::string& line0, | ||
| 171 | const std::string& line1, | ||
| 172 | const std::string& line2, | ||
| 173 | bool& canceled, | ||
| 174 | const std::string& noLabel = "", | ||
| 175 | const std::string& yesLabel = "") | ||
| 176 | { | ||
| 177 | using namespace ::kodi::addon; | ||
| 178 | return CAddonBase::m_interface->toKodi->kodi_gui->dialogYesNo->show_and_get_input_line_button_text(CAddonBase::m_interface->toKodi->kodiBase, | ||
| 179 | heading.c_str(), line0.c_str(), line1.c_str(), line2.c_str(), | ||
| 180 | &canceled, noLabel.c_str(), yesLabel.c_str()); | ||
| 181 | } | ||
| 182 | //-------------------------------------------------------------------------- | ||
| 183 | }; | ||
| 184 | /// @} | ||
| 185 | |||
| 186 | } /* namespace dialogs */ | ||
| 187 | } /* namespace gui */ | ||
| 188 | } /* namespace kodi */ | ||
