Kodi Documentation 18.0
Kodi is an open source media player and entertainment hub.
Dialog File Browser

\cpp_namespace{ kodi::gui::dialogs::FileBrowser } File browser dialog More...

Functions

bool kodi::gui::dialogs::FileBrowser::ShowAndGetDirectory (const std::string &shares, const std::string &heading, std::string &path, bool writeOnly=false)
 Directory selection dialog. More...
 
bool kodi::gui::dialogs::FileBrowser::ShowAndGetFile (const std::string &shares, const std::string &mask, const std::string &heading, std::string &path, bool useThumbs=false, bool useFileDirectories=false)
 File selection dialog. More...
 
bool kodi::gui::dialogs::FileBrowser::ShowAndGetFileFromDir (const std::string &directory, const std::string &mask, const std::string &heading, std::string &path, bool useThumbs=false, bool useFileDirectories=false, bool singleList=false)
 File selection from a directory. More...
 
bool kodi::gui::dialogs::FileBrowser::ShowAndGetFileList (const std::string &shares, const std::string &mask, const std::string &heading, std::vector< std::string > &fileList, bool useThumbs=false, bool useFileDirectories=false)
 File selection dialog to get several in to a list. More...
 
bool kodi::gui::dialogs::FileBrowser::ShowAndGetSource (std::string &path, bool allowNetworkShares, const std::string &additionalShare="", const std::string &type="")
 Source selection dialog. More...
 
bool kodi::gui::dialogs::FileBrowser::ShowAndGetImage (const std::string &shares, const std::string &heading, std::string &path)
 Image selection dialog. More...
 
bool kodi::gui::dialogs::FileBrowser::ShowAndGetImageList (const std::string &shares, const std::string &heading, std::vector< std::string > &file_list)
 Image selection dialog to get several in to a list. More...
 

Detailed Description

\cpp_namespace{ kodi::gui::dialogs::FileBrowser } File browser dialog

The functions listed below of the class "FileBrowser" offer the possibility to select to a file by the user of the add-on.

It allows all the options that are possible in Kodi itself and offers all support file types.

It has the header #include <kodi/gui/dialogs/FileBrowser.h> be included to enjoy it.

Function Documentation

◆ ShowAndGetDirectory()

bool kodi::gui::dialogs::FileBrowser::ShowAndGetDirectory ( const std::string &  shares,
const std::string &  heading,
std::string &  path,
bool  writeOnly = false 
)
inline

Directory selection dialog.

Parameters
[in]sharesWith Shares becomes the available start folders be set.
[in]headingDialog header name
[in,out]pathAs in the path to start and return value about selected directory
[in]writeOnlyIf set only writeable folders are shown.
Returns
False if selection becomes canceled.

Example:

/*
* Example show directory selection dialog with on 'share' (first value)
* defined directory types.
*
* If this becomes leaved empty and 'directory' is empty goes it to the
* base path of the hard disk.
*
* Also can be with path written to 'directory' before the dialog forced
* to a start place.
*&zwj;/
std::string directory;
bool ret = kodi::gui::dialogs::FileBrowser::ShowAndGetDirectory("local|network|removable",
"Test directory selection",
directory,
false);
fprintf(stderr, "Selected directory is : %s and was %s\n", directory.c_str(), ret ? "OK" : "Canceled");

◆ ShowAndGetFile()

bool kodi::gui::dialogs::FileBrowser::ShowAndGetFile ( const std::string &  shares,
const std::string &  mask,
const std::string &  heading,
std::string &  path,
bool  useThumbs = false,
bool  useFileDirectories = false 
)
inline

File selection dialog.

Parameters
[in]sharesWith Shares becomes the available start folders be set.
[in]maskThe mask to filter visible files, e.g. ".m3u|.pls|.b4s|.wpl".
[in]headingDialog header name
[in,out]pathAs in the path to start and Return value about selected file
[in]useThumbsIf set show thumbs if possible on dialog.
[in]useFileDirectoriesIf set also packages (e.g. *.zip) are handled as directories.
Returns
False if selection becomes canceled.

◆ ShowAndGetFileFromDir()

bool kodi::gui::dialogs::FileBrowser::ShowAndGetFileFromDir ( const std::string &  directory,
const std::string &  mask,
const std::string &  heading,
std::string &  path,
bool  useThumbs = false,
bool  useFileDirectories = false,
bool  singleList = false 
)
inline

File selection from a directory.

Parameters
[in]directoryThe directory name where the dialog start, possible are normal names and kodi's special names.
[in]maskThe mask to filter visible files, e.g. ".m3u|.pls|.b4s|.wpl".
[in]headingDialog header name
[in,out]pathAs in the path to start and Return value about selected file
[in]useThumbsIf set show thumbs if possible on dialog.
[in]useFileDirectoriesIf set also packages (e.g. *.zip) are handled as directories.
[in]singleList
Returns
False if selection becomes canceled.

◆ ShowAndGetFileList()

bool kodi::gui::dialogs::FileBrowser::ShowAndGetFileList ( const std::string &  shares,
const std::string &  mask,
const std::string &  heading,
std::vector< std::string > &  fileList,
bool  useThumbs = false,
bool  useFileDirectories = false 
)
inline

File selection dialog to get several in to a list.

Parameters
[in]sharesWith Shares becomes the available start folders be set.
[in]maskThe mask to filter visible files, e.g. ".m3u|.pls|.b4s|.wpl".
[in]headingDialog header name
[out]fileListReturn value about selected files
[in]useThumbsIf set show thumbs if possible on dialog.
[in]useFileDirectoriesIf set also packages (e.g. *.zip) are handled as directories.
Returns
False if selection becomes canceled.

◆ ShowAndGetImage()

bool kodi::gui::dialogs::FileBrowser::ShowAndGetImage ( const std::string &  shares,
const std::string &  heading,
std::string &  path 
)
inline

Image selection dialog.

Parameters
[in]sharesWith Shares becomes the available start folders be set.
[in]headingDialog header name
[out]pathReturn value about selected image
Returns
False if selection becomes canceled.

◆ ShowAndGetImageList()

bool kodi::gui::dialogs::FileBrowser::ShowAndGetImageList ( const std::string &  shares,
const std::string &  heading,
std::vector< std::string > &  file_list 
)
inline

Image selection dialog to get several in to a list.

Parameters
[in]sharesWith Shares becomes the available start folders be set.
[in]headingDialog header name
[out]file_listReturn value about selected images
Returns
False if selection becomes canceled.

◆ ShowAndGetSource()

bool kodi::gui::dialogs::FileBrowser::ShowAndGetSource ( std::string &  path,
bool  allowNetworkShares,
const std::string &  additionalShare = "",
const std::string &  type = "" 
)
inline

Source selection dialog.

Parameters
[in,out]pathAs in the path to start and Return value about selected source
[in]allowNetworkSharesAllow also access to network
[in]additionalShareWith additionalShare becomes the available start folders be set (optional).
[in]type
Returns
False if selection becomes canceled.