本文整理汇总了C++中CGUIDialogBusy::IsCanceled方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIDialogBusy::IsCanceled方法的具体用法?C++ CGUIDialogBusy::IsCanceled怎么用?C++ CGUIDialogBusy::IsCanceled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIDialogBusy
的用法示例。
在下文中一共展示了CGUIDialogBusy::IsCanceled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WaitOnEvent
bool CGUIDialogBusy::WaitOnEvent(CEvent &event, unsigned int displaytime /* = 100 */, bool allowCancel /* = true */)
{
bool cancelled = false;
if (!event.WaitMSec(displaytime))
{
// throw up the progress
CGUIDialogBusy* dialog = g_windowManager.GetWindow<CGUIDialogBusy>(WINDOW_DIALOG_BUSY);
if (dialog)
{
dialog->Open();
while(!event.WaitMSec(1))
{
dialog->ProcessRenderLoop(false);
if (allowCancel && dialog->IsCanceled())
{
cancelled = true;
break;
}
}
dialog->Close();
}
}
return !cancelled;
}
示例2: 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))
{
//.........这里部分代码省略.........
示例3: GetDirectory
bool CDirectory::GetDirectory(const CStdString& strPath, CFileItemList &items, CStdString strMask /*=""*/, bool bUseFileDirectories /* = true */, bool allowPrompting /* = false */, DIR_CACHE_TYPE cacheDirectory /* = DIR_CACHE_ONCE */, bool extFileInfo /* = true */, bool allowThreads /* = false */, bool getHidden /* = false */)
{
try
{
CStdString realPath = URIUtils::SubstitutePath(strPath);
boost::shared_ptr<IDirectory> pDirectory(CFactoryDirectory::Create(realPath));
if (!pDirectory.get())
return false;
// check our cache for this path
if (g_directoryCache.GetDirectory(strPath, items, cacheDirectory == DIR_CACHE_ALWAYS))
items.SetPath(strPath);
else
{
// need to clear the cache (in case the directory fetch fails)
// and (re)fetch the folder
if (cacheDirectory != DIR_CACHE_NEVER)
g_directoryCache.ClearDirectory(strPath);
pDirectory->SetAllowPrompting(allowPrompting);
pDirectory->SetCacheDirectory(cacheDirectory);
pDirectory->SetUseFileDirectories(bUseFileDirectories);
pDirectory->SetExtFileInfo(extFileInfo);
bool result = false, cancel = false;
while (!result && !cancel)
{
if (g_application.IsCurrentThread() && allowThreads && !URIUtils::IsSpecial(strPath))
{
CSingleExit ex(g_graphicsContext);
CGetDirectory get(pDirectory, realPath);
if(!get.Wait(TIME_TO_BUSY_DIALOG))
{
CGUIDialogBusy* dialog = (CGUIDialogBusy*)g_windowManager.GetWindow(WINDOW_DIALOG_BUSY);
dialog->Show();
while(!get.Wait(10))
{
CSingleLock lock(g_graphicsContext);
if(dialog->IsCanceled())
{
cancel = true;
break;
}
g_windowManager.ProcessRenderLoop(false);
}
if(dialog)
dialog->Close();
}
result = get.GetDirectory(items);
}
else
{
items.SetPath(strPath);
result = pDirectory->GetDirectory(realPath, items);
}
if (!result)
{
if (!cancel && g_application.IsCurrentThread() && pDirectory->ProcessRequirements())
continue;
CLog::Log(LOGERROR, "%s - Error getting %s", __FUNCTION__, strPath.c_str());
return false;
}
}
// cache the directory, if necessary
if (cacheDirectory != DIR_CACHE_NEVER)
g_directoryCache.SetDirectory(strPath, items, pDirectory->GetCacheType(strPath));
}
// now filter for allowed files
pDirectory->SetMask(strMask);
for (int i = 0; i < items.Size(); ++i)
{
CFileItemPtr item = items[i];
// TODO: we shouldn't be checking the gui setting here;
// callers should use getHidden instead
if ((!item->m_bIsFolder && !pDirectory->IsAllowed(item->GetPath())) ||
(item->GetPropertyBOOL("file:hidden") && !getHidden && !g_guiSettings.GetBool("filelists.showhidden")))
{
items.Remove(i);
i--; // don't confuse loop
}
}
// Should any of the files we read be treated as a directory?
// Disable for database folders, as they already contain the extracted items
if (bUseFileDirectories && !items.IsMusicDb() && !items.IsVideoDb() && !items.IsSmartPlayList())
FilterFileDirectories(items, strMask);
return true;
}
#ifndef _LINUX
catch (const win32_exception &e)
{
e.writelog(__FUNCTION__);
}
//.........这里部分代码省略.........