本文整理汇总了C++中PackageInfoRef::SetIcon方法的典型用法代码示例。如果您正苦于以下问题:C++ PackageInfoRef::SetIcon方法的具体用法?C++ PackageInfoRef::SetIcon怎么用?C++ PackageInfoRef::SetIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PackageInfoRef
的用法示例。
在下文中一共展示了PackageInfoRef::SetIcon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bestIconFile
status_t
ServerIconExportUpdateProcess::PopulateForPkg(const PackageInfoRef& package)
{
BPath bestIconPath;
if ( fLocalIconStore->TryFindIconPath(
package->Name(), bestIconPath) == B_OK) {
BFile bestIconFile(bestIconPath.Path(), O_RDONLY);
BitmapRef bitmapRef(new(std::nothrow)SharedBitmap(bestIconFile), true);
package->SetIcon(bitmapRef);
if (Logger::IsDebugEnabled()) {
printf("[%s] have set the package icon for [%s] from [%s]\n",
Name(), package->Name().String(), bestIconPath.Path());
}
fCountIconsSet++;
return B_OK;
}
if (Logger::IsDebugEnabled()) {
printf("[%s] did not set the package icon for [%s]; no data\n",
Name(), package->Name().String());
}
return B_FILE_NOT_FOUND;
}
示例2: manager
//.........这里部分代码省略.........
BSolverPackage* package = packages.ItemAt(i);
const BPackageInfo& repoPackageInfo = package->Info();
PackageInfoRef modelInfo;
PackageInfoMap::iterator it = foundPackages.find(
repoPackageInfo.Name());
if (it != foundPackages.end())
modelInfo.SetTo(it->second);
else {
// Add new package info
BString publisherURL;
if (repoPackageInfo.URLList().CountStrings() > 0)
publisherURL = repoPackageInfo.URLList().StringAt(0);
BString publisherName = repoPackageInfo.Vendor();
const BStringList& rightsList = repoPackageInfo.CopyrightList();
if (rightsList.CountStrings() > 0)
publisherName = rightsList.StringAt(0);
modelInfo.SetTo(new(std::nothrow) PackageInfo(
repoPackageInfo.Name(),
repoPackageInfo.Version().ToString(),
PublisherInfo(BitmapRef(), publisherName,
"", publisherURL), repoPackageInfo.Summary(),
repoPackageInfo.Description(),
repoPackageInfo.Flags()),
true);
if (modelInfo.Get() == NULL)
return;
foundPackages[repoPackageInfo.Name()] = modelInfo;
}
modelInfo->SetIcon(defaultIcon);
modelInfo->AddListener(this);
BSolverRepository* repository = package->Repository();
if (dynamic_cast<BPackageManager::RemoteRepository*>(repository)
!= NULL) {
depots[repository->Name()].AddPackage(modelInfo);
remotePackages[modelInfo->Title()] = modelInfo;
} else {
if (repository == static_cast<const BSolverRepository*>(
manager.SystemRepository())) {
modelInfo->AddInstallationLocation(
B_PACKAGE_INSTALLATION_LOCATION_SYSTEM);
if (!modelInfo->IsSystemPackage()) {
systemInstalledPackages[repoPackageInfo.FileName()]
= modelInfo;
}
} else if (repository == static_cast<const BSolverRepository*>(
manager.HomeRepository())) {
modelInfo->AddInstallationLocation(
B_PACKAGE_INSTALLATION_LOCATION_HOME);
}
}
if (modelInfo->IsSystemPackage())
systemFlaggedPackages.Add(repoPackageInfo.FileName());
}
BAutolock lock(fModel.Lock());
fModel.Clear();
// filter remote packages from the found list