本文整理汇总了C++中CTextureDatabase::Open方法的典型用法代码示例。如果您正苦于以下问题:C++ CTextureDatabase::Open方法的具体用法?C++ CTextureDatabase::Open怎么用?C++ CTextureDatabase::Open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTextureDatabase
的用法示例。
在下文中一共展示了CTextureDatabase::Open方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnContextButton
//.........这里部分代码省略.........
local->SetArt("thumb", folderThumb);
local->SetLabel(g_localizeStrings.Get(20017));
items.Add(local);
}
// and add a "no thumb" entry as well
CFileItemPtr nothumb(new CFileItem("thumb://None", false));
nothumb->SetIconImage(item->GetIconImage());
nothumb->SetLabel(g_localizeStrings.Get(20018));
items.Add(nothumb);
std::string strThumb;
VECSOURCES shares;
g_mediaManager.GetLocalDrives(shares);
if (!CGUIDialogFileBrowser::ShowAndGetImage(items, shares, g_localizeStrings.Get(1030), strThumb))
return false;
if (strThumb == "thumb://Current")
return true;
if (strThumb == "thumb://Local")
strThumb = folderThumb;
if (strThumb == "thumb://None")
strThumb = "";
if (!share->m_ignore)
{
CMediaSourceSettings::GetInstance().UpdateSource(type,share->strName,"thumbnail",strThumb);
CMediaSourceSettings::GetInstance().Save();
}
else if (!strThumb.empty())
{ // this is some sort of an auto-share, so store in the texture database
CTextureDatabase db;
if (db.Open())
db.SetTextureForPath(item->GetPath(), "thumb", strThumb);
}
CGUIMessage msg(GUI_MSG_NOTIFY_ALL,0,0,GUI_MSG_UPDATE_SOURCES);
CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg);
return true;
}
case CONTEXT_BUTTON_ADD_LOCK:
{
// prompt user for mastercode when changing lock settings) only for default user
if (!g_passwordManager.IsMasterLockUnlocked(true))
return false;
std::string strNewPassword = "";
if (!CGUIDialogLockSettings::ShowAndGetLock(share->m_iLockMode,strNewPassword))
return false;
// password entry and re-entry succeeded, write out the lock data
share->m_iHasLock = 2;
CMediaSourceSettings::GetInstance().UpdateSource(type, share->strName, "lockcode", strNewPassword);
strNewPassword = StringUtils::Format("%i", share->m_iLockMode);
CMediaSourceSettings::GetInstance().UpdateSource(type, share->strName, "lockmode", strNewPassword);
CMediaSourceSettings::GetInstance().UpdateSource(type, share->strName, "badpwdcount", "0");
CMediaSourceSettings::GetInstance().Save();
CGUIMessage msg(GUI_MSG_NOTIFY_ALL,0,0,GUI_MSG_UPDATE_SOURCES);
CServiceBroker::GetGUI()->GetWindowManager().SendThreadMessage(msg);
return true;
}
case CONTEXT_BUTTON_RESET_LOCK:
{
// prompt user for profile lock when changing lock settings
示例2: Work
//.........这里部分代码省略.........
SetText(itemTitle);
SetProgress(0);
// clear any cached data from the scraper
scraper->ClearCache();
// create the info downloader for the scraper
CVideoInfoDownloader infoDownloader(scraper);
// try to find a matching item
MOVIELIST itemResultList;
int result = infoDownloader.FindMovie(itemTitle, itemResultList, GetProgressDialog());
// close the progress dialog
MarkFinished();
if (result > 0)
{
// there are multiple matches for the item
if (!itemResultList.empty())
{
// choose the first match
if (!IsModal())
scraperUrl = itemResultList.at(0);
else
{
// ask the user what to do
CGUIDialogSelect* selectDialog = g_windowManager.GetWindow<CGUIDialogSelect>(WINDOW_DIALOG_SELECT);
selectDialog->Reset();
selectDialog->SetHeading(scraper->Content() == CONTENT_TVSHOWS ? 20356 : 196);
for (const auto& itemResult : itemResultList)
selectDialog->Add(itemResult.strTitle);
selectDialog->EnableButton(true, 413); // "Manual"
selectDialog->Open();
// check if the user has chosen one of the results
int selectedItem = selectDialog->GetSelectedItem();
if (selectedItem >= 0)
scraperUrl = itemResultList.at(selectedItem);
// the user hasn't chosen one of the results and but has chosen to manually enter a title to use
else if (selectDialog->IsButtonPressed())
{
// ask the user to input a title to use
if (!CGUIKeyboardFactory::ShowAndGetInput(itemTitle, g_localizeStrings.Get(scraper->Content() == CONTENT_TVSHOWS ? 20357 : 16009), false))
return false;
// go through the whole process again
needsRefresh = true;
continue;
}
// nothing else we can do
else
return false;
}
CLog::Log(LOGDEBUG, "CVideoLibraryRefreshingJob: user selected item '%s' with URL '%s'", scraperUrl.strTitle.c_str(), scraperUrl.m_url.at(0).m_url.c_str());
}
}
else if (result < 0 || !VIDEO::CVideoInfoScanner::DownloadFailed(GetProgressDialog()))
{
failure = true;
break;
}
}
// if the URL is still empty, check whether or not we're allowed
示例3: DoWork
bool CRepositoryUpdateJob::DoWork()
{
CLog::Log(LOGDEBUG, "CRepositoryUpdateJob[%s] checking for updates.", m_repo->ID().c_str());
CAddonDatabase database;
database.Open();
std::string oldChecksum;
if (database.GetRepoChecksum(m_repo->ID(), oldChecksum) == -1)
oldChecksum = "";
std::string newChecksum;
VECADDONS addons;
auto status = m_repo->FetchIfChanged(oldChecksum, newChecksum, addons);
database.SetLastChecked(m_repo->ID(), m_repo->Version(),
CDateTime::GetCurrentDateTime().GetAsDBDateTime());
MarkFinished();
if (status == CRepository::STATUS_ERROR)
return false;
if (status == CRepository::STATUS_NOT_MODIFIED)
{
CLog::Log(LOGDEBUG, "CRepositoryUpdateJob[%s] checksum not changed.", m_repo->ID().c_str());
return true;
}
//Invalidate art.
{
CTextureDatabase textureDB;
textureDB.Open();
textureDB.BeginMultipleExecute();
for (const auto& addon : addons)
{
AddonPtr oldAddon;
if (database.GetAddon(addon->ID(), oldAddon) && addon->Version() > oldAddon->Version())
{
if (!oldAddon->Icon().empty() || !oldAddon->FanArt().empty() || !oldAddon->Screenshots().empty())
CLog::Log(LOGDEBUG, "CRepository: invalidating cached art for '%s'", addon->ID().c_str());
if (!oldAddon->Icon().empty())
textureDB.InvalidateCachedTexture(oldAddon->Icon());
if (!oldAddon->FanArt().empty())
textureDB.InvalidateCachedTexture(oldAddon->Icon());
for (const auto& path : oldAddon->Screenshots())
textureDB.InvalidateCachedTexture(path);
}
}
textureDB.CommitMultipleExecute();
}
database.UpdateRepositoryContent(m_repo->ID(), m_repo->Version(), newChecksum, addons);
//Notify about broken status changes
for (const auto& addon : addons)
{
AddonPtr localAddon;
if (!CAddonMgr::GetInstance().GetAddon(addon->ID(), localAddon))
continue;
if (localAddon && localAddon->Version() > addon->Version())
//We have a newer version locally
continue;
AddonPtr oldAddon;
database.GetAddon(addon->ID(), oldAddon);
if (database.GetAddonVersion(addon->ID()).first > addon->Version())
//Newer version in db (ie. in a different repo)
continue;
std::string broken = addon->Broken();
bool isBroken = !addon->Broken().empty();
bool isBrokenInDb = oldAddon && !oldAddon->Broken().empty();
if (isBroken && !isBrokenInDb)
{
//newly broken
if (HELPERS::ShowYesNoDialogLines(CVariant{addon->Name()}, CVariant{24096}, CVariant{24097}, CVariant{""})
== DialogResponse::YES)
{
CAddonMgr::GetInstance().DisableAddon(addon->ID());
}
CLog::Log(LOGDEBUG, "CRepositoryUpdateJob[%s] addon '%s' marked broken. reason: \"%s\"",
m_repo->ID().c_str(), addon->ID().c_str(), broken.c_str());
CEventLog::GetInstance().Add(EventPtr(new CAddonManagementEvent(addon, 24096)));
}
else if (!isBroken && isBrokenInDb)
{
//Unbroken
CLog::Log(LOGDEBUG, "CRepositoryUpdateJob[%s] addon '%s' unbroken",
m_repo->ID().c_str(), addon->ID().c_str());
}
}
return true;
}
示例4: OnContextButton
//.........这里部分代码省略.........
VECSOURCES shares;
g_mediaManager.GetLocalDrives(shares);
if (!CGUIDialogFileBrowser::ShowAndGetImage(items, shares, g_localizeStrings.Get(1030), strThumb))
return false;
if (strThumb == "thumb://Current")
return true;
if (strThumb == "thumb://Local")
strThumb = folderThumb;
if (strThumb == "thumb://None")
strThumb = "";
if (!share->m_ignore)
{
g_settings.UpdateSource(type,share->strName,"thumbnail",strThumb);
g_settings.SaveSources();
}
else if (!strThumb.IsEmpty())
{ // this is some sort of an auto-share, so we have to cache it based on the criteria we use to retrieve them
CStdString cachedThumb;
if (type == "music")
{
cachedThumb = item->m_strPath;
URIUtils::RemoveSlashAtEnd(cachedThumb);
cachedThumb = CUtil::GetCachedMusicThumb(cachedThumb);
}
else if (type == "video")
cachedThumb = item->GetCachedVideoThumb();
else // assume "programs"
{ // store the thumb for this share
CTextureDatabase db;
if (db.Open())
{
cachedThumb = CTextureCache::GetUniqueImage(item->m_strPath, URIUtils::GetExtension(strThumb));
db.SetTextureForPath(item->m_strPath, cachedThumb);
}
}
XFILE::CFile::Cache(strThumb, cachedThumb);
}
CGUIMessage msg(GUI_MSG_NOTIFY_ALL,0,0,GUI_MSG_UPDATE_SOURCES);
g_windowManager.SendThreadMessage(msg);
return true;
}
case CONTEXT_BUTTON_ADD_LOCK:
{
// prompt user for mastercode when changing lock settings) only for default user
if (!g_passwordManager.IsMasterLockUnlocked(true))
return false;
CStdString strNewPassword = "";
if (!CGUIDialogLockSettings::ShowAndGetLock(share->m_iLockMode,strNewPassword))
return false;
// password entry and re-entry succeeded, write out the lock data
share->m_iHasLock = 2;
g_settings.UpdateSource(type, share->strName, "lockcode", strNewPassword);
strNewPassword.Format("%i",share->m_iLockMode);
g_settings.UpdateSource(type, share->strName, "lockmode", strNewPassword);
g_settings.UpdateSource(type, share->strName, "badpwdcount", "0");
g_settings.SaveSources();
CGUIMessage msg(GUI_MSG_NOTIFY_ALL,0,0,GUI_MSG_UPDATE_SOURCES);
g_windowManager.SendThreadMessage(msg);