本文整理汇总了C++中CFileBrowser::getCurrentDir方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileBrowser::getCurrentDir方法的具体用法?C++ CFileBrowser::getCurrentDir怎么用?C++ CFileBrowser::getCurrentDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileBrowser
的用法示例。
在下文中一共展示了CFileBrowser::getCurrentDir方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testShowPictureURL
void CTestMenu::testShowPictureURL()
{
neutrino_msg_t msg;
neutrino_msg_data_t data;
CFileBrowser * fileBrowser;
fileBrowser = new CFileBrowser();
CFileFilter fileFilter;
fileFilter.addFilter("png");
fileFilter.addFilter("bmp");
fileFilter.addFilter("jpg");
fileFilter.addFilter("jpeg");
fileBrowser->Multi_Select = false;
fileBrowser->Dirs_Selectable = false;
fileBrowser->Filter = &fileFilter;
std::string Path_local = g_settings.network_nfs_audioplayerdir;
BROWSER:
if (fileBrowser->exec(Path_local.c_str()))
{
Path_local = fileBrowser->getCurrentDir();
CFile * file;
if ((file = fileBrowser->getSelectedFile()) != NULL)
{
CPictureViewerGui tmpPictureViewerGui;
CPicture pic;
struct stat statbuf;
pic.Filename = file->Name;
std::string tmp = file->Name.substr(file->Name.rfind('/') + 1);
pic.Name = tmp.substr(0, tmp.rfind('.'));
pic.Type = tmp.substr(tmp.rfind('.') + 1);
if(stat(pic.Filename.c_str(), &statbuf) != 0)
printf("stat error");
pic.Date = statbuf.st_mtime;
tmpPictureViewerGui.addToPlaylist(pic);
tmpPictureViewerGui.exec(NULL, "urlplayback");
}
g_RCInput->getMsg_ms(&msg, &data, 10); // 1 sec
if (msg != CRCInput::RC_home)
{
goto BROWSER;
}
}
delete fileBrowser;
}
示例2: testPlayAudioURL
void CTestMenu::testPlayAudioURL()
{
neutrino_msg_t msg;
neutrino_msg_data_t data;
CFileBrowser * fileBrowser;
fileBrowser = new CFileBrowser();
CFileFilter fileFilter;
fileFilter.addFilter("cdr");
fileFilter.addFilter("mp3");
fileFilter.addFilter("mpa");
fileFilter.addFilter("mp2");
fileFilter.addFilter("ogg");
fileFilter.addFilter("wav");
fileFilter.addFilter("flac");
fileFilter.addFilter("aac");
fileFilter.addFilter("dts");
fileFilter.addFilter("m4a");
fileBrowser->Multi_Select = false;
fileBrowser->Dirs_Selectable = false;
fileBrowser->Filter = &fileFilter;
std::string Path_local = g_settings.network_nfs_audioplayerdir;
BROWSER:
if (fileBrowser->exec(Path_local.c_str()))
{
Path_local = fileBrowser->getCurrentDir();
CFile * file;
if ((file = fileBrowser->getSelectedFile()) != NULL)
{
CAudioPlayerGui tmpAudioPlayerGui;
if (file->getType() == CFile::FILE_AUDIO)
{
CAudiofileExt audiofile(file->Name, file->getExtension());
tmpAudioPlayerGui.addToPlaylist(audiofile);
tmpAudioPlayerGui.exec(NULL, "urlplayback");
}
}
g_RCInput->getMsg_ms(&msg, &data, 10); // 1 sec
if (msg != CRCInput::RC_home)
{
goto BROWSER;
}
}
delete fileBrowser;
}
示例3: plugin_exec
void plugin_exec(void)
{
CFileBrowser fileBrowser;
CFileFilter fileFilter;
CMoviePlayerGui tmpMoviePlayerGui;
fileFilter.addFilter("vob");
fileBrowser.Filter = &fileFilter;
fileBrowser.Multi_Select = true;
fileBrowser.Dirs_Selectable = false;
std::string Path_dvd = "/mnt/dvd";
// create mount path
safe_mkdir((char *)Path_dvd.c_str());
// mount selected iso image
char cmd[128];
sprintf(cmd, "mount -o loop /media/hdd/dvd.iso %s", (char *)Path_dvd.c_str());
system(cmd);
DVD_BROWSER:
if(fileBrowser.exec(Path_dvd.c_str()))
{
Path_dvd = fileBrowser.getCurrentDir();
CFileList::const_iterator files = fileBrowser.getSelectedFiles().begin();
for(; files != fileBrowser.getSelectedFiles().end(); files++)
{
CFile file;
file.Name = files->Name;
tmpMoviePlayerGui.addToPlaylist(file);
}
tmpMoviePlayerGui.exec(NULL, "urlplayback");
neutrino_msg_t msg;
neutrino_msg_data_t data;
g_RCInput->getMsg_ms(&msg, &data, 10);
if (msg != CRCInput::RC_home)
{
goto DVD_BROWSER;
}
}
}
示例4: plugin_exec
void plugin_exec(void)
{
neutrino_msg_t msg;
neutrino_msg_data_t data;
CFileBrowser filebrowser;
std::string Path_local = "/media/hdd";
BROWSER:
if (filebrowser.exec(Path_local.c_str()))
{
Path_local = filebrowser.getCurrentDir(); // remark path
// get the current file name
CFile * file;
if ((file = filebrowser.getSelectedFile()) != NULL)
{
// parse file extension
if(file->getType() == CFile::FILE_PICTURE)
{
CPictureViewerGui tmpPictureViewerGui;
CPicture pic;
struct stat statbuf;
pic.Filename = file->Name;
std::string tmp = file->Name.substr(file->Name.rfind('/') + 1);
pic.Name = tmp.substr(0, tmp.rfind('.'));
pic.Type = tmp.substr(tmp.rfind('.') + 1);
if(stat(pic.Filename.c_str(), &statbuf) != 0)
printf("stat error");
pic.Date = statbuf.st_mtime;
tmpPictureViewerGui.addToPlaylist(pic);
tmpPictureViewerGui.exec(NULL, "urlplayback");
}
else if(file->getType() == CFile::FILE_TEXT || file->getType() == CFile::FILE_XML)
{
std::string buffer;
buffer.clear();
char buf[256];
FILE* pFile;
pFile = fopen(file->Name.c_str(), "r");
if(pFile != NULL)
{
fgets(buf, sizeof(buf), pFile);
}
fclose(pFile);
buffer = buf;
int mode = CInfoBox::SCROLL | CInfoBox::TITLE | CInfoBox::FOOT | CInfoBox::BORDER;// | //CInfoBox::NO_AUTO_LINEBREAK | //CInfoBox::CENTER | //CInfoBox::AUTO_WIDTH | //CInfoBox::AUTO_HIGH;
CBox position(g_settings.screen_StartX + 50, g_settings.screen_StartY + 50, g_settings.screen_EndX - g_settings.screen_StartX - 100, g_settings.screen_EndY - g_settings.screen_StartY - 100);
CInfoBox * infoBox = new CInfoBox(file->getFileName().c_str(), g_Font[SNeutrinoSettings::FONT_TYPE_MENU], mode, &position, file->getFileName().c_str(), g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE], NULL);
infoBox->setText(&buffer);
infoBox->exec();
delete infoBox;
}
else if(file->getType() == CFile::FILE_VIDEO)
{
moviePlayerGui->filename = file->Name.c_str();
moviePlayerGui->Title = file->Title;
moviePlayerGui->Info1 = file->Info1;
moviePlayerGui->Info2 = file->Info2;
// play
moviePlayerGui->exec(NULL, "urlplayback");
}
else if(file->getType() == CFile::FILE_AUDIO)
{
CAudioPlayerGui tmpAudioPlayerGui;
CAudiofileExt audiofile(file->Name, file->getExtension());
tmpAudioPlayerGui.addToPlaylist(audiofile);
tmpAudioPlayerGui.exec(NULL, "urlplayback");
}
}
g_RCInput->getMsg_ms(&msg, &data, 10);
if (msg != CRCInput::RC_home)
{
goto BROWSER;
}
}
}
示例5: exec
int COPKGManager::exec(CMenuTarget* parent, const string &actionKey)
{
int res = menu_return::RETURN_REPAINT;
if (actionKey.empty()) {
if (parent)
parent->hide();
int ret = showMenu();
saveConfig();
CFileHelpers::removeDir(OPKG_TMP_DIR);
return ret;
}
int selected = menu->getSelected() - menu_offset;
if (expert_mode && actionKey == "rc_blue") {
if (selected < 0 || selected >= (int) pkg_vec.size() || !pkg_vec[selected]->installed)
return menu_return::RETURN_NONE;
char loc[200];
snprintf(loc, sizeof(loc), g_Locale->getText(LOCALE_OPKG_MESSAGEBOX_REMOVE), pkg_vec[selected]->name.c_str());
if (ShowMsg(LOCALE_OPKG_TITLE, loc, CMessageBox::mbrCancel, CMessageBox::mbYes | CMessageBox::mbCancel) != CMessageBox::mbrCancel) {
if (parent)
parent->hide();
execCmd(pkg_types[OM_REMOVE] + pkg_vec[selected]->name, CShellWindow::VERBOSE | CShellWindow::ACKNOWLEDGE_EVENT);
refreshMenu();
}
return res;
}
if (actionKey == "rc_info") {
if (selected < 0 || selected >= (int) pkg_vec.size()){
DisplayInfoMessage("No information available! Please first select a package!");
return menu_return::RETURN_NONE;
}
//show package info...
bool is_installed = pkg_vec[selected]->installed;
string infostr = getPkgInfo(pkg_vec[selected]->name, "", is_installed /*status or info*/);
//if available, generate a readable string for installation time
if (is_installed){
string tstr = getPkgInfo(pkg_vec[selected]->name, "Installed-Time", is_installed);
stringstream sstr(tstr);
time_t tval; sstr >> tval;
string newstr = asctime(localtime(&tval));
infostr = str_replace(tstr, newstr, infostr);
}
DisplayInfoMessage(infostr.c_str());
return res;
}
if (actionKey == "rc_yellow") {
expert_mode = !expert_mode;
updateMenu();
return res;
}
if (actionKey == "local_package") {
if (parent)
parent->hide();
CFileFilter fileFilter;
string filters[] = {"opk", "ipk"};
for(size_t i=0; i<sizeof(filters)/sizeof(filters[0]) ;i++)
fileFilter.addFilter(filters[i]);
CFileBrowser fileBrowser;
fileBrowser.Filter = &fileFilter;
if (fileBrowser.exec((*local_dir).c_str()))
{
string pkg_name = fileBrowser.getSelectedFile()->Name;
if (!installPackage(pkg_name))
showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pkg_name);
*local_dir = fileBrowser.getCurrentDir();
refreshMenu();
}
return res;
}
if(actionKey == pkg_types[OM_UPGRADE]) {
if (parent)
parent->hide();
int r = execCmd(actionKey, CShellWindow::VERBOSE | CShellWindow::ACKNOWLEDGE_EVENT);
if (r) {
showError(g_Locale->getText(LOCALE_OPKG_FAILURE_UPGRADE), strerror(errno), actionKey);
} else
installed = true;
refreshMenu();
/* I don't think ending up at the last package in the list is a good idea...
g_RCInput->postMsg((neutrino_msg_t) CRCInput::RC_up, 0);
*/
return res;
}
map<string, struct pkg>::iterator it = pkg_map.find(actionKey);
if (it != pkg_map.end()) {
if (parent)
parent->hide();
string force = "";
if (it->second.installed && !it->second.upgradable) {
char l[200];
snprintf(l, sizeof(l), g_Locale->getText(LOCALE_OPKG_MESSAGEBOX_REINSTALL), actionKey.c_str());
//.........这里部分代码省略.........
示例6: testShowPictureFolder
void CTestMenu::testShowPictureFolder()
{
neutrino_msg_t msg;
neutrino_msg_data_t data;
CFileBrowser * fileBrowser;
CFileFilter fileFilter;
CFileList filelist;
int selected = 0;
fileFilter.addFilter("png");
fileFilter.addFilter("bmp");
fileFilter.addFilter("jpg");
fileFilter.addFilter("jpeg");
fileBrowser = new CFileBrowser();
fileBrowser->Multi_Select = true;
fileBrowser->Dirs_Selectable = true;
fileBrowser->Filter = &fileFilter;
std::string Path_local = g_settings.network_nfs_audioplayerdir;
BROWSER:
if (fileBrowser->exec(Path_local.c_str()))
{
Path_local = fileBrowser->getCurrentDir();
CPictureViewerGui tmpPictureViewerGui;
CPicture pic;
struct stat statbuf;
CFileList::const_iterator files = fileBrowser->getSelectedFiles().begin();
for(; files != fileBrowser->getSelectedFiles().end(); files++)
{
if (files->getType() == CFile::FILE_PICTURE)
{
pic.Filename = files->Name;
std::string tmp = files->Name.substr(files->Name.rfind('/') + 1);
pic.Name = tmp.substr(0, tmp.rfind('.'));
pic.Type = tmp.substr(tmp.rfind('.') + 1);
if(stat(pic.Filename.c_str(), &statbuf) != 0)
printf("stat error");
pic.Date = statbuf.st_mtime;
tmpPictureViewerGui.addToPlaylist(pic);
}
}
tmpPictureViewerGui.exec(NULL, "urlplayback");
g_RCInput->getMsg_ms(&msg, &data, 10); // 1 sec
if (msg != CRCInput::RC_home)
{
goto BROWSER;
}
}
delete fileBrowser;
}
示例7: testPlayAudioFolder
void CTestMenu::testPlayAudioFolder()
{
neutrino_msg_t msg;
neutrino_msg_data_t data;
CFileBrowser * fileBrowser;
CFileFilter fileFilter;
CFileList filelist;
fileFilter.addFilter("cdr");
fileFilter.addFilter("mp3");
fileFilter.addFilter("m2a");
fileFilter.addFilter("mpa");
fileFilter.addFilter("mp2");
fileFilter.addFilter("ogg");
fileFilter.addFilter("wav");
fileFilter.addFilter("flac");
fileFilter.addFilter("aac");
fileFilter.addFilter("dts");
fileFilter.addFilter("m4a");
fileBrowser = new CFileBrowser();
fileBrowser->Multi_Select = true;
fileBrowser->Dirs_Selectable = false;
fileBrowser->Filter = &fileFilter;
std::string Path_local = g_settings.network_nfs_audioplayerdir;
BROWSER:
if (fileBrowser->exec(Path_local.c_str()))
{
Path_local = fileBrowser->getCurrentDir();
CAudioPlayerGui tmpAudioPlayerGui;
CFileList::const_iterator files = fileBrowser->getSelectedFiles().begin();
for(; files != fileBrowser->getSelectedFiles().end(); files++)
{
if ( (files->getExtension() == CFile::EXTENSION_CDR)
|| (files->getExtension() == CFile::EXTENSION_MP3)
|| (files->getExtension() == CFile::EXTENSION_WAV)
|| (files->getExtension() == CFile::EXTENSION_FLAC)
)
{
CAudiofileExt audiofile(files->Name, files->getExtension());
tmpAudioPlayerGui.addToPlaylist(audiofile);
}
}
tmpAudioPlayerGui.exec(NULL, "urlplayback");
g_RCInput->getMsg_ms(&msg, &data, 10); // 1 sec
if (msg != CRCInput::RC_home)
{
goto BROWSER;
}
}
delete fileBrowser;
}
示例8: testPlayMovieURL
void CTestMenu::testPlayMovieURL()
{
neutrino_msg_t msg;
neutrino_msg_data_t data;
CFileBrowser * fileBrowser;
fileBrowser = new CFileBrowser();
CFileFilter fileFilter;
fileFilter.addFilter("ts");
fileFilter.addFilter("mpg");
fileFilter.addFilter("mpeg");
fileFilter.addFilter("divx");
fileFilter.addFilter("avi");
fileFilter.addFilter("mkv");
fileFilter.addFilter("asf");
fileFilter.addFilter("aiff");
fileFilter.addFilter("m2p");
fileFilter.addFilter("mpv");
fileFilter.addFilter("m2ts");
fileFilter.addFilter("vob");
fileFilter.addFilter("mp4");
fileFilter.addFilter("mov");
fileFilter.addFilter("flv");
fileFilter.addFilter("dat");
fileFilter.addFilter("trp");
fileFilter.addFilter("vdr");
fileFilter.addFilter("mts");
fileFilter.addFilter("wmv");
fileFilter.addFilter("wav");
fileFilter.addFilter("flac");
fileFilter.addFilter("mp3");
fileFilter.addFilter("wma");
fileFilter.addFilter("ogg");
fileBrowser->Multi_Select = false;
fileBrowser->Dirs_Selectable = false;
fileBrowser->Filter = &fileFilter;
std::string Path_local = g_settings.network_nfs_moviedir;
BROWSER:
if (fileBrowser->exec(Path_local.c_str()))
{
Path_local = fileBrowser->getCurrentDir();
CFile * file;
if ((file = fileBrowser->getSelectedFile()) != NULL)
{
moviePlayerGui->filename = file->Name.c_str();
// movieinfos
moviePlayerGui->Title = file->Title;
moviePlayerGui->Info1 = file->Info1;
moviePlayerGui->Info2 = file->Info2;
moviePlayerGui->thumbnail = file->thumbnail;
// play
moviePlayerGui->exec(NULL, "urlplayback");
}
g_RCInput->getMsg_ms(&msg, &data, 10); // 1 sec
if (msg != CRCInput::RC_home)
{
goto BROWSER;
}
}
delete fileBrowser;
}