本文整理汇总了C++中CGUIDialogBusy::SetProgress方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIDialogBusy::SetProgress方法的具体用法?C++ CGUIDialogBusy::SetProgress怎么用?C++ CGUIDialogBusy::SetProgress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIDialogBusy
的用法示例。
在下文中一共展示了CGUIDialogBusy::SetProgress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDirectory
bool CDirectory::GetDirectory(const CURL& url, CFileItemList &items, const CHints &hints, bool allowThreads)
{
try
{
CURL realURL = URIUtils::SubstitutePath(url);
std::shared_ptr<IDirectory> pDirectory(CDirectoryFactory::Create(realURL));
if (!pDirectory.get())
return false;
// check our cache for this path
if (g_directoryCache.GetDirectory(realURL.Get(), items, (hints.flags & DIR_FLAG_READ_CACHE) == DIR_FLAG_READ_CACHE))
items.SetURL(url);
else
{
// need to clear the cache (in case the directory fetch fails)
// and (re)fetch the folder
if (!(hints.flags & DIR_FLAG_BYPASS_CACHE))
g_directoryCache.ClearDirectory(realURL.Get());
pDirectory->SetFlags(hints.flags);
bool result = false, cancel = false;
while (!result && !cancel)
{
const std::string pathToUrl(url.Get());
if (g_application.IsCurrentThread() && allowThreads && !URIUtils::IsSpecial(pathToUrl))
{
CSingleExit ex(g_graphicsContext);
CGetDirectory get(pDirectory, realURL, url);
if(!get.Wait(TIME_TO_BUSY_DIALOG))
{
CGUIDialogBusy* dialog = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY);
if (dialog)
{
dialog->Open();
while(!get.Wait(10))
{
CSingleLock lock(g_graphicsContext);
// update progress
float progress = pDirectory->GetProgress();
if (progress > 0)
dialog->SetProgress(progress);
if (dialog->IsCanceled())
{
cancel = true;
pDirectory->CancelDirectory();
break;
}
lock.Leave(); // prevent an occasional deadlock on exit
g_windowManager.ProcessRenderLoop(false);
}
dialog->Close();
}
}
result = get.GetDirectory(items);
}
else
{
items.SetURL(url);
result = pDirectory->GetDirectory(realURL, items);
}
if (!result)
{
if (!cancel && g_application.IsCurrentThread() && pDirectory->ProcessRequirements())
continue;
CLog::Log(LOGERROR, "%s - Error getting %s", __FUNCTION__, url.GetRedacted().c_str());
return false;
}
}
// cache the directory, if necessary
if (!(hints.flags & DIR_FLAG_BYPASS_CACHE))
g_directoryCache.SetDirectory(realURL.Get(), items, pDirectory->GetCacheType(url));
}
// now filter for allowed files
if (!pDirectory->AllowAll())
{
pDirectory->SetMask(hints.mask);
for (int i = 0; i < items.Size(); ++i)
{
CFileItemPtr item = items[i];
if (!item->m_bIsFolder && !pDirectory->IsAllowed(item->GetURL()))
{
items.Remove(i);
i--; // don't confuse loop
}
}
}
// filter hidden files
// TODO: we shouldn't be checking the gui setting here, callers should use getHidden instead
if (!CSettings::Get().GetBool("filelists.showhidden") && !(hints.flags & DIR_FLAG_GET_HIDDEN))
{
//.........这里部分代码省略.........