Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Dialog File Browser

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. More...

Functions

bool ATTR_DLL_LOCAL kodi::gui::dialogs::FileBrowser::ShowAndGetDirectory (const std::string &shares, const std::string &heading, std::string &path, bool writeOnly=false)
 Directory selection dialog.
 
bool ATTR_DLL_LOCAL 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.
 
bool ATTR_DLL_LOCAL 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.
 
bool ATTR_DLL_LOCAL 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.
 
bool ATTR_DLL_LOCAL kodi::gui::dialogs::FileBrowser::ShowAndGetSource (std::string &path, bool allowNetworkShares, const std::string &additionalShare="", const std::string &type="")
 Source selection dialog.
 
bool ATTR_DLL_LOCAL kodi::gui::dialogs::FileBrowser::ShowAndGetImage (const std::string &shares, const std::string &heading, std::string &path)
 Image selection dialog.
 
bool ATTR_DLL_LOCAL 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.
 

Detailed Description

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 ATTR_DLL_LOCAL 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]writeOnly[opt] If 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.
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");
bool ATTR_DLL_LOCAL ShowAndGetDirectory(const std::string &shares, const std::string &heading, std::string &path, bool writeOnly=false)
Directory selection dialog.
Definition kodi-dev-kit/include/kodi/gui/dialogs/filebrowser.h:70

◆ ShowAndGetFile()

bool ATTR_DLL_LOCAL 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]useThumbs[opt] If set show thumbs if possible on dialog
[in]useFileDirectories[opt] If set also packages (e.g. *.zip) are handled as directories.
Returns
False if selection becomes canceled

◆ ShowAndGetFileFromDir()

bool ATTR_DLL_LOCAL 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]useThumbs[opt] If set show thumbs if possible on dialog
[in]useFileDirectories[opt] If set also packages (e.g. *.zip) are handled as directories
[in]singleList[opt]
Returns
False if selection becomes canceled

◆ ShowAndGetFileList()

bool ATTR_DLL_LOCAL 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]useThumbs[opt] If set show thumbs if possible on dialog.
[in]useFileDirectories[opt] If set also packages (e.g. *.zip) are handled as directories.
Returns
False if selection becomes canceled.

◆ ShowAndGetImage()

bool ATTR_DLL_LOCAL 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 ATTR_DLL_LOCAL 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 ATTR_DLL_LOCAL 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]additionalShare[opt] With additionalShare becomes the available start folders be set.
[in]type[opt]
Returns
False if selection becomes canceled