本文整理汇总了C++中PlaylistItem::SetFilename方法的典型用法代码示例。如果您正苦于以下问题:C++ PlaylistItem::SetFilename方法的具体用法?C++ PlaylistItem::SetFilename怎么用?C++ PlaylistItem::SetFilename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlaylistItem
的用法示例。
在下文中一共展示了PlaylistItem::SetFilename方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OpenPlaylist
/** Open playlist from file.
* Private method. Return true if file was opened or false if occurs a error.
*/
bool PlaylistFrame::OpenPlaylist()
{
wxString wildcard = _("Playlist|*.ivl");
wxFileDialog fileDlg(this, wxFileSelectorPromptStr, wxEmptyString, wxEmptyString, wildcard, wxFD_OPEN);
if (fileDlg.ShowModal() == wxID_OK)
{
wxString filePath = fileDlg.GetPath();
if (!wxFile::Access(filePath, wxFile::read))
{
wxMessageBox(_("Inexistent file."), _("ERROR"), wxOK, this);
return false;
}
ifstream playlistFile(WX_TO_FILE_CSTR(filePath));
// get length of file:
playlistFile.seekg (0, ios::end);
int length = playlistFile.tellg();
playlistFile.seekg (0, ios::beg);
// allocate memory:
char * buffer = new char [length];
PlaylistItem item;
m_playlist.Clear();
while(!playlistFile.eof())
{
playlistFile.getline(buffer, length);
filePath = WX_FROM_FILE_CSTR(buffer);
item.SetPath(filePath);
#ifdef __WXGTK__
item.SetFilename(filePath.AfterLast('/'));
#else
item.SetFilename(filePath.AfterLast('\\'));
#endif
m_playlist.Add(item);
}
m_playlist.Delete(m_playlist.GetSize() - 1, wxEmptyString);
playlistFile.close();
UpdatePlaylist();
delete [] buffer;
//When move receive EOF, before BeginPlayFile(), the item instructed to play is going to begin of list
if (m_wasStarted)
m_itemPlaying = -1;
wxMessageBox(_("Playlist loaded successfully."), _("Information"), wxOK, this);
}
return true;
}