diff options
| author | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2020-10-19 00:52:24 +0200 |
| commit | be933ef2241d79558f91796cc5b3a161f72ebf9c (patch) | |
| tree | fe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h | |
| parent | 5f8335c1e49ce108ef3481863833c98efa00411b (diff) | |
| download | kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2 kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip | |
sync with upstream
Diffstat (limited to 'xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h')
| -rw-r--r-- | xbmc/addons/kodi-addon-dev-kit/include/kodi/gui/dialogs/FileBrowser.h | 310 |
1 files changed, 0 insertions, 310 deletions
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 */ | ||
